Skip to content

Commit a8aaf25

Browse files
committed
ACQE-7346:Import table rate shipping prices with specific amount including and excluding virtual products
New Testcase Added
1 parent 078c387 commit a8aaf25

File tree

3 files changed

+221
-4
lines changed

3 files changed

+221
-4
lines changed

app/code/Magento/Customer/Test/Mftf/Data/AddressData.xml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
33
/**
4-
* Copyright © Magento, Inc. All rights reserved.
5-
* See COPYING.txt for license details.
4+
* Copyright 2024 Adobe
5+
* All Rights Reserved.
66
*/
77
-->
88

@@ -129,6 +129,24 @@
129129
<data key="default_billing">Yes</data>
130130
<requiredEntity type="region">RegionTX</requiredEntity>
131131
</entity>
132+
<entity name="US_Address_Custom" type="address">
133+
<data key="firstname">Adam</data>
134+
<data key="lastname">Black</data>
135+
<data key="company">Magento</data>
136+
<array key="street">
137+
<item>1100 West Parmer Lane</item>
138+
<item>113</item>
139+
</array>
140+
<data key="city">Los Angeles</data>
141+
<data key="state">California</data>
142+
<data key="country_id">US</data>
143+
<data key="country">United States</data>
144+
<data key="postcode">20011</data>
145+
<data key="telephone">512-345-6789</data>
146+
<data key="default_billing">Yes</data>
147+
<data key="default_shipping">Yes</data>
148+
<requiredEntity type="region">RegionCA</requiredEntity>
149+
</entity>
132150
<entity name="US_Address_NY" type="address">
133151
<data key="firstname">John</data>
134152
<data key="lastname">Doe</data>
Lines changed: 198 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,198 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright 2024 Adobe
5+
* All Rights Reserved.
6+
*/
7+
-->
8+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
9+
<test name="AdminImportTableRatesWithSpecificAmountTest">
10+
<annotations>
11+
<features value="Shipping"/>
12+
<stories value="Offline Shipping Methods"/>
13+
<title value="Import table rate shipping prices with specific amount including and excluding virtual products"/>
14+
<description value="Admin Should Able to import table rate shipping prices with specific amount with Virtual Products as per Configuration"/>
15+
<severity value="MAJOR"/>
16+
<testCaseId value="AC-13526"/>
17+
<group value="shipping"/>
18+
</annotations>
19+
<before>
20+
<!--Create customer-->
21+
<createData entity="Simple_Customer_Without_Address" stepKey="createCustomer"/>
22+
<!-- Add simple product -->
23+
<createData entity="SimpleProduct2" stepKey="createFirstSimpleProduct">
24+
<field key="price">9.00</field>
25+
</createData>
26+
<createData entity="SimpleProduct2" stepKey="createSecondSimpleProduct">
27+
<field key="price">11.00</field>
28+
</createData>
29+
<createData entity="SimpleProduct3" stepKey="createThirdSimpleProduct">
30+
<field key="price">64.00</field>
31+
</createData>
32+
<createData entity="ApiVirtualProductWithDescription" stepKey="createVirtualProduct"/>
33+
<magentoCLI command="config:set {{DisableFlatRateConfigData.path}} {{DisableFlatRateConfigData.value}}" stepKey="disableFlatRate"/>
34+
</before>
35+
<after>
36+
<!-- Roll back configuration -->
37+
<magentoCLI command="config:set {{EnableFlatRateConfigData.path}} {{EnableFlatRateConfigData.value}}" stepKey="enableFlatRate"/>
38+
<!-- Go to Stores > Configuration > Sales > Shipping Methods -->
39+
<actionGroup ref="AdminOpenShippingMethodsConfigPageActionGroup" stepKey="openShippingMethodConfigPage"/>
40+
<!-- Switch to Website scope -->
41+
<actionGroup ref="AdminSwitchWebsiteActionGroup" stepKey="AdminSwitchStoreView">
42+
<argument name="website" value="_defaultWebsite"/>
43+
</actionGroup>
44+
<!-- Check Use Default checkbox for Default Condition and Active -->
45+
<checkOption selector="{{AdminShippingMethodTableRatesSection.carriersTableRateConditionName}}" stepKey="enableUseDefaultCondition"/>
46+
<checkOption selector="{{AdminShippingMethodTableRatesSection.enabledUseSystemValue}}" stepKey="enableUseDefaultActive"/>
47+
<actionGroup ref="AdminSaveConfigActionGroup" stepKey="saveConfigs"/>
48+
<!-- Log out -->
49+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
50+
<!-- Remove Virtual products-->
51+
<deleteData createDataKey="createVirtualProduct" stepKey="deleteVirtualProduct"/>
52+
<!-- Remove simple products-->
53+
<deleteData createDataKey="createFirstSimpleProduct" stepKey="deleteFirstSimpleProduct"/>
54+
<deleteData createDataKey="createSecondSimpleProduct" stepKey="deleteSecondSimpleProduct"/>
55+
<deleteData createDataKey="createThirdSimpleProduct" stepKey="deleteThirdSimpleProduct"/>
56+
<!-- Delete sales rule -->
57+
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/>
58+
</after>
59+
<!-- Login as admin -->
60+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
61+
<!-- Go to Stores > Configuration > Sales > Shipping Methods -->
62+
<actionGroup ref="AdminOpenShippingMethodsConfigPageActionGroup" stepKey="openShippingMethodConfigPage"/>
63+
<!-- Switch to Website scope -->
64+
<actionGroup ref="AdminSwitchWebsiteActionGroup" stepKey="AdminSwitchStoreView">
65+
<argument name="website" value="_defaultWebsite"/>
66+
</actionGroup>
67+
<!-- Enable Table Rate method and save config -->
68+
<actionGroup ref="AdminChangeTableRatesShippingMethodStatusActionGroup" stepKey="enableTableRatesShippingMethod"/>
69+
<!-- Uncheck Use Default checkbox for Default Condition -->
70+
<uncheckOption selector="{{AdminShippingMethodTableRatesSection.carriersTableRateConditionName}}" stepKey="disableUseDefaultCondition"/>
71+
<!-- Make sure you have Condition Price vs. Destination -->
72+
<selectOption selector="{{AdminShippingMethodTableRatesSection.condition}}" userInput="{{TableRateShippingMethodConfig.package_value_with_discount}}" stepKey="setCondition"/>
73+
<!-- Uncheck Use Default checkbox for include virtual price -->
74+
<uncheckOption selector="{{AdminShippingMethodTableRatesSection.carriersTableRateIncludeVirtualPrice}}" stepKey="uncheckIncludeVirtualPrice"/>
75+
<selectOption selector="{{AdminShippingMethodTableRatesSection.carriersTableRateIncludeVirtualPriceDropdown}}" userInput="No" stepKey="setIncludeVirtualPriceAsYes"/>
76+
<!-- Import file and save config -->
77+
<attachFile selector="{{AdminShippingMethodTableRatesSection.importFile}}" userInput="usa_tablerates.csv" stepKey="attachFileForImport"/>
78+
<actionGroup ref="AdminSaveConfigActionGroup" stepKey="saveConfigs"/>
79+
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex">
80+
<argument name="indices" value=""/>
81+
</actionGroup>
82+
<!-- Login as Customer Login from Customer page -->
83+
<actionGroup ref="LoginToStorefrontActionGroup" stepKey="customerLogin">
84+
<argument name="Customer" value="$$createCustomer$$" />
85+
</actionGroup>
86+
<actionGroup ref="StorefrontAddNewCustomerAddressActionGroup" stepKey="AddNewAddress">
87+
<argument name="Address" value="US_Address_Custom"/>
88+
</actionGroup>
89+
<!-- Add simple product to cart -->
90+
<actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="addProductToCart">
91+
<argument name="product" value="$$createFirstSimpleProduct$$"/>
92+
</actionGroup>
93+
<!-- Assert that table rate value is correct for US -->
94+
<actionGroup ref="StorefrontCartPageOpenActionGroup" stepKey="goToCheckout"/>
95+
<waitForElement time="30" selector="{{CheckoutCartSummarySection.estimateShippingAndTaxForm}}" stepKey="waitForEstimateShippingAndTaxForm"/>
96+
<conditionalClick selector="{{CheckoutCartSummarySection.estimateShippingAndTax}}" dependentSelector="{{CheckoutCartSummarySection.country}}" visible="false" stepKey="expandEstimateShippingandTax" />
97+
<scrollTo selector="{{CheckoutCartSummarySection.shippingPrice}}" stepKey="scrollToShippingForUS"/>
98+
<grabTextFrom selector="{{CheckoutCartSummarySection.shippingPrice}}" stepKey="grabTableratePrice5"/>
99+
<assertStringContainsString stepKey="checkCustomerShippingPrice5">
100+
<expectedResult type="string">$6.99</expectedResult>
101+
<actualResult type="variable">grabTableratePrice5</actualResult>
102+
</assertStringContainsString>
103+
<waitForText selector="{{CheckoutCartSummarySection.country}}" userInput="United States" stepKey="selectUSCountry"/>
104+
<waitForText selector="{{CheckoutCartSummarySection.stateProvince}}" userInput="California" stepKey="selectCaliforniaRegion"/>
105+
<waitForElementVisible selector="{{CheckoutCartSummarySection.postcode}}" stepKey="selectZipCode"/>
106+
<grabValueFrom selector="{{CheckoutCartSummarySection.postcode}}" stepKey="grabTextPostCode"/>
107+
<assertEquals message="pass" stepKey="checkCustomerPostcode">
108+
<expectedResult type="string">{{US_Address_Custom.postcode}}</expectedResult>
109+
<actualResult type="variable">grabTextPostCode</actualResult>
110+
</assertEquals>
111+
<waitForPageLoad stepKey="waitForSelectCountry"/>
112+
<!-- Add simple product to cart -->
113+
<actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="addSecondProductToCart1">
114+
<argument name="product" value="$$createVirtualProduct$$"/>
115+
</actionGroup>
116+
<!-- Assert that table rate value is correct for US -->
117+
<actionGroup ref="StorefrontCartPageOpenActionGroup" stepKey="goAgainToCheckout"/>
118+
<conditionalClick selector="{{CheckoutCartSummarySection.estimateShippingAndTax}}" dependentSelector="{{CheckoutCartSummarySection.country}}" visible="false" stepKey="expandEstimateShippingandTax1"/>
119+
<grabTextFrom selector="{{CheckoutCartSummarySection.shippingPrice}}" stepKey="grabTableratePrice2"/>
120+
<assertStringContainsString stepKey="checkCustomerShippingPrice2">
121+
<expectedResult type="string">$6.99</expectedResult>
122+
<actualResult type="variable">grabTableratePrice2</actualResult>
123+
</assertStringContainsString>
124+
<!-- Assert product details in Mini Cart -->
125+
<actionGroup ref="StorefrontClickOnMiniCartActionGroup" stepKey="clickOnMiniCart"/>
126+
<!--Remove an item from the cart using minicart-->
127+
<actionGroup ref="RemoveProductFromMiniCartActionGroup" stepKey="removeProductFromMiniCart">
128+
<argument name="productName" value="$$createFirstSimpleProduct.name$$"/>
129+
</actionGroup>
130+
<!-- Add simple product to cart -->
131+
<actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="addAnotherProductToCart">
132+
<argument name="product" value="$$createSecondSimpleProduct$$"/>
133+
</actionGroup>
134+
<!-- Assert that table rate value is correct for US -->
135+
<actionGroup ref="StorefrontCartPageOpenActionGroup" stepKey="navigateToToCheckout"/>
136+
<conditionalClick selector="{{CheckoutCartSummarySection.estimateShippingAndTax}}" dependentSelector="{{CheckoutCartSummarySection.country}}" visible="false" stepKey="expandEstimateShippingPrice"/>
137+
<grabTextFrom selector="{{CheckoutCartSummarySection.shippingPrice}}" stepKey="grabTableratePrice1"/>
138+
<assertStringContainsString stepKey="checkCustomerShippingPrice1">
139+
<expectedResult type="string">$6.99</expectedResult>
140+
<actualResult type="variable">grabTableratePrice1</actualResult>
141+
</assertStringContainsString>
142+
<!-- Assert product details in Mini Cart -->
143+
<actionGroup ref="StorefrontClickOnMiniCartActionGroup" stepKey="clickOnMiniCart1"/>
144+
<!--Remove an item from the cart using minicart-->
145+
<actionGroup ref="RemoveProductFromMiniCartActionGroup" stepKey="removeProductFromMiniCart1">
146+
<argument name="productName" value="$$createSecondSimpleProduct.name$$"/>
147+
</actionGroup>
148+
<!-- Add simple product to cart -->
149+
<actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="addAnotherProductIntoCart">
150+
<argument name="product" value="$$createThirdSimpleProduct$$"/>
151+
</actionGroup>
152+
<!-- Assert that table rate value is correct for US -->
153+
<actionGroup ref="StorefrontCartPageOpenActionGroup" stepKey="navigateAgainToToCheckout"/>
154+
<conditionalClick selector="{{CheckoutCartSummarySection.estimateShippingAndTax}}" dependentSelector="{{CheckoutCartSummarySection.country}}" visible="false" stepKey="expandEstimateShippingPrice1"/>
155+
<grabTextFrom selector="{{CheckoutCartSummarySection.shippingPrice}}" stepKey="grabTableratePrice3"/>
156+
<assertStringContainsString stepKey="checkCustomerShippingPrice3">
157+
<expectedResult type="string">$4.99</expectedResult>
158+
<actualResult type="variable">grabTableratePrice3</actualResult>
159+
</assertStringContainsString>
160+
<!-- Assert product details in Mini Cart -->
161+
<actionGroup ref="StorefrontClickOnMiniCartActionGroup" stepKey="clickOnMiniCart2"/>
162+
<!--Remove an item from the cart using minicart-->
163+
<actionGroup ref="RemoveProductFromMiniCartActionGroup" stepKey="removeProductFromMiniCart3">
164+
<argument name="productName" value="$$createThirdSimpleProduct.name$$"/>
165+
</actionGroup>
166+
<!-- Assert that table rate value is correct for US -->
167+
<actionGroup ref="StorefrontCartPageOpenActionGroup" stepKey="navigateAgainToToCheckout1"/>
168+
<conditionalClick selector="{{CheckoutCartSummarySection.estimateShippingAndTax}}" dependentSelector="{{CheckoutCartSummarySection.country}}" visible="false" stepKey="expandEstimateShippingPrice2"/>
169+
<waitForElementNotVisible selector="{{CheckoutCartSummarySection.shippingPrice}}" stepKey="dontSeeShippingPriceForUS"/>
170+
<actionGroup ref="AdminOpenShippingMethodsConfigPageActionGroup" stepKey="openAgainShippingMethodConfigPage"/>
171+
<!-- Enable Table Rate method and save config -->
172+
<actionGroup ref="AdminChangeTableRatesShippingMethodStatusActionGroup" stepKey="enableTableRatesShippingMethod1"/>
173+
<scrollTo selector="{{AdminShippingMethodTableRatesSection.carriersTableRateIncludeVirtualPriceDropdown}}" stepKey="scrollToIncludeVirtualPrice"/>
174+
<selectOption selector="{{AdminShippingMethodTableRatesSection.carriersTableRateIncludeVirtualPriceDropdown}}" userInput="Yes" stepKey="setIncludeVirtualPriceAsNo"/>
175+
<actionGroup ref="AdminSaveConfigActionGroup" stepKey="saveConfig"/>
176+
<actionGroup ref="StorefrontOpenHomePageActionGroup" stepKey="navigateToStorefront"/>
177+
<actionGroup ref="StorefrontClickOnMiniCartActionGroup" stepKey="clickOnMiniCart3"/>
178+
<!--Remove an item from the cart using minicart-->
179+
<actionGroup ref="RemoveProductFromMiniCartActionGroup" stepKey="removeVirtualProductFromMiniCart">
180+
<argument name="productName" value="$$createVirtualProduct.name$$"/>
181+
</actionGroup>
182+
<actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="addSimpleProductToCart">
183+
<argument name="product" value="$$createFirstSimpleProduct$$"/>
184+
</actionGroup>
185+
<!-- Add Virtual product to cart -->
186+
<actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="addVirtualProductToCart">
187+
<argument name="product" value="$$createVirtualProduct$$"/>
188+
</actionGroup>
189+
<!-- Assert that table rate value is correct for US -->
190+
<actionGroup ref="StorefrontCartPageOpenActionGroup" stepKey="goAgainToCheckout2"/>
191+
<conditionalClick selector="{{CheckoutCartSummarySection.estimateShippingAndTax}}" dependentSelector="{{CheckoutCartSummarySection.country}}" visible="false" stepKey="expandEstimateTableRatePrice"/>
192+
<grabTextFrom selector="{{CheckoutCartSummarySection.shippingPrice}}" stepKey="grabTableratePrice4"/>
193+
<assertStringContainsString stepKey="checkCustomerShippingPrice">
194+
<expectedResult type="string">$6.99</expectedResult>
195+
<actualResult type="variable">grabTableratePrice4</actualResult>
196+
</assertStringContainsString>
197+
</test>
198+
</tests>

app/code/Magento/Shipping/Test/Mftf/Section/AdminShippingMethodTableRatesSection.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
33
/**
4-
* Copyright © Magento, Inc. All rights reserved.
5-
* See COPYING.txt for license details.
4+
* Copyright 2024 Adobe
5+
* All Rights Reserved.
66
*/
77
-->
88

@@ -22,5 +22,6 @@
2222
<element name="carriersTableRateSpecificErrMsg" type="input" selector="#carriers_tablerate_specificerrmsg_inherit"/>
2323
<element name="carriersTableRateAllowSpecific" type="input" selector="#carriers_tablerate_sallowspecific_inherit"/>
2424
<element name="carriersTableRateSpecificCountry" type="input" selector="#carriers_tablerate_specificcountry"/>
25+
<element name="carriersTableRateIncludeVirtualPriceDropdown" type="select" selector="#carriers_tablerate_include_virtual_price"/>
2526
</section>
2627
</sections>

0 commit comments

Comments
 (0)