Skip to content

Commit 57d0e97

Browse files
Chhandak.BaruaChhandak.Barua
authored andcommitted
ACP2E-1076: Discount (Cart price rules) ignore Weee tax amount included in subtotal cart
1 parent 9e0dc85 commit 57d0e97

File tree

2 files changed

+111
-0
lines changed

2 files changed

+111
-0
lines changed

app/code/Magento/Weee/Test/Mftf/Section/StorefrontCheckoutCartItemWeeeSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@
1414
<element name="productWeeePriceExcludingTaxByName" type="text" selector="//a[contains(text(),'{{productName}}')]/ancestor::tr//td[contains(@class, 'price')]//span[contains(@class,'price-excluding-tax')]//span[contains(@class,'weee')]" parameterized="true"/>
1515
<element name="productWeeeSubtotalExcludingTaxByName" type="text" selector="//a[contains(text(),'{{productName}}')]/ancestor::tr//td[contains(@class, 'subtotal')]//span[contains(@class,'price-excluding-tax')]//span[contains(@class,'weee')]" parameterized="true"/>
1616
<element name="productWeeeSubtotalIncludingTax" type="text" selector="//span[@class='cart-tax-total']/span[@class='weee']/span[@class='price']"/>
17+
<element name="subtotalIncludingTaxPrice" type="text" selector=".//div[@class='cart-totals']//tr[@class='totals sub incl']//td[@class='amount']/span"/>
1718
</section>
1819
</sections>
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
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="StorefrontFPTTaxDiscountInShoppingCartTest">
12+
<annotations>
13+
<features value="Tax"/>
14+
<stories value="Discount (Cart price rules) ignore Weee tax amount included in subtotal cart"/>
15+
<title value="Discount (Cart price rules) ignore Weee tax amount included in subtotal cart"/>
16+
<description value="Discount (Cart price rules) ignore Weee tax amount included in subtotal including tax cart"/>
17+
<severity value="CRITICAL"/>
18+
<useCaseId value="ACP2E-1076"/>
19+
<testCaseId value="AC-6663"/>
20+
<group value="checkout"/>
21+
<group value="tax"/>
22+
<group value="weee"/>
23+
<group value="cloud_smoke"/>
24+
</annotations>
25+
26+
<before>
27+
<!-- Step 1: Simple product is created -->
28+
<createData entity="_defaultProduct" stepKey="createSimpleProduct"/>
29+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
30+
<!-- Step 2: Store>Configuration; Sales>Tax FPT Enable -->
31+
<createData entity="WeeeConfigEnable" stepKey="enableFPT"/>
32+
<magentoCLI command="config:set tax/cart_display/price 3" stepKey="setPrice"/>
33+
<magentoCLI command="config:set tax/cart_display/subtotal 3" stepKey="setSubtotal"/>
34+
<!-- Step 3: Fixed Product Tax attribute is created and added to default attribute set -->
35+
<createData entity="FPTProductAttribute" stepKey="createProductFPTAttribute"/>
36+
<createData entity="AddToDefaultSet" stepKey="addFPTToAttributeSet">
37+
<requiredEntity createDataKey="createProductFPTAttribute"/>
38+
</createData>
39+
<actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="openProductEditPage">
40+
<argument name="productId" value="$$createSimpleProduct.id$$"/>
41+
</actionGroup>
42+
<!-- Step 4: FPT United States/California/100 -->
43+
<actionGroup ref="AdminProductAddFPTValueActionGroup" stepKey="addFPTValue1">
44+
<argument name="FPTAttributeCode" value="$createProductFPTAttribute.attribute_code$"/>
45+
<argument name="stateForFPT" value="California"/>
46+
<argument name="valueForFPT" value="100"/>
47+
</actionGroup>
48+
<actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/>
49+
<magentoCron groups="index" stepKey="reindexBrokenIndices"/>
50+
</before>
51+
52+
<after>
53+
<magentoCLI command="config:set tax/cart_display/price 1" stepKey="setPrice"/>
54+
<magentoCLI command="config:set tax/cart_display/subtotal 1" stepKey="setSubtotal"/>
55+
<deleteData createDataKey="createProductFPTAttribute" stepKey="deleteProductFPTAttribute"/>
56+
<createData entity="WeeeConfigDisable" stepKey="disableFPT"/>
57+
<deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/>
58+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/>
59+
<magentoCron groups="index" stepKey="reindexBrokenIndices"/>
60+
</after>
61+
62+
<!-- Step 5: Create a cart price rule for $10 Fixed amount discount -->
63+
<actionGroup ref="AdminOpenCartPriceRulesPageActionGroup" stepKey="amOnCartPriceList"/>
64+
<click selector="{{AdminCartPriceRulesSection.addNewRuleButton}}" stepKey="clickAddNewRule"/>
65+
<fillField selector="{{AdminCartPriceRulesFormSection.ruleName}}" userInput="{{_defaultCoupon.code}}" stepKey="fillRuleName"/>
66+
<selectOption selector="{{AdminCartPriceRulesFormSection.websites}}" userInput="Main Website" stepKey="selectWebsites"/>
67+
<selectOption selector="{{AdminCartPriceRulesFormSection.customerGroups}}" userInput="NOT LOGGED IN" stepKey="selectCustomerGroup"/>
68+
<generateDate date="-1 day" format="m/d/Y" stepKey="yesterdayDate"/>
69+
<fillField selector="{{AdminCartPriceRulesFormSection.fromDate}}" userInput="{$yesterdayDate}" stepKey="fillFromDate"/>
70+
<click selector="{{PriceRuleConditionsSection.conditionsTab}}" stepKey="expandConditions"/>
71+
<!-- Scroll down to fix some flaky behavior... -->
72+
<scrollTo selector="{{PriceRuleConditionsSection.conditionsTab}}" stepKey="scrollToConditionsTab"/>
73+
<click selector="{{PriceRuleConditionsSection.createNewRule}}" stepKey="clickNewRule"/>
74+
<selectOption selector="{{PriceRuleConditionsSection.rulesDropdown}}" userInput="Subtotal (Incl. Tax)" stepKey="selectProductAttributes"/>
75+
<waitForPageLoad stepKey="waitForConditions"/>
76+
<click selector="{{PriceRuleConditionsSection.ruleParamLink('1', '1', '1')}}" stepKey="startEditOperator"/>
77+
<selectOption selector="{{PriceRuleConditionsSection.operatorByIndex('1', '1')}}" userInput="equals or less than" stepKey="fillOperator"/>
78+
<click selector="{{PriceRuleConditionsSection.ruleParamLink('1', '1', '2')}}" stepKey="startEditValue"/>
79+
<fillField selector="{{PriceRuleConditionsSection.valueByIndex('1', '1')}}" userInput="2000" stepKey="fillValue"/>
80+
<click selector="{{AdminCartPriceRulesFormSection.actionsHeader}}" stepKey="clickToExpandActions"/>
81+
<selectOption selector="{{AdminCartPriceRulesFormSection.apply}}" userInput="Fixed amount discount" stepKey="selectActionType"/>
82+
<fillField selector="{{AdminCartPriceRulesFormSection.discountAmount}}" userInput="10" stepKey="fillDiscountAmount"/>
83+
<click selector="{{AdminCartPriceRulesFormSection.save}}" stepKey="clickSaveButton"/>
84+
<see selector="{{AdminCartPriceRulesSection.messages}}" userInput="You saved the rule." stepKey="seeSuccessMessage"/>
85+
<!-- Step 6: Add the product to the cart -->
86+
<amOnPage url="{{StorefrontProductPage.url($createSimpleProduct.custom_attributes[url_key]$)}}" stepKey="amOnSimpleProductPage1"/>
87+
<waitForPageLoad stepKey="waitForProductPageLoad"/>
88+
<fillField selector="{{StorefrontProductActionSection.quantity}}" userInput="8" stepKey="fillQuantity"/>
89+
<actionGroup ref="StorefrontClickAddToCartOnProductPageActionGroup" stepKey="addToCartFromStorefrontProductPage"/>
90+
<!-- Step 7: Go to Shopping Cart -->
91+
<actionGroup ref="ClickViewAndEditCartFromMiniCartActionGroup" stepKey="goToShoppingCartFromMinicart1"/>
92+
<!-- Step 8: Open Estimate Shipping and Tax section -->
93+
<actionGroup ref="StorefrontCheckoutCartFillEstimateShippingAndTaxActionGroup" stepKey="setEstimateShippingAndTaxInitialAddressToUnitedStates">
94+
<argument name="country" value="United States"/>
95+
<argument name="state" value="California"/>
96+
<argument name="postcode" value="*"/>
97+
</actionGroup>
98+
<!-- Step 9: Add the same product to the cart again ($2230.00 subtotal incl tax) -->
99+
<amOnPage url="{{StorefrontProductPage.url($createSimpleProduct.custom_attributes[url_key]$)}}" stepKey="amOnSimpleProductPage"/>
100+
<waitForPageLoad stepKey="waitForProductPageLoad2"/>
101+
<fillField selector="{{StorefrontProductActionSection.quantity}}" userInput="2" stepKey="fillQuantity2"/>
102+
<actionGroup ref="StorefrontClickAddToCartOnProductPageActionGroup" stepKey="addToCartFromStorefrontProductPage2"/>
103+
<!-- Step 10: Go to Shopping Cart -->
104+
<actionGroup ref="ClickViewAndEditCartFromMiniCartActionGroup" stepKey="goToShoppingCartFromMinicart"/>
105+
<!-- Step 11: Should not see the discount because we have exceeded $2000 -->
106+
<actionGroup ref="StorefrontCartPageOpenActionGroup" stepKey="goToCartPage"/>
107+
<see selector="{{StorefrontCheckoutCartItemWeeeSection.subtotalIncludingTaxPrice}}" userInput="$2,230.00" stepKey="seeNewPriceSide"/>
108+
<dontSeeElement selector="{{CheckoutCartSummarySection.discountAmount}}" stepKey="dontSeeDiscount"/>
109+
</test>
110+
</tests>

0 commit comments

Comments
 (0)