Skip to content

Commit 9e830d3

Browse files
Sahil.kumarSahil.kumar
authored andcommitted
AC-4016:Verify that Zip code format validation/hint is working per Country
1 parent 3b6828d commit 9e830d3

File tree

2 files changed

+72
-0
lines changed

2 files changed

+72
-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
@@ -28,6 +28,7 @@
2828
<element name="city" type="input" selector="input[name=city]"/>
2929
<element name="region" type="select" selector="select[name=region_id]"/>
3030
<element name="postcode" type="input" selector="input[name=postcode]"/>
31+
<element name="invalidPostcodeJSError" type="text" selector="//span[@data-bind='text: element.warn']"/>
3132
<element name="country" type="select" selector="select[name=country_id]"/>
3233
<element name="telephone" type="input" selector="input[name=telephone]"/>
3334
<element name="saveAddress" type="button" selector=".action-save-address"/>
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
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="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="StorefrontVerifyZipCodeWorkingAsPerCountryTest">
12+
<annotations>
13+
<features value="Checkout"/>
14+
<stories value="Guest checkout"/>
15+
<title value="Storefront Verify ZipCode Working As Per Country"/>
16+
<description value="Storefront Verify ZipCode Working As Per Country"/>
17+
<severity value="MAJOR"/>
18+
<testCaseId value="AC-4016"/>
19+
</annotations>
20+
<before>
21+
<!-- create category -->
22+
<createData entity="_defaultCategory" stepKey="createCategory"/>
23+
<!-- create simple product -->
24+
<createData entity="ApiSimpleProduct" stepKey="createProduct">
25+
<requiredEntity createDataKey="createCategory"/>
26+
</createData>
27+
</before>
28+
<after>
29+
<!-- delete category -->
30+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
31+
<!-- delete simple product -->
32+
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
33+
</after>
34+
35+
<!-- Step 1: Go to Storefront as Guest -->
36+
<!-- Step 2: Add simple product to shopping cart -->
37+
<amOnPage url="{{StorefrontProductPage.url($createProduct.custom_attributes[url_key]$)}}" stepKey="amOnSimpleProductPage"/>
38+
<waitForPageLoad stepKey="waitForPageLoad2"/>
39+
<actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="cartAddSimpleProductToCart">
40+
<argument name="productName" value="$createProduct.name$"/>
41+
</actionGroup>
42+
<!-- Proceed to Checkout -->
43+
<actionGroup ref="StorefrontClickOnMiniCartActionGroup" stepKey="clickToOpenCard"/>
44+
<click selector="{{StorefrontMinicartSection.goToCheckout}}" stepKey="clickToProceedToCheckout"/>
45+
<waitForPageLoad stepKey="waitForTheFormIsOpened"/>
46+
<!-- verify shipping screen is opened -->
47+
<seeElement selector="{{CheckoutShippingSection.isShippingStep}}" stepKey="shippingStepIsOpened"/>
48+
<!-- Enter invalid zip code as "1" -->
49+
<fillField selector="{{CheckoutShippingSection.postcode}}" userInput="1" stepKey="SetCustomerZipCode"/>
50+
<!-- wait for JS error message to appear -->
51+
<waitForElementVisible selector="{{CheckoutShippingSection.invalidPostcodeJSError}}" stepKey="waitForElementVisible"/>
52+
<see selector="{{CheckoutShippingSection.invalidPostcodeJSError}}" userInput="Provided Zip/Postal Code seems to be invalid. Example: 12345-6789; 12345. If you believe it is the right one you can ignore this notice." stepKey="seeErrorMessage"/>
53+
54+
<!-- Enter valid zip code as "12345-6789" -->
55+
<fillField selector="{{CheckoutShippingSection.postcode}}" userInput="12345-6789" stepKey="SetCustomerZipCode123456789"/>
56+
<!-- wait for JS error message to disappear -->
57+
<waitForElementNotVisible selector="{{CheckoutShippingSection.invalidPostcodeJSError}}" stepKey="waitForElementNotVisible"/>
58+
<!-- Enter invalid zip code as "abc" -->
59+
<fillField selector="{{CheckoutShippingSection.postcode}}" userInput="abc" stepKey="SetCustomerZipCodeabc"/>
60+
61+
<!-- wait for JS error message to appear -->
62+
<waitForElementVisible selector="{{CheckoutShippingSection.invalidPostcodeJSError}}" stepKey="waitForJSElementMessageVisible"/>
63+
<see selector="{{CheckoutShippingSection.invalidPostcodeJSError}}" userInput="Provided Zip/Postal Code seems to be invalid. Example: 12345-6789; 12345. If you believe it is the right one you can ignore this notice." stepKey="seeJSErrorMessage"/>
64+
<!-- change country as United Kingdom" -->
65+
<selectOption selector="{{CheckoutShippingSection.country}}" userInput="{{updateCustomerUKAddress.country_id}}" stepKey="selectCountry"/>
66+
<!-- Enter valid zip code as "A12 3BC" -->
67+
<fillField selector="{{CheckoutShippingSection.postcode}}" userInput="A12 3BC" stepKey="SetCustomerZipCodeA123BC"/>
68+
<!-- wait for JS error message to disappear -->
69+
<waitForElementNotVisible selector="{{CheckoutShippingSection.invalidPostcodeJSError}}" stepKey="waitForJSErrorElementNotVisible"/>
70+
</test>
71+
</tests>

0 commit comments

Comments
 (0)