Skip to content

Commit ee0be89

Browse files
authored
Merge pull request #142 from magento-pangolin/MC-13414
MC-13414
2 parents 0d67f6e + 7529ebf commit ee0be89

8 files changed

+265
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="OpenStoreFrontProductPageActionGroup">
11+
<arguments>
12+
<argument name="productUrlKey" type="string"/>
13+
</arguments>
14+
<amOnPage url="{{StorefrontProductPage.url(productUrlKey)}}" stepKey="amOnProductPage"/>
15+
<waitForPageLoad stepKey="waitForProductPageLoad"/>
16+
</actionGroup>
17+
</actionGroups>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="OpenStoreFrontCheckoutShippingPageActionGroup">
11+
<amOnPage url="{{CheckoutShippingPage.url}}" stepKey="amOnCheckoutShippingPage"/>
12+
<waitForPageLoad stepKey="waitForCheckoutShippingPageLoad"/>
13+
</actionGroup>
14+
</actionGroups>
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
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+
<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd">
11+
<!-- Free shipping -->
12+
<entity name="EnableFreeShippingConfigData">
13+
<data key="path">carriers/freeshipping/active</data>
14+
<data key="scope">carriers</data>
15+
<data key="scope_id">1</data>
16+
<data key="label">Yes</data>
17+
<data key="value">1</data>
18+
</entity>
19+
<entity name="EnableFreeShippingToSpecificCountriesConfigData">
20+
<data key="path">carriers/freeshipping/sallowspecific</data>
21+
<data key="scope">carriers</data>
22+
<data key="scope_id">1</data>
23+
<data key="label">Specific Countries</data>
24+
<data key="value">1</data>
25+
</entity>
26+
<entity name="EnableFreeShippingToAfghanistanConfigData">
27+
<data key="path">carriers/freeshipping/specificcountry</data>
28+
<data key="scope">carriers</data>
29+
<data key="scope_id">1</data>
30+
<data key="label">Afghanistan</data>
31+
<data key="value">AF</data>
32+
</entity>
33+
<entity name="EnableFreeShippingToAllAllowedCountriesConfigData">
34+
<data key="path">carriers/freeshipping/sallowspecific</data>
35+
<data key="scope">carriers</data>
36+
<data key="scope_id">1</data>
37+
<data key="label">All Allowed Countries</data>
38+
<data key="value">0</data>
39+
</entity>
40+
<entity name="DisableFreeShippingConfigData">
41+
<data key="path">carriers/freeshipping/active</data>
42+
<data key="scope">carriers</data>
43+
<data key="scope_id">1</data>
44+
<data key="label">No</data>
45+
<data key="value">0</data>
46+
</entity>
47+
48+
<!-- Flat Rate shipping -->
49+
<entity name="EnableFlatRateConfigData">
50+
<data key="path">carriers/flatrate/active</data>
51+
<data key="scope">carriers</data>
52+
<data key="scope_id">1</data>
53+
<data key="label">Yes</data>
54+
<data key="value">1</data>
55+
</entity>
56+
<entity name="EnableFlatRateToSpecificCountriesConfigData">
57+
<data key="path">carriers/flatrate/sallowspecific</data>
58+
<data key="scope">carriers</data>
59+
<data key="scope_id">1</data>
60+
<data key="label">Specific Countries</data>
61+
<data key="value">1</data>
62+
</entity>
63+
<entity name="EnableFlatRateToAfghanistanConfigData">
64+
<data key="path">carriers/flatrate/specificcountry</data>
65+
<data key="scope">carriers</data>
66+
<data key="scope_id">1</data>
67+
<data key="label">Afghanistan</data>
68+
<data key="value">AF</data>
69+
</entity>
70+
<entity name="EnableFlatRateToAllAllowedCountriesConfigData">
71+
<data key="path">carriers/flatrate/sallowspecific</data>
72+
<data key="scope">carriers</data>
73+
<data key="scope_id">1</data>
74+
<data key="label">All Allowed Countries</data>
75+
<data key="value">0</data>
76+
</entity>
77+
<entity name="DisableFlatRateConfigData">
78+
<data key="path">carriers/flatrate/active</data>
79+
<data key="scope">carriers</data>
80+
<data key="scope_id">1</data>
81+
<data key="label">No</data>
82+
<data key="value">0</data>
83+
</entity>
84+
</entities>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,6 @@
1919
<element name="shipHereButton" type="button" selector="//div/following-sibling::div/button[contains(@class, 'action-select-shipping-item')]"/>
2020
<element name="shippingMethodLoader" type="button" selector="//div[contains(@class, 'checkout-shipping-method')]/following-sibling::div[contains(@class, 'loading-mask')]"/>
2121
<element name="freeShippingShippingMethod" type="input" selector="#s_method_freeshipping_freeshipping" timeout="30"/>
22+
<element name="noQuotesMsg" type="text" selector="#checkout-step-shipping_method div"/>
2223
</section>
2324
</sections>
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
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="StorefrontGuestCheckoutForSpecificCountriesTest">
12+
<annotations>
13+
<features value="One Page Checkout"/>
14+
<stories value="Checkout for Specific Countries"/>
15+
<title value="Storefront guest checkout for specific countries test"/>
16+
<description value="Checkout flow if shipping rates are not available"/>
17+
<severity value="CRITICAL"/>
18+
<testCaseId value="MC-13414"/>
19+
<group value="checkout"/>
20+
</annotations>
21+
<before>
22+
<!-- Create simple product -->
23+
<createData entity="SimpleProduct2" stepKey="createProduct"/>
24+
25+
<!-- Enable free shipping to specific country - Afghanistan -->
26+
<magentoCLI command="config:set {{EnableFreeShippingConfigData.path}} {{EnableFreeShippingConfigData.value}}" stepKey="enableFreeShipping"/>
27+
<magentoCLI command="config:set {{EnableFreeShippingToSpecificCountriesConfigData.path}} {{EnableFreeShippingToSpecificCountriesConfigData.value}}" stepKey="allowFreeShippingSpecificCountries"/>
28+
<magentoCLI command="config:set {{EnableFreeShippingToAfghanistanConfigData.path}} {{EnableFreeShippingToAfghanistanConfigData.value}}" stepKey="enableFreeShippingToAfghanistan"/>
29+
30+
<!-- Enable flat rate shipping to specific country - Afghanistan -->
31+
<magentoCLI command="config:set {{EnableFlatRateConfigData.path}} {{EnableFlatRateConfigData.value}}" stepKey="enableFlatRate"/>
32+
<magentoCLI command="config:set {{EnableFlatRateToSpecificCountriesConfigData.path}} {{EnableFlatRateToSpecificCountriesConfigData.value}}" stepKey="allowFlatRateSpecificCountries"/>
33+
<magentoCLI command="config:set {{EnableFlatRateToAfghanistanConfigData.path}} {{EnableFlatRateToAfghanistanConfigData.value}}" stepKey="enableFlatRateToAfghanistan"/>
34+
</before>
35+
<after>
36+
<!-- Rollback all configurations -->
37+
<magentoCLI command="config:set {{DisableFreeShippingConfigData.path}} {{DisableFreeShippingConfigData.value}}" stepKey="disableFreeShipping"/>
38+
<magentoCLI command="config:set {{EnableFreeShippingToAllAllowedCountriesConfigData.path}} {{EnableFreeShippingToAllAllowedCountriesConfigData.value}}" stepKey="allowFreeShippingToAllCountries"/>
39+
<magentoCLI command="config:set {{EnableFlatRateToAllAllowedCountriesConfigData.path}} {{EnableFlatRateToAllAllowedCountriesConfigData.value}}" stepKey="allowFlatRateToAllCountries"/>
40+
41+
<!-- Delete product -->
42+
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
43+
</after>
44+
45+
<!-- Add product to cart -->
46+
<actionGroup ref="OpenStoreFrontProductPageActionGroup" stepKey="openProductPage">
47+
<argument name="productUrlKey" value="$$createProduct.custom_attributes[url_key]$$"/>
48+
</actionGroup>
49+
<actionGroup ref="StorefrontAddProductToCartActionGroup" stepKey="addProductToCart">
50+
<argument name="product" value="$$createProduct$$"/>
51+
<argument name="productCount" value="1"/>
52+
</actionGroup>
53+
54+
<!-- Go to checkout page -->
55+
<actionGroup ref="OpenStoreFrontCheckoutShippingPageActionGroup" stepKey="openCheckoutShippingPage"/>
56+
57+
<!-- Assert shipping methods are unavailable -->
58+
<actionGroup ref="AssertStoreFrontShippingMethodUnavailableActionGroup" stepKey="dontSeeFlatRateShippingMethod">
59+
<argument name="shippingMethodName" value="Flat Rate"/>
60+
</actionGroup>
61+
<actionGroup ref="AssertStoreFrontShippingMethodUnavailableActionGroup" stepKey="dontFreeShippingMethod"/>
62+
63+
<!-- Assert no quotes message -->
64+
<actionGroup ref="AssertStoreFrontNoQuotesMessageActionGroup" stepKey="assertNoQuotesMessage"/>
65+
66+
<!-- Assert Next button -->
67+
<dontSeeElement selector="{{CheckoutShippingMethodsSection.next}}" stepKey="dontSeeNextButton"/>
68+
69+
<!-- Fill form with valid data for US > California -->
70+
<selectOption selector="{{CheckoutShippingSection.country}}" userInput="{{US_Address_CA.country}}" stepKey="selectCountry"/>
71+
<selectOption selector="{{CheckoutShippingSection.region}}" userInput="{{US_Address_CA.state}}" stepKey="selectState"/>
72+
<fillField selector="{{CheckoutShippingSection.postcode}}" userInput="{{US_Address_CA.postcode}}" stepKey="fillPostcode"/>
73+
74+
<!-- Assert shipping methods are unavailable for US > California -->
75+
<actionGroup ref="AssertStoreFrontShippingMethodUnavailableActionGroup" stepKey="dontSeeFlatRateShippingMtd">
76+
<argument name="shippingMethodName" value="Flat Rate"/>
77+
</actionGroup>
78+
<actionGroup ref="AssertStoreFrontShippingMethodUnavailableActionGroup" stepKey="dontFreeShippingMtd"/>
79+
80+
<!-- Assert no quotes message for US > California -->
81+
<actionGroup ref="AssertStoreFrontNoQuotesMessageActionGroup" stepKey="assertNoQuotesMsg"/>
82+
83+
<!-- Assert Next button for US > California -->
84+
<dontSeeElement selector="{{CheckoutShippingMethodsSection.next}}" stepKey="dontSeeNextBtn"/>
85+
86+
<!-- Fill form for specific country - Afghanistan -->
87+
<selectOption selector="{{CheckoutShippingSection.country}}" userInput="Afghanistan" stepKey="selectSpecificCountry"/>
88+
89+
<!-- Assert shipping methods are available -->
90+
<actionGroup ref="AssertStoreFrontShippingMethodAvailableActionGroup" stepKey="seeFlatRateShippingMethod"/>
91+
<actionGroup ref="AssertStoreFrontShippingMethodAvailableActionGroup" stepKey="seeFreeShippingMethod">
92+
<argument name="shippingMethodName" value="Free Shipping"/>
93+
</actionGroup>
94+
95+
<!-- Assert Next button is available -->
96+
<seeElement selector="{{CheckoutShippingMethodsSection.next}}" stepKey="seeNextButton"/>
97+
</test>
98+
</tests>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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="AssertStoreFrontNoQuotesMessageActionGroup">
12+
<waitForElementVisible selector="{{CheckoutShippingMethodsSection.noQuotesMsg}}" stepKey="waitForNoQuotesMsgVisible"/>
13+
<see selector="{{CheckoutShippingMethodsSection.noQuotesMsg}}" userInput="Sorry, no quotes are available for this order at this time" stepKey="assertNoQuotesMessage"/>
14+
</actionGroup>
15+
</actionGroups>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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="AssertStoreFrontShippingMethodAvailableActionGroup">
12+
<arguments>
13+
<argument name="shippingMethodName" type="string" defaultValue="Flat Rate"/>
14+
</arguments>
15+
<waitForElementVisible selector="{{CheckoutShippingMethodsSection.shippingMethodRowByName(shippingMethodName)}}" stepKey="waitForShippingMethodLoad"/>
16+
<seeElement selector="{{CheckoutShippingMethodsSection.shippingMethodRowByName(shippingMethodName)}}" stepKey="seeShippingMethod"/>
17+
</actionGroup>
18+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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="AssertStoreFrontShippingMethodUnavailableActionGroup">
12+
<arguments>
13+
<argument name="shippingMethodName" type="string" defaultValue="Free Shipping"/>
14+
</arguments>
15+
<waitForElementNotVisible selector="{{CheckoutShippingMethodsSection.shippingMethodRowByName(shippingMethodName)}}" stepKey="waitForShippingMethodNotVisible"/>
16+
<dontSeeElement selector="{{CheckoutShippingMethodsSection.shippingMethodRowByName(shippingMethodName)}}" stepKey="dontSeeShippingMethod"/>
17+
</actionGroup>
18+
</actionGroups>

0 commit comments

Comments
 (0)