Skip to content

Commit 3eae1da

Browse files
authored
Merge pull request #160 from magento-pangolin/MC-7438
MC-7438 Backport for MC-13581
2 parents 449fb1e + 7be090a commit 3eae1da

13 files changed

+302
-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>
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="{{StorefrontCheckoutCartSummarySection.methodName}}" userInput="{{methodName}}" stepKey="seeShippingName"/>
18+
<see selector="{{StorefrontCheckoutCartSummarySection.shippingPrice}}" userInput="{{price}}" stepKey="seeShippingPrice"/>
19+
</actionGroup>
20+
</actionGroups>

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,7 @@
2626
<element name="tableTotals" type="text" selector="#cart-totals .data.table.totals"/>
2727
<element name="shippingMethodLabel" type="text" selector="#co-shipping-method-form dl dt span"/>
2828
<element name="shippingMethodElementId" type="radio" selector="#s_method_{{carrierCode}}_{{methodCode}}" parameterized="true"/>
29+
<element name="methodName" type="text" selector="#co-shipping-method-form label"/>
30+
<element name="shippingPrice" type="text" selector="#co-shipping-method-form span .price"/>
2931
</section>
3032
</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>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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="LoginToStorefrontActionGroup">
11+
<arguments>
12+
<argument name="Customer"/>
13+
</arguments>
14+
<amOnPage url="{{StorefrontCustomerSignInPage.url}}" stepKey="amOnSignInPage"/>
15+
<waitForPageLoad stepKey="waitPageFullyLoaded"/>
16+
<waitForElementVisible selector="{{StorefrontCustomerSignInFormSection.emailField}}" stepKey="waitFormAppears"/>
17+
<fillField userInput="{{Customer.email}}" selector="{{StorefrontCustomerSignInFormSection.emailField}}" stepKey="fillEmail"/>
18+
<fillField userInput="{{Customer.password}}" selector="{{StorefrontCustomerSignInFormSection.passwordField}}" stepKey="fillPassword"/>
19+
<click selector="{{StorefrontCustomerSignInFormSection.signInAccountButton}}" stepKey="clickSignInAccountButton"/>
20+
<waitForPageLoad stepKey="waitForCustomerLoggedIn" />
21+
</actionGroup>
22+
</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: 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="AdminOpenShippingMethodsConfigPageActionGroup">
12+
<amOnPage url="{{AdminShippingMethodsConfigPage.url}}" stepKey="navigateToAdminShippingMethodsPage"/>
13+
<waitForPageLoad stepKey="waitForAdminShippingMethodsPageToLoad"/>
14+
</actionGroup>
15+
</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-7438"/>
19+
<group value="shipping"/>
20+
</annotations>
21+
<before>
22+
<!-- Create product -->
23+
<createData entity="SimpleProduct3" stepKey="createProduct"/>
24+
25+
<!-- Create customer -->
26+
<createData entity="Simple_US_CA_Customer" 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+
<!-- Rollback config -->
39+
<actionGroup ref="AdminOpenShippingMethodsConfigPageActionGroup" stepKey="openShippingMethodSystemConfigPage"/>
40+
<actionGroup ref="AdminSwitchWebsiteByNameActionGroup" stepKey="AdminSwitchStoreViewToMainWebsite">
41+
<argument name="website" value="_defaultWebsite"/>
42+
</actionGroup>
43+
<actionGroup ref="AdminChangeTableRatesShippingMethodStatusActionGroup" stepKey="disableTableRatesShippingMethod">
44+
<argument name="status" value="0"/>
45+
</actionGroup>
46+
<actionGroup ref="AdminSaveConfigActionGroup" stepKey="saveSystemConfig"/>
47+
48+
<!-- Log out -->
49+
<actionGroup ref="logout" stepKey="logout"/>
50+
</after>
51+
52+
<!-- Go to Stores > Configuration > Sales > Shipping Methods -->
53+
<actionGroup ref="AdminOpenShippingMethodsConfigPageActionGroup" stepKey="openShippingMethodConfigPage"/>
54+
55+
<!-- Switch to Website scope -->
56+
<actionGroup ref="AdminSwitchWebsiteByNameActionGroup" stepKey="AdminSwitchStoreView">
57+
<argument name="website" value="_defaultWebsite"/>
58+
</actionGroup>
59+
60+
<!-- Enable Table Rate method and save config -->
61+
<actionGroup ref="AdminChangeTableRatesShippingMethodStatusActionGroup" stepKey="enableTableRatesShippingMethod"/>
62+
<actionGroup ref="AdminSaveConfigActionGroup" stepKey="saveConfig"/>
63+
64+
<!-- Make sure you have Condition Weight vs. Destination -->
65+
<see selector="{{AdminShippingMethodTableRatesSection.condition}}" userInput="{{TableRatesWeightVSDestination.condition}}" stepKey="seeDefaultCondition"/>
66+
67+
<!-- Import file and save config -->
68+
<attachFile selector="{{AdminShippingMethodTableRatesSection.importFile}}" userInput="table_rate_30895.csv" stepKey="attachFileForImport"/>
69+
<actionGroup ref="AdminSaveConfigActionGroup" stepKey="saveConfigs"/>
70+
71+
<!-- Login as customer -->
72+
<actionGroup ref="LoginToStorefrontActionGroup" stepKey="loginAsCustomer">
73+
<argument name="Customer" value="$$createCustomer$$"/>
74+
</actionGroup>
75+
76+
<!-- Add product to the shopping cart -->
77+
<actionGroup ref="OpenStoreFrontProductPageActionGroup" stepKey="openProductPage">
78+
<argument name="productUrlKey" value="$$createProduct.custom_attributes[url_key]$$"/>
79+
</actionGroup>
80+
<actionGroup ref="StorefrontAddProductToCartActionGroup" stepKey="addProductToCart">
81+
<argument name="product" value="$$createProduct$$"/>
82+
<argument name="productCount" value="1"/>
83+
</actionGroup>
84+
85+
<!-- Open the shopping cart page -->
86+
<actionGroup ref="StorefrontOpenCartFromMinicartActionGroup" stepKey="openShoppingCart"/>
87+
88+
<!-- Expand Estimate Shipping and Tax section in Summary -->
89+
<conditionalClick selector="{{StorefrontCheckoutCartSummarySection.estimateShippingAndTax}}" dependentSelector="{{StorefrontCheckoutCartSummarySection.country}}" visible="false" stepKey="expandEstimateShippingAndTax"/>
90+
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMask"/>
91+
92+
<!-- See available Table Rate option -->
93+
<actionGroup ref="StorefrontAssertShippingMethodPresentInCartActionGroup" stepKey="assertShippingMethodLabel">
94+
<argument name="shippingMethod" value="{{TableRatesWeightVSDestination.title}}"/>
95+
</actionGroup>
96+
<actionGroup ref="StorefrontAssertShippingMethodOptionPresentInCartActionGroup" stepKey="assertShippingMethodOption">
97+
<argument name="methodName" value="{{TableRatesWeightVSDestination.methodName}}"/>
98+
<argument name="price" value="{{TableRatesWeightVSDestination.priceCA}}"/>
99+
</actionGroup>
100+
101+
<!-- Change State to New York -->
102+
<selectOption selector="{{StorefrontCheckoutCartSummarySection.region}}" userInput="{{US_Address_NY.state}}" stepKey="selectAnotherState"/>
103+
<waitForPageLoad stepKey="waitForShippingMethodLoad"/>
104+
105+
<!-- See available Table Rate option for another state -->
106+
<actionGroup ref="StorefrontAssertShippingMethodPresentInCartActionGroup" stepKey="assertShippingMethodLabelForAnotherState">
107+
<argument name="shippingMethod" value="{{TableRatesWeightVSDestination.title}}"/>
108+
</actionGroup>
109+
<actionGroup ref="StorefrontAssertShippingMethodOptionPresentInCartActionGroup" stepKey="assertShippingMethodOptionForAnotherState">
110+
<argument name="methodName" value="{{TableRatesWeightVSDestination.methodName}}"/>
111+
<argument name="price" value="{{TableRatesWeightVSDestination.price}}"/>
112+
</actionGroup>
113+
</test>
114+
</tests>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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="AdminSwitchWebsiteByNameActionGroup">
11+
<arguments>
12+
<argument name="website"/>
13+
</arguments>
14+
<scrollToTopOfPage stepKey="scrollToTop"/>
15+
<click selector="{{AdminMainActionsSection.storeViewDropdown}}" stepKey="clickWebsiteSwitchDropdown"/>
16+
<waitForElementVisible selector="{{AdminMainActionsSection.websiteByName('Main Website')}}" stepKey="waitForWebsiteAreVisible"/>
17+
<click selector="{{AdminMainActionsSection.websiteByName(website.name)}}" stepKey="clickWebsiteByName"/>
18+
<waitForElementVisible selector="{{AdminConfirmationModalSection.ok}}" stepKey="waitingForInformationModal"/>
19+
<click selector="{{AdminConfirmationModalSection.ok}}" stepKey="confirmStoreSwitch"/>
20+
<see userInput="{{website.name}}" selector="{{AdminMainActionsSection.storeSwitcher}}" stepKey="seeNewWebsiteName"/>
21+
</actionGroup>
22+
</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+
9+
<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd">
11+
<page name="AdminShippingMethodsConfigPage" url="admin/system_config/edit/section/carriers/" area="admin" module="Magento_Ups">
12+
<section name="AdminShippingMethodsUpsSection"/>
13+
</page>
14+
</pages>
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)