|
| 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 | + <stories value="Discount (Cart price rules) ignore Weee tax amount included in subtotal cart"/> |
| 14 | + <title value="Discount (Cart price rules) ignore Weee tax amount included in subtotal cart"/> |
| 15 | + <description value="Discount (Cart price rules) ignore Weee tax amount included in subtotal including tax cart"/> |
| 16 | + <severity value="CRITICAL"/> |
| 17 | + <useCaseId value="ACP2E-1076"/> |
| 18 | + <testCaseId value="AC-6663"/> |
| 19 | + <group value="SalesRule"/> |
| 20 | + </annotations> |
| 21 | + |
| 22 | + <before> |
| 23 | + <!-- Step 1: Simple product is created --> |
| 24 | + <createData entity="_defaultProduct" stepKey="createSimpleProduct"/> |
| 25 | + <!-- Step 2: Create a cart price rule for $10 Fixed amount discount --> |
| 26 | + <createData entity="ActiveSalesRuleCoupon50" stepKey="createCartPriceRule"/> |
| 27 | + <createData entity="SimpleSalesRuleCoupon" stepKey="createCouponForCartPriceRule"> |
| 28 | + <requiredEntity createDataKey="createCartPriceRule"/> |
| 29 | + </createData> |
| 30 | + <actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/> |
| 31 | + <!-- Step 3: Store>Configuration; Sales>Tax FPT Enable --> |
| 32 | + <createData entity="WeeeConfigEnable" stepKey="enableFPT"/> |
| 33 | + <!-- update display price and display subtotal with 'Including and Excluding Tax' --> |
| 34 | + <magentoCLI command="config:set tax/cart_display/price 3" stepKey="setPrice"/> |
| 35 | + <magentoCLI command="config:set tax/cart_display/subtotal 3" stepKey="setSubtotal"/> |
| 36 | + <!-- Step 4: Fixed Product Tax attribute is created and added to default attribute set --> |
| 37 | + <createData entity="FPTProductAttribute" stepKey="createProductFPTAttribute"/> |
| 38 | + <createData entity="AddToDefaultSet" stepKey="addFPTToAttributeSet"> |
| 39 | + <requiredEntity createDataKey="createProductFPTAttribute"/> |
| 40 | + </createData> |
| 41 | + <actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="openProductEditPage"> |
| 42 | + <argument name="productId" value="$$createSimpleProduct.id$$"/> |
| 43 | + </actionGroup> |
| 44 | + <!-- Step 5: FPT United States/California/100 --> |
| 45 | + <actionGroup ref="AdminProductAddFPTValueActionGroup" stepKey="addFPTValue1"> |
| 46 | + <argument name="FPTAttributeCode" value="$createProductFPTAttribute.attribute_code$"/> |
| 47 | + <argument name="stateForFPT" value="California"/> |
| 48 | + <argument name="valueForFPT" value="100"/> |
| 49 | + </actionGroup> |
| 50 | + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/> |
| 51 | + <magentoCron groups="index" stepKey="reindexBrokenIndices"/> |
| 52 | + </before> |
| 53 | + |
| 54 | + <after> |
| 55 | + <magentoCLI command="config:set tax/cart_display/price 1" stepKey="setPrice"/> |
| 56 | + <magentoCLI command="config:set tax/cart_display/subtotal 1" stepKey="setSubtotal"/> |
| 57 | + <deleteData createDataKey="createCartPriceRule" stepKey="deleteSalesRule"/> |
| 58 | + <deleteData createDataKey="createProductFPTAttribute" stepKey="deleteProductFPTAttribute"/> |
| 59 | + <createData entity="WeeeConfigDisable" stepKey="disableFPT"/> |
| 60 | + <deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/> |
| 61 | + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/> |
| 62 | + <magentoCron groups="index" stepKey="reindexBrokenIndices"/> |
| 63 | + </after> |
| 64 | + |
| 65 | + <!-- Search and update cart price rule page --> |
| 66 | + <actionGroup ref="AdminOpenCartPriceRulesPageActionGroup" stepKey="goToCartPriceRulePage"/> |
| 67 | + <actionGroup ref="AdminFilterCartPriceRuleActionGroup" stepKey="filterCartPriceRule"> |
| 68 | + <argument name="ruleName" value="$$createCartPriceRule.name$$"/> |
| 69 | + </actionGroup> |
| 70 | + <click selector="{{PriceRuleConditionsSection.conditionsTab}}" stepKey="expandConditions"/> |
| 71 | + <!-- Scroll down --> |
| 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.save}}" stepKey="clickSaveButton"/> |
| 81 | + <see selector="{{AdminCartPriceRulesSection.messages}}" userInput="You saved the rule." stepKey="seeSuccessMessage"/> |
| 82 | + <!-- Step 6: Add the product to the cart --> |
| 83 | + <amOnPage url="{{StorefrontProductPage.url($createSimpleProduct.custom_attributes[url_key]$)}}" stepKey="amOnSimpleProductPage1"/> |
| 84 | + <waitForPageLoad stepKey="waitForProductPageLoad"/> |
| 85 | + <fillField selector="{{StorefrontProductActionSection.quantity}}" userInput="8" stepKey="fillQuantity"/> |
| 86 | + <actionGroup ref="StorefrontClickAddToCartOnProductPageActionGroup" stepKey="addToCartFromStorefrontProductPage"/> |
| 87 | + <!-- Step 7: Go to Shopping Cart --> |
| 88 | + <actionGroup ref="ClickViewAndEditCartFromMiniCartActionGroup" stepKey="goToShoppingCartFromMinicart1"/> |
| 89 | + <!-- Step 8: Open Estimate Shipping and Tax section --> |
| 90 | + <actionGroup ref="StorefrontCheckoutCartFillEstimateShippingAndTaxActionGroup" stepKey="setEstimateShippingAndTaxInitialAddressToUnitedStates"> |
| 91 | + <argument name="country" value="United States"/> |
| 92 | + <argument name="state" value="California"/> |
| 93 | + <argument name="postcode" value="*"/> |
| 94 | + </actionGroup> |
| 95 | + <!-- Step 9: Add the same product to the cart again ($2230.00 subtotal incl tax) --> |
| 96 | + <amOnPage url="{{StorefrontProductPage.url($createSimpleProduct.custom_attributes[url_key]$)}}" stepKey="amOnSimpleProductPage"/> |
| 97 | + <waitForPageLoad stepKey="waitForProductPageLoad2"/> |
| 98 | + <fillField selector="{{StorefrontProductActionSection.quantity}}" userInput="2" stepKey="fillQuantity2"/> |
| 99 | + <actionGroup ref="StorefrontClickAddToCartOnProductPageActionGroup" stepKey="addToCartFromStorefrontProductPage2"/> |
| 100 | + <!-- Step 10: Go to Shopping Cart --> |
| 101 | + <actionGroup ref="ClickViewAndEditCartFromMiniCartActionGroup" stepKey="goToShoppingCartFromMinicart"/> |
| 102 | + <!-- Step 11: Should not see the discount because we have exceeded $2000 --> |
| 103 | + <actionGroup ref="StorefrontCartPageOpenActionGroup" stepKey="goToCartPage"/> |
| 104 | + <see selector="{{StorefrontCheckoutCartItemWeeeSection.subtotalIncludingTaxPrice}}" userInput="$2,230.00" stepKey="seeNewPriceSide"/> |
| 105 | + <dontSeeElement selector="{{CheckoutCartSummarySection.discountAmount}}" stepKey="dontSeeDiscount"/> |
| 106 | + </test> |
| 107 | +</tests> |
0 commit comments