Skip to content

Commit b692bf6

Browse files
committed
MC-38939: Subtotal Cart Price Rule excludes product tax for fixed amount
- Add MFTF test
1 parent cc3db8e commit b692bf6

File tree

2 files changed

+91
-0
lines changed

2 files changed

+91
-0
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd">
1111
<entity name="SalesRuleAddressConditions" type="SalesRuleConditionAttribute">
1212
<data key="subtotal">Magento\SalesRule\Model\Rule\Condition\Address|base_subtotal</data>
13+
<data key="base_subtotal_total_incl_tax">Magento\SalesRule\Model\Rule\Condition\Address|base_subtotal_total_incl_tax</data>
1314
<data key="totalItemsQty">Magento\SalesRule\Model\Rule\Condition\Address|total_qty</data>
1415
<data key="totalWeight">Magento\SalesRule\Model\Rule\Condition\Address|weight</data>
1516
<data key="shippingMethod">Magento\SalesRule\Model\Rule\Condition\Address|shipping_method</data>
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
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+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10+
<test name="AdminCreateCartPriceRuleWithSubtotalInclTaxTest">
11+
<annotations>
12+
<stories value="Create Sales Rule"/>
13+
<title value="Create Cart Price Rule with Subtotal Incl Tax"/>
14+
<description value="Test that cart price rule with Subtotal Incl Tax works correctly"/>
15+
<severity value="CRITICAL"/>
16+
<useCaseId value="MC-38939"/>
17+
<testCaseId value="MC-38983"/>
18+
<group value="SalesRule"/>
19+
</annotations>
20+
<before>
21+
<!--Login to backend-->
22+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
23+
<!--Create tax rate for US-CA-*-->
24+
<createData entity="defaultTaxRate" stepKey="taxRate"/>
25+
<!--Create tax rule-->
26+
<actionGroup ref="AdminCreateTaxRuleActionGroup" stepKey="createTaxRule">
27+
<argument name="taxRate" value="$$taxRate$$"/>
28+
<argument name="taxRule" value="SimpleTaxRule"/>
29+
</actionGroup>
30+
<!--Create simple product-->
31+
<createData entity="SimpleProduct2" stepKey="product">
32+
<field key="price">100</field>
33+
</createData>
34+
<!--Create cart price rule with no coupon and 50% discount-->
35+
<createData entity="ApiCartRule" stepKey="createCartPriceRule"/>
36+
<!--Add "subtotal incl tax > 100" condition to cart price rule-->
37+
<amOnPage url="{{AdminCartPriceRuleEditPage.url($$createCartPriceRule.rule_id$$)}}" stepKey="openEditRule"/>
38+
<actionGroup ref="SetCartAttributeConditionForCartPriceRuleActionGroup" stepKey="setCartAttributeConditionForCartPriceRule">
39+
<argument name="attributeName" value="{{SalesRuleAddressConditions.base_subtotal_total_incl_tax}}"/>
40+
<argument name="operatorType" value="greater than"/>
41+
<argument name="value" value="100"/>
42+
</actionGroup>
43+
</before>
44+
<after>
45+
<!--Delete tax rule-->
46+
<actionGroup ref="AdminDeleteTaxRule" stepKey="deleteTaxRule">
47+
<argument name="taxRuleCode" value="{{SimpleTaxRule.code}}" />
48+
</actionGroup>
49+
<!--Delete tax rate-->
50+
<deleteData createDataKey="taxRate" stepKey="deleteTaxRate"/>
51+
<!--Delete product-->
52+
<deleteData createDataKey="product" stepKey="deleteProduct"/>
53+
<!--Delete cart price rule-->
54+
<deleteData createDataKey="createCartPriceRule" stepKey="deleteCartPriceRule"/>
55+
<actionGroup ref="logout" stepKey="logout"/>
56+
</after>
57+
58+
<!--Open product -->
59+
<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openProduct2Page">
60+
<argument name="productUrl" value="$product.custom_attributes[url_key]$"/>
61+
</actionGroup>
62+
<!--Add to cart -->
63+
<actionGroup ref="StorefrontAddToTheCartActionGroup" stepKey="product2AddToCart"/>
64+
<!--Click on mini cart-->
65+
<actionGroup ref="StorefrontClickOnMiniCartActionGroup" stepKey="clickOnMiniCart"/>
66+
<!--Click on view and edit cart link-->
67+
<actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="goToShoppingCartFromMinicart"/>
68+
<waitForPageLoad stepKey="waitForViewAndEditCartToOpen"/>
69+
<!--Assert that tax and discount are not applied by default-->
70+
<actionGroup ref="StorefrontCheckCartActionGroup" stepKey="AssertTaxAndDiscountIsNotApplied">
71+
<argument name="subtotal" value="$100.00"/>
72+
<argument name="shipping" value="$5.00"/>
73+
<argument name="shippingMethod" value="Flat Rate - Fixed"/>
74+
<argument name="total" value="$105.00"/>
75+
</actionGroup>
76+
<dontSee selector="{{CheckoutCartSummarySection.discountAmount}}" stepKey="assertDiscountIsNotApplied"/>
77+
<!--Open "Estimate Shipping and Tax" section and fill US-CA address -->
78+
<actionGroup ref="StorefrontCartEstimateShippingAndTaxActionGroup" stepKey="fillEstimateShippingAndTaxSection">
79+
<argument name="estimateAddress" value="EstimateAddressCalifornia"/>
80+
</actionGroup>
81+
<!--Assert that tax and discount are applied by to total amount-->
82+
<actionGroup ref="StorefrontCheckCartActionGroup" stepKey="AssertTaxAndDiscountIsApplied">
83+
<argument name="subtotal" value="$100.00"/>
84+
<argument name="shipping" value="$5.00"/>
85+
<argument name="shippingMethod" value="Flat Rate - Fixed"/>
86+
<argument name="total" value="$60.00"/>
87+
</actionGroup>
88+
<see selector="{{CheckoutCartSummarySection.discountAmount}}" userInput="-$50.00" stepKey="assertDiscountIsApplied"/>
89+
</test>
90+
</tests>

0 commit comments

Comments
 (0)