/
StorefrontGuestCheckoutForSpecificCountriesTest.xml
98 lines (82 loc) · 6.02 KB
/
StorefrontGuestCheckoutForSpecificCountriesTest.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<?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="StorefrontGuestCheckoutForSpecificCountriesTest">
<annotations>
<features value="One Page Checkout"/>
<stories value="Checkout for Specific Countries"/>
<title value="Storefront guest checkout for specific countries test"/>
<description value="Checkout flow if shipping rates are not available"/>
<severity value="CRITICAL"/>
<testCaseId value="MC-13414"/>
<group value="checkout"/>
</annotations>
<before>
<!-- Create simple product -->
<createData entity="SimpleProduct2" stepKey="createProduct"/>
<!-- Enable free shipping to specific country - Afghanistan -->
<magentoCLI command="config:set {{EnableFreeShippingConfigData.path}} {{EnableFreeShippingConfigData.value}}" stepKey="enableFreeShipping"/>
<magentoCLI command="config:set {{EnableFreeShippingToSpecificCountriesConfigData.path}} {{EnableFreeShippingToSpecificCountriesConfigData.value}}" stepKey="allowFreeShippingSpecificCountries"/>
<magentoCLI command="config:set {{EnableFreeShippingToAfghanistanConfigData.path}} {{EnableFreeShippingToAfghanistanConfigData.value}}" stepKey="enableFreeShippingToAfghanistan"/>
<!-- Enable flat rate shipping to specific country - Afghanistan -->
<magentoCLI command="config:set {{EnableFlatRateConfigData.path}} {{EnableFlatRateConfigData.value}}" stepKey="enableFlatRate"/>
<magentoCLI command="config:set {{EnableFlatRateToSpecificCountriesConfigData.path}} {{EnableFlatRateToSpecificCountriesConfigData.value}}" stepKey="allowFlatRateSpecificCountries"/>
<magentoCLI command="config:set {{EnableFlatRateToAfghanistanConfigData.path}} {{EnableFlatRateToAfghanistanConfigData.value}}" stepKey="enableFlatRateToAfghanistan"/>
</before>
<after>
<!-- Rollback all configurations -->
<magentoCLI command="config:set {{DisableFreeShippingConfigData.path}} {{DisableFreeShippingConfigData.value}}" stepKey="disableFreeShipping"/>
<magentoCLI command="config:set {{EnableFreeShippingToAllAllowedCountriesConfigData.path}} {{EnableFreeShippingToAllAllowedCountriesConfigData.value}}" stepKey="allowFreeShippingToAllCountries"/>
<magentoCLI command="config:set {{EnableFlatRateToAllAllowedCountriesConfigData.path}} {{EnableFlatRateToAllAllowedCountriesConfigData.value}}" stepKey="allowFlatRateToAllCountries"/>
<!-- Delete product -->
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
</after>
<!-- Add product to cart -->
<actionGroup ref="OpenStoreFrontProductPageActionGroup" stepKey="openProductPage">
<argument name="productUrlKey" value="$$createProduct.custom_attributes[url_key]$$"/>
</actionGroup>
<actionGroup ref="StorefrontAddProductToCartActionGroup" stepKey="addProductToCart">
<argument name="product" value="$$createProduct$$"/>
<argument name="productCount" value="1"/>
</actionGroup>
<!-- Go to checkout page -->
<actionGroup ref="OpenStoreFrontCheckoutShippingPageActionGroup" stepKey="openCheckoutShippingPage"/>
<!-- Assert shipping methods are unavailable -->
<actionGroup ref="AssertStoreFrontShippingMethodUnavailableActionGroup" stepKey="dontSeeFlatRateShippingMethod">
<argument name="shippingMethodName" value="Flat Rate"/>
</actionGroup>
<actionGroup ref="AssertStoreFrontShippingMethodUnavailableActionGroup" stepKey="dontFreeShippingMethod"/>
<!-- Assert no quotes message -->
<actionGroup ref="AssertStoreFrontNoQuotesMessageActionGroup" stepKey="assertNoQuotesMessage"/>
<!-- Assert Next button -->
<dontSeeElement selector="{{CheckoutShippingMethodsSection.next}}" stepKey="dontSeeNextButton"/>
<!-- Fill form with valid data for US > California -->
<selectOption selector="{{CheckoutShippingSection.country}}" userInput="{{US_Address_CA.country}}" stepKey="selectCountry"/>
<selectOption selector="{{CheckoutShippingSection.region}}" userInput="{{US_Address_CA.state}}" stepKey="selectState"/>
<fillField selector="{{CheckoutShippingSection.postcode}}" userInput="{{US_Address_CA.postcode}}" stepKey="fillPostcode"/>
<!-- Assert shipping methods are unavailable for US > California -->
<actionGroup ref="AssertStoreFrontShippingMethodUnavailableActionGroup" stepKey="dontSeeFlatRateShippingMtd">
<argument name="shippingMethodName" value="Flat Rate"/>
</actionGroup>
<actionGroup ref="AssertStoreFrontShippingMethodUnavailableActionGroup" stepKey="dontFreeShippingMtd"/>
<!-- Assert no quotes message for US > California -->
<actionGroup ref="AssertStoreFrontNoQuotesMessageActionGroup" stepKey="assertNoQuotesMsg"/>
<!-- Assert Next button for US > California -->
<dontSeeElement selector="{{CheckoutShippingMethodsSection.next}}" stepKey="dontSeeNextBtn"/>
<!-- Fill form for specific country - Afghanistan -->
<selectOption selector="{{CheckoutShippingSection.country}}" userInput="Afghanistan" stepKey="selectSpecificCountry"/>
<!-- Assert shipping methods are available -->
<actionGroup ref="AssertStoreFrontShippingMethodAvailableActionGroup" stepKey="seeFlatRateShippingMethod"/>
<actionGroup ref="AssertStoreFrontShippingMethodAvailableActionGroup" stepKey="seeFreeShippingMethod">
<argument name="shippingMethodName" value="Free Shipping"/>
</actionGroup>
<!-- Assert Next button is available -->
<seeElement selector="{{CheckoutShippingMethodsSection.next}}" stepKey="seeNextButton"/>
</test>
</tests>