Skip to content

Commit 2099950

Browse files
committed
MAGETWO-91465:Once integer is stored for State/Province field, it can not be changed to alphanumeric
-Added functional test to cover bug fix
1 parent 54f2fd6 commit 2099950

File tree

3 files changed

+57
-0
lines changed

3 files changed

+57
-0
lines changed

app/code/Magento/Checkout/Test/Mftf/Section/CheckoutShippingSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,6 @@
3131
<element name="next" type="button" selector="button.button.action.continue.primary" timeout="30"/>
3232
<element name="firstShippingMethod" type="radio" selector="//*[@id='checkout-shipping-method-load']//input[@class='radio']"/>
3333
<element name="defaultShipping" type="button" selector=".billing-address-details"/>
34+
<element name="stateInput" type="input" selector="input[name=region]"/>
3435
</section>
3536
</sections>
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd">
11+
<test name="AddressStateFieldShouldNotAcceptJustIntegerValuesTest">
12+
<annotations>
13+
<features value="Checkout"/>
14+
<stories value="MAGETWO-91465"/>
15+
<title value="Guest Checkout"/>
16+
<description value="Address State field should not allow just integer values"/>
17+
<severity value="MAJOR"/>
18+
<testCaseId value="MAGETWO-93203"/>
19+
<group value="checkout"/>
20+
</annotations>
21+
<before>
22+
<createData entity="_defaultCategory" stepKey="createCategory"/>
23+
<createData entity="ApiSimpleProduct" stepKey="createProduct">
24+
<requiredEntity createDataKey="createCategory"/>
25+
</createData>
26+
</before>
27+
<after>
28+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
29+
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
30+
</after>
31+
32+
<amOnPage url="{{StorefrontCategoryPage.url($$createCategory.name$$)}}" stepKey="onCategoryPage"/>
33+
<waitForPageLoad stepKey="waitForPageLoad1"/>
34+
<moveMouseOver selector="{{StorefrontCategoryMainSection.ProductItemInfo}}" stepKey="hoverProduct"/>
35+
<click selector="{{StorefrontCategoryMainSection.AddToCartBtn}}" stepKey="addToCart"/>
36+
<waitForElementVisible selector="{{StorefrontCategoryMainSection.SuccessMsg}}" time="30" stepKey="waitForProductAdded"/>
37+
<see selector="{{StorefrontCategoryMainSection.SuccessMsg}}" userInput="You added $$createProduct.name$$ to your shopping cart." stepKey="seeAddedToCartMessage"/>
38+
<see selector="{{StorefrontMinicartSection.quantity}}" userInput="1" stepKey="seeCartQuantity"/>
39+
<actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="guestGoToCheckoutFromMinicart" />
40+
<selectOption stepKey="selectCounty" selector="{{CheckoutShippingSection.country}}" userInput="{{UK_Address.country_id}}"/>
41+
<waitForPageLoad stepKey="waitFormToReload"/>
42+
<fillField selector="{{CheckoutShippingSection.stateInput}}" userInput="1" stepKey="enterStateAsIntegerValue"/>
43+
<waitForPageLoad stepKey="waitforFormValidation"/>
44+
<see userInput="First character must be letter." stepKey="seeTheErrorMessageDisplayed"/>
45+
<fillField selector="{{CheckoutShippingSection.stateInput}}" userInput=" 1" stepKey="enterStateAsIntegerValue1"/>
46+
<waitForPageLoad stepKey="waitforFormValidation1"/>
47+
<see userInput="First character must be letter." stepKey="seeTheErrorMessageDisplayed1"/>
48+
<fillField selector="{{CheckoutShippingSection.stateInput}}" userInput="ABC1" stepKey="enterStateAsIntegerValue2"/>
49+
<waitForPageLoad stepKey="waitforFormValidation2"/>
50+
<dontSee userInput="First character must be letter." stepKey="seeTheErrorMessageIsNotDisplayed"/>
51+
</test>
52+
</tests>

app/code/Magento/Customer/Test/Mftf/Data/AddressData.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,8 @@
8383
<data key="default_shipping">Yes</data>
8484
<requiredEntity type="region">RegionCA</requiredEntity>
8585
</entity>
86+
<!--If required other field can be added to UK_Address entity, dont modify any existing data-->
87+
<entity name="UK_Address" type="address">
88+
<data key="country_id">GB</data>
89+
</entity>
8690
</entities>

0 commit comments

Comments
 (0)