|
| 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