Skip to content

Commit

Permalink
ENGCOM-7222: Issue 27358 #27359
Browse files Browse the repository at this point in the history
  • Loading branch information
slavvka committed May 14, 2020
2 parents e2dd73c + 82d8659 commit 16dd439
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="StorefrontAssertUnableSearchNegativeForPriceFieldActionGroup" extends="StorefrontFillFormAdvancedSearchActionGroup">
<remove keyForRemoval="waitForPageLoad" />
<grabTextFrom selector="{{StorefrontCatalogSearchAdvancedFormSection.PriceFromError}}" stepKey="grabPriceFromError"/>
<grabTextFrom selector="{{StorefrontCatalogSearchAdvancedFormSection.PriceToError}}" stepKey="grabPriceToError"/>
<assertEquals stepKey="assertErrorMessagePriceFrom">
<actualResult type="string">{{UnableNegativePrice.Error_message}}</actualResult>
<expectedResult type="string">$grabPriceFromError</expectedResult>
</assertEquals>
<assertEquals stepKey="assertErrorMessagePriceTo">
<actualResult type="string">{{UnableNegativePrice.Error_message}}</actualResult>
<expectedResult type="string">$grabPriceToError</expectedResult>
</assertEquals>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,7 @@
<entity name="MinMaxQueryLength" type="constant">
<data key="Hint">This value must be compatible with the corresponding setting in the configured search engine</data>
</entity>
<entity name="UnableNegativePrice" type="constant">
<data key="Error_message">Please enter a number 0 or greater in this field.</data>
</entity>
</entities>
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
<element name="ShortDescription" type="input" selector="#short_description"/>
<element name="PriceFrom" type="input" selector="#price"/>
<element name="PriceTo" type="input" selector="#price_to"/>
<element name="PriceFromError" type="text" selector="#price-error"/>
<element name="PriceToError" type="text" selector="#price_to-error"/>
<element name="AttributeByCode" type="input" selector="#{{var1}}" parameterized="true"/>
<element name="SubmitButton" type="button" selector="//*[@id='form-validate']//button[@type='submit']"/>
</section>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
<test name="StorefrontCheckUnableAdvancedSearchWithNegativePriceTest">
<annotations>
<stories value="Use Advanced Search"/>
<title value="Unable negative price use to advanced search"/>
<description value="Check unable negative price use to advanced search by price from and price to"/>
</annotations>
<actionGroup ref="StorefrontOpenHomePageActionGroup" stepKey="goToStorefront"/>
<actionGroup ref="StorefrontOpenAdvancedSearchActionGroup" stepKey="openAdvancedSearch"/>
<actionGroup ref="StorefrontAssertUnableSearchNegativeForPriceFieldActionGroup" stepKey="assertUnableSearch">
<argument name="price_to" value="-50"/>
<argument name="price_from" value="-10"/>
</actionGroup>
</test>
</tests>
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*/

// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis
// @codingStandardsIgnoreFile
?>
<?php
/**
Expand Down Expand Up @@ -68,7 +69,7 @@
class="input-text"
type="text"
maxlength="<?= $block->escapeHtmlAttr($maxQueryLength) ?>"
data-validate="{number:true, 'less-than-equals-to':'#<?= $block->escapeHtmlAttr($_code) ?>_to'}" />
data-validate="{number:true, 'validate-not-negative-number':true, 'less-than-equals-to':'#<?= $block->escapeHtmlAttr($_code) ?>_to'}" />
</div>
</div>
<div class="field with-addon no-label">
Expand All @@ -81,7 +82,7 @@
class="input-text"
type="text"
maxlength="<?= $block->escapeHtmlAttr($maxQueryLength) ?>"
data-validate="{number:true, 'greater-than-equals-to':'#<?= $block->escapeHtmlAttr($_code) ?>'}" />
data-validate="{number:true, 'validate-not-negative-number':true, 'greater-than-equals-to':'#<?= $block->escapeHtmlAttr($_code) ?>'}" />
<label class="addafter"
for="<?= $block->escapeHtmlAttr($_code) ?>_to">
<?= $block->escapeHtml($block->getCurrency($_attribute)) ?>
Expand Down

0 comments on commit 16dd439

Please sign in to comment.