Skip to content

Commit 7855197

Browse files
committed
ACP2E-2763: Table Rates Still Showing Even Though Free Shipping Is Applied
1 parent ac57e18 commit 7855197

File tree

3 files changed

+156
-0
lines changed

3 files changed

+156
-0
lines changed

app/code/Magento/SalesRule/Test/Mftf/Data/SalesRuleData.xml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,25 @@
379379
<data key="defaultRuleLabelAllStoreViews">Free Shipping in conditions</data>
380380
<data key="defaultStoreView">Free Shipping in conditions</data>
381381
</entity>
382+
<entity name="CartPriceRuleFreeShippingWithCouponAppliedOnly">
383+
<data key="name" unique="suffix">Cart Price Rule For Tree Shipping With Coupon</data>
384+
<data key="description">Description for Cart Price Rule</data>
385+
<data key="is_active">Yes</data>
386+
<data key="websites">Main Website</data>
387+
<data key="customerGroups">NOT LOGGED IN</data>
388+
<data key="coupon_type">Specific Coupon</data>
389+
<data key="coupon_code" unique="suffix">FreeShipping</data>
390+
<data key="simple_action">Fixed amount discount</data>
391+
<data key="discount_amount">50</data>
392+
<data key="maximumQtyDiscount">0</data>
393+
<data key="discount_step">0</data>
394+
<data key="apply_to_shipping">0</data>
395+
<data key="simple_free_shipping">For shipment with matching items</data>
396+
<data key="stop_rules_processing">false</data>
397+
<data key="apply">Percent of product price discount</data>
398+
<data key="defaultRuleLabelAllStoreViews">Free Shipping Rule</data>
399+
<data key="defaultStoreView">Free Shipping Rule</data>
400+
</entity>
382401
<entity name="CartPriceRuleConditionWithCouponAppliedForSubtotalExclTax">
383402
<data key="name" unique="suffix">Cart Price Rule For Rule Condition</data>
384403
<data key="description">Description for Cart Price Rule</data>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/************************************************************************
4+
*
5+
* Copyright 2024 Adobe
6+
* All Rights Reserved.
7+
*
8+
* NOTICE: All information contained herein is, and remains
9+
* the property of Adobe and its suppliers, if any. The intellectual
10+
* and technical concepts contained herein are proprietary to Adobe
11+
* and its suppliers and are protected by all applicable intellectual
12+
* property laws, including trade secret and copyright laws.
13+
* Dissemination of this information or reproduction of this material
14+
* is strictly forbidden unless prior written permission is obtained
15+
* from Adobe.
16+
* ************************************************************************
17+
*/
18+
-->
19+
20+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
21+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
22+
<test name="StorefrontAssertShippingPricesPresentWithFreeShippingAfterApplyingCartRuleTest">
23+
<annotations>
24+
<features value="Shipping"/>
25+
<stories value="Cart price rules"/>
26+
<title value="Assert that table rate shipping price will be correct after cart price rule for free shipping applied"/>
27+
<description value="Table rate price should be displayed correctly on checkout after applied free shipment cart price rule"/>
28+
<severity value="AVERAGE"/>
29+
<testCaseId value="ACP2E-2763"/>
30+
<useCaseId value="ACP2E-2763"/>
31+
<group value="shipping"/>
32+
<group value="SalesRule"/>
33+
<group value="cloud"/>
34+
</annotations>
35+
<before>
36+
<createData entity="ApiSimpleProductWithCustomPrice" stepKey="createProduct"/>
37+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
38+
<!-- Enable free shipping method -->
39+
<createData entity="FreeShippinMethodConfig" stepKey="enableFreeShippingMethod"/>
40+
<createData entity="setFreeShippingSubtotal" stepKey="setFreeShippingSubtotal"/>
41+
42+
<!-- Turn on and configure table rates shipping method -->
43+
<actionGroup ref="AdminOpenShippingMethodsConfigPageActionGroup" stepKey="openShippingMethodConfigPage"/>
44+
<actionGroup ref="AdminSwitchWebsiteActionGroup" stepKey="switchDefaultWebsite">
45+
<argument name="website" value="_defaultWebsite"/>
46+
</actionGroup>
47+
<actionGroup ref="AdminChangeTableRatesShippingMethodStatusActionGroup" stepKey="enableTableRatesShippingMethodForDefaultWebsite">
48+
<argument name="status" value="1"/>
49+
</actionGroup>
50+
<actionGroup ref="AdminImportFileTableRatesShippingMethodActionGroup" stepKey="importCSVFile">
51+
<argument name="file" value="price_tablerates.csv"/>
52+
</actionGroup>
53+
<actionGroup ref="AdminSaveConfigActionGroup" stepKey="saveConfig"/>
54+
55+
<!-- Create cart price rule for free shipping -->
56+
<actionGroup ref="AdminCartPriceRuleDeleteAllActionGroup" stepKey="deleteAllExistingCartPriceRules"/>
57+
58+
<actionGroup ref="AdminOpenNewCartPriceRuleFormPageActionGroup" stepKey="createCartPriceRule"/>
59+
<actionGroup ref="AdminCartPriceRuleFillMainInfoActionGroup" stepKey="fillCartPriceRuleMainInfo">
60+
<argument name="name" value="{{CartPriceRuleFreeShippingWithCouponAppliedOnly.name}}"/>
61+
<argument name="description" value="{{CartPriceRuleFreeShippingWithCouponAppliedOnly.description}}"/>
62+
</actionGroup>
63+
<actionGroup ref="AdminCartPriceRuleFillCouponInfoActionGroup" stepKey="fillCartPriceRuleCouponInfo"/>
64+
<actionGroup ref="AdminCreateCartPriceRuleActionsSectionDiscountFieldsActionGroup" stepKey="fillCartPriceRuleActionsSection">
65+
<argument name="rule" value="CartPriceRuleFreeShippingWithCouponAppliedOnly"/>
66+
</actionGroup>
67+
<actionGroup ref="AdminCreateCartPriceRuleActionsSectionFreeShippingActionGroup" stepKey="fillCartPriceRuleFreeShippingActionsSection">
68+
<argument name="freeShippingOption" value="{{CartPriceRuleFreeShippingWithCouponAppliedOnly.simple_free_shipping}}"/>
69+
</actionGroup>
70+
<actionGroup ref="AdminCartPriceRuleSaveActionGroup" stepKey="saveCartPriceRule"/>
71+
</before>
72+
<after>
73+
74+
<!-- Delete product -->
75+
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
76+
77+
<!-- Delete cart price rule for free shipping -->
78+
<actionGroup ref="AdminCartPriceRuleDeleteAllActionGroup" stepKey="deleteAllCartPriceRules"/>
79+
<actionGroup ref="AdminOpenShippingMethodsConfigPageActionGroup" stepKey="openShippingMethodConfigPage2"/>
80+
<actionGroup ref="AdminSwitchWebsiteActionGroup" stepKey="switchDefaultWebsite2">
81+
<argument name="website" value="_defaultWebsite"/>
82+
</actionGroup>
83+
84+
<!-- Turn off table rates shipping method -->
85+
<actionGroup ref="AdminChangeTableRatesShippingMethodStatusActionGroup" stepKey="disableTableRatesShippingMethodForDefaultWebsite">
86+
<argument name="status" value="0"/>
87+
</actionGroup>
88+
<actionGroup ref="AdminSaveConfigActionGroup" stepKey="saveConfig2"/>
89+
90+
<!-- Disable free shipping method -->
91+
<createData entity="FreeShippinMethodDefault" stepKey="disableFreeShippingMethod"/>
92+
<createData entity="setFreeShippingSubtotalToDefault" stepKey="setFreeShippingSubtotalToDefault"/>
93+
94+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
95+
</after>
96+
97+
<!-- Add product to cart and check shipping prices -->
98+
<actionGroup ref="OpenStoreFrontProductPageActionGroup" stepKey="navigateToProductPage">
99+
<argument name="productUrlKey" value="$createProduct.custom_attributes[url_key]$"/>
100+
</actionGroup>
101+
102+
<actionGroup ref="StorefrontAddProductToCartActionGroup" stepKey="addProductToCart">
103+
<argument name="product" value="$createProduct$" />
104+
<argument name="productCount" value="1" />
105+
</actionGroup>
106+
107+
<actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="goToCheckoutFromMinicart"/>
108+
109+
<actionGroup ref="GuestCheckoutFillNewShippingAddressActionGroup" stepKey="guestCheckoutFillingShippingSection">
110+
<argument name="customer" value="CustomerEntityOne" />
111+
<argument name="address" value="CustomerAddressSimple" />
112+
</actionGroup>
113+
<see selector="{{CheckoutShippingMethodsSection.shippingRatePriceByName('Fixed')}}" userInput="$5.00" stepKey="assertFlatRatedMethodPrice"/>
114+
<see selector="{{CheckoutShippingMethodsSection.shippingRatePriceByName('Table Rate')}}" userInput="$0.00" stepKey="assertTableRatedMethodPrice"/>
115+
<dontSee selector="{{CheckoutShippingMethodsSection.shippingRatePriceByName('Free Shipping')}}" userInput="$0.00" stepKey="assertFreeShippingMethodNotAvailable"/>
116+
<waitForElementClickable selector="{{CheckoutShippingMethodsSection.shippingMethodFlatRate}}" stepKey="waitForFlatRateShippingMethod"/>
117+
118+
<!-- Apply cart price rule for free shipping -->
119+
<click selector="{{CheckoutShippingMethodsSection.checkShippingMethodByName('Flat Rate')}}" stepKey="selectFlatRateShippingMethod"/>
120+
<actionGroup ref="StorefrontCheckoutClickNextButtonActionGroup" stepKey="goToPaymentStep"/>
121+
<actionGroup ref="StorefrontApplyDiscountCodeActionGroup" stepKey="applyCoupon">
122+
<argument name="discountCode" value="{{_defaultCoupon.code}}"/>
123+
</actionGroup>
124+
125+
<!-- Check shipping prices after applying cart price rule -->
126+
<actionGroup ref="StorefrontOpenHomePageActionGroup" stepKey="amOnHomePageAfterCartRuleApplied"/>
127+
<actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="goToCheckoutFromMinicart2"/>
128+
<see selector="{{CheckoutShippingMethodsSection.shippingRatePriceByName('Fixed')}}" userInput="$5.00" stepKey="assertFlatRatedMethodPriceAfterCartRule"/>
129+
<see selector="{{CheckoutShippingMethodsSection.shippingRatePriceByName('Table Rate')}}" userInput="$15.95" stepKey="assertTableRatedMethodPriceAfterCartRule"/>
130+
<see selector="{{CheckoutShippingMethodsSection.shippingRatePriceByName('Free Shipping')}}" userInput="$0.00" stepKey="assertFreeShippingMethodAvailable"/>
131+
</test>
132+
</tests>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Country,Region/State,Zip/Postal Code,Order Subtotal (and above),Shipping Price
2+
USA,*,*,0,15.9500
3+
USA,*,*,100.0000,0.0000
4+
USA,AK,*,0.0000,0.0000
5+
USA,HI,*,0.0000,0.0000

0 commit comments

Comments
 (0)