Skip to content

Commit 6b552ec

Browse files
Olga MoyseyenkoOlga Moyseyenko
authored andcommitted
ACP2E-377: Create MFTF Test Coverage For ACP2E-350
1 parent 302f6c5 commit 6b552ec

File tree

2 files changed

+115
-0
lines changed

2 files changed

+115
-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: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
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="FPT correct Total amount in Order Summary section for multiple product amount"/>
16+
<description value="Tax information is calculated properly 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 Price = 100 -->
41+
<createData entity="SimpleProduct2" stepKey="createSimpleProduct">
42+
<field key="price">100.00</field>
43+
</createData>
44+
45+
<!-- FPT for Germany is set to 2 -->
46+
<actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="openProductEditPage">
47+
<argument name="productId" value="$createSimpleProduct.id$"/>
48+
</actionGroup>
49+
<actionGroup ref="AdminProductAddFPTValueActionGroup" stepKey="addFPTValue">
50+
<argument name="FPTAttributeCode" value="$createProductFPTAttribute.attribute_code$"/>
51+
<argument name="countryForFPT" value="Germany"/>
52+
<argument name="stateForFPT" value="*"/>
53+
<argument name="valueForFPT" value="2"/>
54+
</actionGroup>
55+
<actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/>
56+
</before>
57+
58+
<after>
59+
<!-- Delete FPT attribute -->
60+
<deleteData createDataKey="createProductFPTAttribute" stepKey="deleteProductFPTAttribute"/>
61+
<!-- Return Tax configuration including FPT to default status -->
62+
<createData entity="DefaultTaxConfig" stepKey="defaultTaxConfiguration"/>
63+
<createData entity="WeeeConfigDisable" stepKey="useSystemValueFTP"/>
64+
<!-- Delete product and clear products filter-->
65+
<deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/>
66+
<actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="navigateToProductIndex"/>
67+
<actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearProductsGridFilters"/>
68+
<!-- Logout Admin -->
69+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/>
70+
</after>
71+
72+
<!-- Test Steps -->
73+
74+
<!-- Add simple product with qty 100 to shopping cart -->
75+
<amOnPage url="{{StorefrontProductPage.url($createSimpleProduct.custom_attributes[url_key]$)}}" stepKey="amOnSimpleProductPage"/>
76+
<waitForPageLoad stepKey="waitForPageLoad"/>
77+
<actionGroup ref="AddProductWithQtyToCartFromStorefrontProductPageActionGroup" stepKey="cartAddSimpleProductToCart">
78+
<argument name="productName" value="$createSimpleProduct.name$"/>
79+
<argument name="productQty" value="100"/>
80+
</actionGroup>
81+
82+
<!-- Open Checkout page -->
83+
<actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="goToCheckoutFromMinicart"/>
84+
85+
<!-- Fill shipping information for guest with Germany address -->
86+
<actionGroup ref="FillGuestCheckoutShippingAddressWithCountryAndStateActionGroup" stepKey="guestCheckoutFillingShippingSection">
87+
<argument name="customer" value="CustomerEntityOne"/>
88+
<argument name="customerAddress" value="DE_Address_Berlin_Not_Default_Address"/>
89+
</actionGroup>
90+
91+
<!-- Select shipping and payment methods -->
92+
<actionGroup ref="CheckoutSelectFlatRateShippingMethodActionGroup" stepKey="selectFlatRateShippingMethod"/>
93+
<waitForElementVisible selector="{{CheckoutShippingSection.next}}" stepKey="waitNextButtonAppears"/>
94+
<click selector="{{CheckoutShippingSection.next}}" stepKey="clickNext"/>
95+
<actionGroup ref="CheckoutSelectCheckMoneyOrderPaymentActionGroup" stepKey="clickCheckMoneyOrderPayment"/>
96+
97+
<!-- Open summary section for product -->
98+
<conditionalClick selector="{{CheckoutPaymentSection.cartItemsArea}}" dependentSelector="{{CheckoutPaymentSection.cartItemsAreaActive}}" visible="false" stepKey="clickItemInCart"/>
99+
<grabTextFrom selector="{{StorefrontCheckoutCartItemWeeeSection.productWeeeSubtotalIncludingTax}}" stepKey="grabProductSubtotalWithFPT"/>
100+
<grabTextFrom selector="{{CheckoutPaymentSection.orderSummarySubtotal}}" stepKey="grabCartSubtotal"/>
101+
102+
<!-- Check that product total is correct -->
103+
<assertStringContainsString stepKey="assertCartTaxTotalContainsCorrectFPT">
104+
<actualResult type="const">$grabProductSubtotalWithFPT</actualResult>
105+
<expectedResult type="const">"$10,200.00"</expectedResult>
106+
</assertStringContainsString>
107+
108+
<!-- Check that product total is equal to cart subtotal (as we have only one product in the cart) -->
109+
<assertStringContainsString stepKey="assertCartTaxTotalEqualToSubtotal">
110+
<actualResult type="const">$grabProductSubtotalWithFPT</actualResult>
111+
<expectedResult type="const">$grabCartSubtotal</expectedResult>
112+
</assertStringContainsString>
113+
</test>
114+
</tests>

0 commit comments

Comments
 (0)