Skip to content

Commit a3c18e8

Browse files
committed
AC-4588 : Verify that option Allow to Choose State if It is Optional for Country is applicable for checkout flow
1 parent fd5b8d0 commit a3c18e8

File tree

3 files changed

+103
-0
lines changed

3 files changed

+103
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
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="VerifyThatOptionAllowToChooseStateIfItIsOptionalForCountryIsApplicableForCheckoutFlowTest">
12+
<annotations>
13+
<features value="Checkout"/>
14+
<stories value="Verify that option Allow to Choose State if It is Optional for Country is applicable for checkout flow"/>
15+
<title value="Verify that option Allow to Choose State if It is Optional for Country is applicable for checkout flow"/>
16+
<description value="Verify that option Allow to Choose State if It is Optional for Country is applicable for checkout flow"/>
17+
<severity value="MAJOR"/>
18+
<testCaseId value="AC-4588"/>
19+
</annotations>
20+
<before>
21+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginToAdminArea"/>
22+
<actionGroup ref="AdminAllowToChooseStateActionGroup" stepKey="disableAllowState">
23+
<argument name="fieldValue" value="0"/>
24+
</actionGroup>
25+
<createData entity="SimpleSubCategory" stepKey="createCategory"/>
26+
<createData entity="SimpleProduct" stepKey="createProduct">
27+
<requiredEntity createDataKey="createCategory"/>
28+
</createData>
29+
<magentoCLI command="config:set {{EnableFlatRateConfigData.path}} {{EnableFlatRateConfigData.value}}" stepKey="enableFlatRate"/>
30+
<magentoCLI command="config:set {{EnablePaymentCheckMOConfigData.path}} {{EnablePaymentCheckMOConfigData.value}}" stepKey="enableCheckMoneyOrderPayment"/>
31+
</before>
32+
<after>
33+
<actionGroup ref="AdminAllowToChooseStateActionGroup" stepKey="enableAllowState">
34+
<argument name="fieldValue" value="1"/>
35+
</actionGroup>
36+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
37+
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
38+
<magentoCLI stepKey="reindex" command="indexer:reindex"/>
39+
<magentoCLI stepKey="flushCache" command="cache:flush"/>
40+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
41+
</after>
42+
<amOnPage url="{{StorefrontProductPage.url($$createProduct.custom_attributes[url_key]$$)}}" stepKey="goToProductPageOnStorefront"/>
43+
<waitForPageLoad stepKey="waitForStoreFrontProductPageLoad"/>
44+
<actionGroup ref="StorefrontAddProductToCartActionGroup" stepKey="addProductToCart">
45+
<argument name="product" value="$$createProduct$$" />
46+
<argument name="productCount" value="1" />
47+
</actionGroup>
48+
<!-- go to shopping cart and asser states -->
49+
<actionGroup ref="StorefrontOpenCartFromMinicartActionGroup" stepKey="openShoppingCart" />
50+
<click selector="{{CheckoutCartSummarySection.estimateShippingAndTax}}" stepKey="openEstimateTaxSection"/>
51+
<selectOption selector="{{CheckoutCartSummarySection.country}}" userInput="United States" stepKey="selectUSCountry"/>
52+
<seeElement selector="{{CheckoutCartSummarySection.stateProvince}}" stepKey="assertUSStateProvince"/>
53+
<selectOption selector="{{CheckoutCartSummarySection.country}}" userInput="Tajikistan" stepKey="selectTJKCountry"/>
54+
<dontSeeElement selector="{{CheckoutCartSummarySection.stateProvince}}" stepKey="dontSeeTJKStateProvince"/>
55+
<selectOption selector="{{CheckoutCartSummarySection.country}}" userInput="France" stepKey="selectFRCountry"/>
56+
<dontSeeElement selector="{{CheckoutCartSummarySection.stateProvince}}" stepKey="dontSeeFRStateProvince"/>
57+
<!-- go to shipping page and assert states -->
58+
<click selector="{{CheckoutCartSummarySection.proceedToCheckout}}" stepKey="goToCheckout"/>
59+
<selectOption selector="{{CheckoutShippingGuestInfoSection.country}}" userInput="Tajikistan" stepKey="selectTJCountry"/>
60+
<dontSeeElement selector="{{CheckoutShippingGuestInfoSection.region}}" stepKey="dontSeeTJStateProvince"/>
61+
<selectOption selector="{{CheckoutShippingGuestInfoSection.country}}" userInput="France" stepKey="selectFranceCountry"/>
62+
<dontSeeElement selector="{{CheckoutShippingGuestInfoSection.region}}" stepKey="dontSeeFranceStateProvince"/>
63+
<selectOption selector="{{CheckoutShippingGuestInfoSection.country}}" userInput="United States" stepKey="selectUStatesCountry"/>
64+
<seeElement selector="{{CheckoutShippingGuestInfoSection.region}}" stepKey="seeUSStateProvince"/>
65+
<actionGroup ref="FillGuestCheckoutShippingAddressWithCountryAndStateActionGroup" stepKey="fillGuestShippingFormData">
66+
<argument name="customer" value="CustomerEntityOne"/>
67+
<argument name="customerAddress" value="CustomerAddressSimple"/>
68+
</actionGroup>
69+
<actionGroup ref="StorefrontSelectFirstShippingMethodActionGroup" stepKey="selectFirstShippingMethod"/>
70+
<actionGroup ref="StorefrontCheckoutClickNextButtonActionGroup" stepKey="clickNext"/>
71+
<!-- Checkout select Check/Money Order payment -->
72+
<actionGroup ref="CheckoutSelectCheckMoneyOrderPaymentActionGroup" stepKey="selectCheckMoneyPayment"/>
73+
<actionGroup ref="ClickPlaceOrderActionGroup" stepKey="clickPlaceOrder"/>
74+
</test>
75+
</tests>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AdminAllowToChooseStateActionGroup">
12+
<annotations>
13+
<description>Goes to the 'Configuration' page for 'General'. Selects the provided Countries under 'State is Required for'. Clicks on the Save button.</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="fieldValue" type="string"/>
17+
</arguments>
18+
19+
<amOnPage url="{{AdminConfigGeneralPage.url}}" stepKey="navigateToAdminConfigGeneralPage"/>
20+
<conditionalClick selector="{{StateOptionsSection.stateOptions}}" dependentSelector="{{StateOptionsSection.countriesWithRequiredRegions}}" visible="false" stepKey="expandStateOptionsTab"/>
21+
<waitForAjaxLoad stepKey="waitForAjax"/>
22+
<scrollTo selector="{{StateOptionsSection.countriesWithRequiredRegions}}" stepKey="scrollToForm"/>
23+
<selectOption selector="{{StateOptionsSection.allowToChooseStateOptionalForCountry}}" userInput="{{fieldValue}}" stepKey="selectStatus"/>
24+
<click selector="#save" stepKey="saveConfig"/>
25+
<waitForPageLoad stepKey="waitForSavingConfig"/>
26+
</actionGroup>
27+
</actionGroups>

app/code/Magento/Config/Test/Mftf/Section/GeneralSection/StateOptionsSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@
1111
<element name="stateOptions" type="button" selector="#general_region-head"/>
1212
<element name="countriesWithRequiredRegions" type="select" selector="#general_region_state_required"/>
1313
<element name="allowToChooseState" type="select" selector="general_region_display_all"/>
14+
<element name="allowToChooseStateOptionalForCountry" type="select" selector="//td[@class='value']//select[@name='groups[region][fields][display_all][value]']"/>
1415
</section>
1516
</sections>

0 commit comments

Comments
 (0)