Skip to content

Commit 085c331

Browse files
MC-36088: Non-relevant shipping method available for checkout
1 parent 1e6f09c commit 085c331

File tree

3 files changed

+71
-0
lines changed

3 files changed

+71
-0
lines changed

app/code/Magento/Checkout/Test/Mftf/Data/ConfigData.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,13 @@
8181
<data key="label">All Allowed Countries</data>
8282
<data key="value">0</data>
8383
</entity>
84+
<entity name="EnableFlatRateShowMethodNoApplicableConfigData">
85+
<data key="path">carriers/flatrate/showmethod</data>
86+
<data key="scope">carriers</data>
87+
<data key="scope_id">1</data>
88+
<data key="label">Show Method if Not Applicable</data>
89+
<data key="value">1</data>
90+
</entity>
8491
<entity name="DisableFlatRateConfigData">
8592
<data key="path">carriers/flatrate/active</data>
8693
<data key="scope">carriers</data>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,6 @@
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"/>
2222
<element name="noQuotesMsg" type="text" selector="#checkout-step-shipping_method div"/>
23+
<element name="price" type="text" selector="//*[@id='checkout-shipping-method-load']//td[@class='col col-price']"/>
2324
</section>
2425
</sections>
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
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="StorefrontCheckoutForShowShippingMethodNoApplicableTest">
12+
<annotations>
13+
<stories value="Checkout for not applicable shipping method"/>
14+
<title value="Storefront checkout for not applicable shipping method test"/>
15+
<description value="Checkout flow if shipping rates are not applicable"/>
16+
<severity value="AVERAGE"/>
17+
<testCaseId value="MC-37420"/>
18+
<group value="checkout"/>
19+
</annotations>
20+
<before>
21+
<!-- Create simple product -->
22+
<createData entity="SimpleProduct2" stepKey="createProduct"/>
23+
<!-- Enable flat rate shipping to specific country - Afghanistan -->
24+
<magentoCLI command="config:set {{EnableFlatRateConfigData.path}} {{EnableFlatRateConfigData.value}}" stepKey="enableFlatRate"/>
25+
<magentoCLI command="config:set {{EnableFlatRateToSpecificCountriesConfigData.path}} {{EnableFlatRateToSpecificCountriesConfigData.value}}" stepKey="allowFlatRateSpecificCountries"/>
26+
<magentoCLI command="config:set {{EnableFlatRateToAfghanistanConfigData.path}} {{EnableFlatRateToAfghanistanConfigData.value}}" stepKey="enableFlatRateToAfghanistan"/>
27+
<!-- Enable Show Method if Not Applicable-->
28+
<magentoCLI command="config:set {{EnableFlatRateShowMethodNoApplicableConfigData.path}} {{EnableFlatRateShowMethodNoApplicableConfigData.value}}" stepKey="enableShowMethodNoApplicable"/>
29+
<!-- Create Customer with filled Shipping & Billing Address -->
30+
<createData entity="CustomerEntityOne" stepKey="createCustomer"/>
31+
</before>
32+
<after>
33+
<actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="logoutFromStorefront"/>
34+
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/>
35+
<magentoCLI command="config:set {{EnableFlatRateToAllAllowedCountriesConfigData.path}} {{EnableFlatRateToAllAllowedCountriesConfigData.value}}" stepKey="allowFlatRateToAllCountries"/>
36+
<magentoCLI command="config:set {{EnableFlatRateShowMethodNoApplicableConfigData.path}} 0" stepKey="disableShowMethodNoApplicable"/>
37+
<!-- Delete product -->
38+
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
39+
</after>
40+
<!-- Login with created Customer -->
41+
<actionGroup ref="LoginToStorefrontActionGroup" stepKey="loginAsCustomer">
42+
<argument name="Customer" value="$$createCustomer$$"/>
43+
</actionGroup>
44+
<!-- Add product to cart -->
45+
<actionGroup ref="OpenStoreFrontProductPageActionGroup" stepKey="openProductPage">
46+
<argument name="productUrlKey" value="$$createProduct.custom_attributes[url_key]$$"/>
47+
</actionGroup>
48+
<actionGroup ref="StorefrontAddProductToCartActionGroup" stepKey="addProductToCart">
49+
<argument name="product" value="$$createProduct$$"/>
50+
<argument name="productCount" value="1"/>
51+
</actionGroup>
52+
<!-- Go to checkout page -->
53+
<actionGroup ref="OpenStoreFrontCheckoutShippingPageActionGroup" stepKey="openCheckoutShippingPage"/>
54+
<!-- Assert shipping price for US > California -->
55+
<dontSeeElement selector="{{CheckoutShippingMethodsSection.price}}" stepKey="dontSeePrice"/>
56+
<!-- Assert Next button is available -->
57+
<seeElement selector="{{CheckoutShippingMethodsSection.next}}" stepKey="seeNextButton"/>
58+
<click selector="{{CheckoutShippingMethodsSection.next}}" stepKey="clickNextButton"/>
59+
<!-- Assert order cannot be placed and error message will shown. -->
60+
<waitForPageLoad stepKey="waitForError"/>
61+
<see stepKey="seeShippingMethodError" userInput="The shipping method is missing. Select the shipping method and try again."/>
62+
</test>
63+
</tests>

0 commit comments

Comments
 (0)