Skip to content

Commit d8109b6

Browse files
authored
Merge pull request #148 from magento-pangolin/MC-13581
MC-13581
2 parents e2a571f + 53ee079 commit d8109b6

8 files changed

+212
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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+
<!-- Assert shipping method name and price are present in cart -->
12+
<actionGroup name="StorefrontAssertShippingMethodOptionPresentInCartActionGroup">
13+
<arguments>
14+
<argument name="methodName" type="string"/>
15+
<argument name="price" type="string"/>
16+
</arguments>
17+
<see selector="{{CheckoutCartSummarySection.methodName}}" userInput="{{methodName}}" stepKey="seeShippingName"/>
18+
<see selector="{{CheckoutCartSummarySection.shippingPrice}}" userInput="{{price}}" stepKey="seeShippingPrice"/>
19+
</actionGroup>
20+
</actionGroups>

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
<element name="estimateShippingAndTax" type="text" selector="#block-shipping-heading" timeout="5"/>
3030
<element name="flatRateShippingMethod" type="input" selector="#s_method_flatrate_flatrate" timeout="30"/>
3131
<element name="shippingMethodLabel" type="text" selector="#co-shipping-method-form dl dt span"/>
32+
<element name="methodName" type="text" selector="#co-shipping-method-form label"/>
33+
<element name="shippingPrice" type="text" selector="#co-shipping-method-form span .price"/>
3234
<element name="shippingMethodElementId" type="radio" selector="#s_method_{{carrierCode}}_{{methodCode}}" parameterized="true"/>
3335
</section>
3436
</sections>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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="AdminSaveConfigActionGroup">
12+
<click selector="{{AdminConfigSection.saveButton}}" stepKey="clickSaveConfigBtn"/>
13+
<waitForPageLoad stepKey="waitForPageLoad"/>
14+
<see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the configuration." stepKey="seeSuccessMessage"/>
15+
</actionGroup>
16+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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+
<!-- Enable/Disable Table Rates shipping method -->
12+
<actionGroup name="AdminChangeTableRatesShippingMethodStatusActionGroup">
13+
<arguments>
14+
<argument name="status" type="string" defaultValue="1"/>
15+
</arguments>
16+
<conditionalClick selector="{{AdminShippingMethodTableRatesSection.carriersTableRateTab}}" dependentSelector="{{AdminShippingMethodTableRatesSection.carriersTableRateActive}}" visible="false" stepKey="expandTab"/>
17+
<uncheckOption selector="{{AdminShippingMethodTableRatesSection.enabledUseSystemValue}}" stepKey="uncheckUseSystemValue"/>
18+
<selectOption selector="{{AdminShippingMethodTableRatesSection.carriersTableRateActive}}" userInput="{{status}}" stepKey="changeTableRatesMethodStatus"/>
19+
</actionGroup>
20+
</actionGroups>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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+
<!-- Prices from file "table_rate_30895.csv" -->
12+
<entity name="TableRatesWeightVSDestination" type="shipping_method">
13+
<data key="condition">Weight vs. Destination</data>
14+
<data key="priceCA">5.00</data>
15+
<data key="price">10.00</data>
16+
<data key="title">Best Way</data>
17+
<data key="methodName">Table Rate</data>
18+
</entity>
19+
</entities>
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+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
11+
<section name="AdminShippingMethodTableRatesSection">
12+
<element name="carriersTableRateTab" type="button" selector="#carriers_tablerate-head"/>
13+
<element name="enabledUseSystemValue" type="checkbox" selector="#carriers_tablerate_active_inherit"/>
14+
<element name="carriersTableRateActive" type="select" selector="#carriers_tablerate_active"/>
15+
<element name="condition" type="select" selector="#carriers_tablerate_condition_name"/>
16+
<element name="importFile" type="input" selector="#carriers_tablerate_import"/>
17+
</section>
18+
</sections>
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
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="TableRatesShippingMethodForDifferentStatesTest">
12+
<annotations>
13+
<features value="Shipping"/>
14+
<stories value="Table Rates"/>
15+
<title value="Table rates shipping method for different states test"/>
16+
<description value="Checkout with Table Rates for different states of the USA"/>
17+
<severity value="CRITICAL"/>
18+
<testCaseId value="MC-13581"/>
19+
<group value="shipping"/>
20+
</annotations>
21+
<before>
22+
<!-- Create product -->
23+
<createData entity="SimpleProduct2" stepKey="createProduct"/>
24+
25+
<!-- Create customer -->
26+
<createData entity="Simple_US_Customer_CA" stepKey="createCustomer"/>
27+
28+
<!-- Login as admin -->
29+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
30+
</before>
31+
<after>
32+
<!-- Delete product -->
33+
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
34+
35+
<!-- Delete customer -->
36+
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/>
37+
38+
<!-- Log out -->
39+
<actionGroup ref="logout" stepKey="logout"/>
40+
</after>
41+
42+
<!-- Go to Stores > Configuration > Sales > Shipping Methods -->
43+
<actionGroup ref="AdminOpenShippingMethodsConfigPageActionGroup" stepKey="openShippingMethodConfigPage"/>
44+
45+
<!-- Switch to Website scope -->
46+
<actionGroup ref="AdminSwitchWebsiteActionGroup" stepKey="AdminSwitchStoreView">
47+
<argument name="website" value="_defaultWebsite"/>
48+
</actionGroup>
49+
50+
<!-- Enable Table Rate method and save config -->
51+
<actionGroup ref="AdminChangeTableRatesShippingMethodStatusActionGroup" stepKey="enableTableRatesShippingMethod"/>
52+
<actionGroup ref="AdminSaveConfigActionGroup" stepKey="saveConfig"/>
53+
54+
<!-- Make sure you have Condition Weight vs. Destination -->
55+
<see selector="{{AdminShippingMethodTableRatesSection.condition}}" userInput="{{TableRatesWeightVSDestination.condition}}" stepKey="seeDefaultCondition"/>
56+
57+
<!-- Import file and save config -->
58+
<attachFile selector="{{AdminShippingMethodTableRatesSection.importFile}}" userInput="table_rate_30895.csv" stepKey="attachFileForImport"/>
59+
<actionGroup ref="AdminSaveConfigActionGroup" stepKey="saveConfigs"/>
60+
61+
<!-- Login as customer -->
62+
<actionGroup ref="LoginToStorefrontActionGroup" stepKey="loginAsCustomer">
63+
<argument name="Customer" value="$$createCustomer$$"/>
64+
</actionGroup>
65+
66+
<!-- Add product to the shopping cart -->
67+
<actionGroup ref="OpenStoreFrontProductPageActionGroup" stepKey="openProductPage">
68+
<argument name="productUrlKey" value="$$createProduct.custom_attributes[url_key]$$"/>
69+
</actionGroup>
70+
<actionGroup ref="StorefrontAddProductToCartActionGroup" stepKey="addProductToCart">
71+
<argument name="product" value="$$createProduct$$"/>
72+
<argument name="productCount" value="1"/>
73+
</actionGroup>
74+
75+
<!-- Open the shopping cart page -->
76+
<actionGroup ref="StorefrontOpenCartFromMinicartActionGroup" stepKey="openShoppingCart"/>
77+
78+
<!-- Expand Estimate Shipping and Tax section in Summary -->
79+
<conditionalClick selector="{{CheckoutCartSummarySection.estimateShippingAndTax}}" dependentSelector="{{CheckoutCartSummarySection.country}}" visible="false" stepKey="expandEstimateShippingAndTax"/>
80+
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMask"/>
81+
82+
<!-- See available Table Rate option -->
83+
<actionGroup ref="StorefrontAssertShippingMethodPresentInCartActionGroup" stepKey="assertShippingMethodLabel">
84+
<argument name="shippingMethod" value="{{TableRatesWeightVSDestination.title}}"/>
85+
</actionGroup>
86+
<actionGroup ref="StorefrontAssertShippingMethodOptionPresentInCartActionGroup" stepKey="assertShippingMethodOption">
87+
<argument name="methodName" value="{{TableRatesWeightVSDestination.methodName}}"/>
88+
<argument name="price" value="{{TableRatesWeightVSDestination.priceCA}}"/>
89+
</actionGroup>
90+
91+
<!-- Change State to New York -->
92+
<selectOption selector="{{CheckoutCartSummarySection.stateProvince}}" userInput="{{US_Address_NY.state}}" stepKey="selectAnotherState"/>
93+
<waitForPageLoad stepKey="waitForShippingMethodLoad"/>
94+
95+
<!-- See available Table Rate option for another state -->
96+
<actionGroup ref="StorefrontAssertShippingMethodPresentInCartActionGroup" stepKey="assertShippingMethodLabelForAnotherState">
97+
<argument name="shippingMethod" value="{{TableRatesWeightVSDestination.title}}"/>
98+
</actionGroup>
99+
<actionGroup ref="StorefrontAssertShippingMethodOptionPresentInCartActionGroup" stepKey="assertShippingMethodOptionForAnotherState">
100+
<argument name="methodName" value="{{TableRatesWeightVSDestination.methodName}}"/>
101+
<argument name="price" value="{{TableRatesWeightVSDestination.price}}"/>
102+
</actionGroup>
103+
104+
<!-- Rollback config -->
105+
<actionGroup ref="AdminOpenShippingMethodsConfigPageActionGroup" stepKey="openShippingMethodSystemConfigPage"/>
106+
<actionGroup ref="AdminSwitchWebsiteActionGroup" stepKey="AdminSwitchStoreViewToMainWebsite">
107+
<argument name="website" value="_defaultWebsite"/>
108+
</actionGroup>
109+
<actionGroup ref="AdminChangeTableRatesShippingMethodStatusActionGroup" stepKey="disableTableRatesShippingMethod">
110+
<argument name="status" value="0"/>
111+
</actionGroup>
112+
<actionGroup ref="AdminSaveConfigActionGroup" stepKey="saveSystemConfig"/>
113+
</test>
114+
</tests>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Country,Region/State,Zip/Postal Code,Weight (and above),Shipping Price
2+
US,CA,*,0,5
3+
US,*,*,0,10

0 commit comments

Comments
 (0)