Skip to content

Commit 36e4afa

Browse files
committed
Merge branch 'ACP2E-377' of https://github.com/magento-l3/magento2ce into L3-PR-20220202
2 parents c8d8302 + a943874 commit 36e4afa

File tree

2 files changed

+113
-0
lines changed

2 files changed

+113
-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
@@ -13,5 +13,6 @@
1313
<element name="productWeeeSubtotalByName" type="text" selector="//a[contains(text(),'{{productName}}')]/ancestor::tr//td[contains(@class, 'subtotal')]//span[contains(@class,'weee')]" parameterized="true"/>
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"/>
16+
<element name="productWeeeSubtotalIncludingTax" type="text" selector="//span[@class='cart-tax-total']/span[@class='weee']/span[@class='price']"/>
1617
</section>
1718
</sections>
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
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="StorefrontFPTProductSubtotalOrderTest">
12+
<annotations>
13+
<features value="Tax"/>
14+
<stories value="Order taxes"/>
15+
<title value="Correct subtotal including FPT in product information section of order summary"/>
16+
<description value="Tax information is calculated properly in product information section when order contains multiple amount of the product"/>
17+
<severity value="CRITICAL"/>
18+
<useCaseId value="ACP2E-350"/>
19+
<testCaseId value="AC-2110"/>
20+
<group value="checkout"/>
21+
<group value="tax"/>
22+
<group value="weee"/>
23+
</annotations>
24+
25+
<before>
26+
<!-- Preconditions -->
27+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
28+
<!-- Store -> Configuration -> Sales -> Tax FPT Enable -->
29+
<createData entity="WeeeConfigEnable" stepKey="enableFPT"/>
30+
<!-- Setting up FPT display settings as needed for test -->
31+
<magentoCLI command="config:set tax/weee/display_sales 2" stepKey="displayPricesInSalesExcludingIncluding"/>
32+
<magentoCLI command="config:set tax/weee/include_in_subtotal 1" stepKey="enableIncludeInSubtotal"/>
33+
34+
<!-- 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+
40+
<!-- Simple product is created with Price = 100 and FPT = 2 for Germany -->
41+
<createData entity="SimpleProduct2" stepKey="createSimpleProduct">
42+
<field key="price">100.00</field>
43+
</createData>
44+
<actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="openProductEditPage">
45+
<argument name="productId" value="$createSimpleProduct.id$"/>
46+
</actionGroup>
47+
<actionGroup ref="AdminProductAddFPTValueActionGroup" stepKey="addFPTValue">
48+
<argument name="FPTAttributeCode" value="$createProductFPTAttribute.attribute_code$"/>
49+
<argument name="countryForFPT" value="Germany"/>
50+
<argument name="stateForFPT" value="*"/>
51+
<argument name="valueForFPT" value="2"/>
52+
</actionGroup>
53+
<actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/>
54+
</before>
55+
56+
<after>
57+
<!-- Delete FPT attribute -->
58+
<deleteData createDataKey="createProductFPTAttribute" stepKey="deleteProductFPTAttribute"/>
59+
<!-- Return Tax configuration including FPT to default status -->
60+
<createData entity="DefaultTaxConfig" stepKey="defaultTaxConfiguration"/>
61+
<createData entity="WeeeConfigDisable" stepKey="useSystemValueFTP"/>
62+
<!-- Delete product and clear products filter -->
63+
<deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/>
64+
<actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="navigateToProductIndex"/>
65+
<actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearProductsGridFilters"/>
66+
<!-- Logout Admin -->
67+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/>
68+
</after>
69+
70+
<!-- Test Steps -->
71+
72+
<!-- Add simple product with qty 100 to shopping cart -->
73+
<actionGroup ref="StorefrontOpenProductEntityPageActionGroup" stepKey="openProductPage">
74+
<argument name="product" value="$$createSimpleProduct$$"/>
75+
</actionGroup>
76+
<actionGroup ref="AddProductWithQtyToCartFromStorefrontProductPageActionGroup" stepKey="cartAddSimpleProductToCart">
77+
<argument name="productName" value="$createSimpleProduct.name$"/>
78+
<argument name="productQty" value="100"/>
79+
</actionGroup>
80+
81+
<!-- Open Checkout page -->
82+
<actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="goToCheckoutFromMinicart"/>
83+
84+
<!-- Fill shipping information for guest with Germany address -->
85+
<actionGroup ref="FillGuestCheckoutShippingAddressWithCountryAndStateActionGroup" stepKey="guestCheckoutFillingShippingSection">
86+
<argument name="customer" value="CustomerEntityOne"/>
87+
<argument name="customerAddress" value="DE_Address_Berlin_Not_Default_Address"/>
88+
</actionGroup>
89+
90+
<!-- Select shipping and payment methods -->
91+
<actionGroup ref="CheckoutSelectFlatRateShippingMethodActionGroup" stepKey="selectFlatRateShippingMethod"/>
92+
<actionGroup ref="StorefrontCheckoutForwardFromShippingStepActionGroup" stepKey="clickNext"/>
93+
<actionGroup ref="CheckoutSelectCheckMoneyOrderPaymentActionGroup" stepKey="clickCheckMoneyOrderPayment"/>
94+
95+
<!-- Open summary section for product -->
96+
<conditionalClick selector="{{CheckoutPaymentSection.cartItemsArea}}" dependentSelector="{{CheckoutPaymentSection.cartItemsAreaActive}}" visible="false" stepKey="clickItemInCart"/>
97+
<grabTextFrom selector="{{StorefrontCheckoutCartItemWeeeSection.productWeeeSubtotalIncludingTax}}" stepKey="grabProductSubtotalWithFPT"/>
98+
<grabTextFrom selector="{{CheckoutPaymentSection.orderSummarySubtotal}}" stepKey="grabCartSubtotal"/>
99+
100+
<!-- Check that product total is correct -->
101+
<assertStringContainsString stepKey="assertCartTaxTotalContainsCorrectFPT">
102+
<actualResult type="const">$grabProductSubtotalWithFPT</actualResult>
103+
<expectedResult type="const">"$10,200.00"</expectedResult>
104+
</assertStringContainsString>
105+
106+
<!-- Check that product total is equal to cart subtotal (as we have only one product in the cart) -->
107+
<assertStringContainsString stepKey="assertCartTaxTotalEqualToSubtotal">
108+
<actualResult type="const">$grabProductSubtotalWithFPT</actualResult>
109+
<expectedResult type="const">$grabCartSubtotal</expectedResult>
110+
</assertStringContainsString>
111+
</test>
112+
</tests>

0 commit comments

Comments
 (0)