|
| 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 | +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| 9 | + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> |
| 10 | + <test name="AdminCreateCartPriceRuleWithSubtotalInclTaxTest"> |
| 11 | + <annotations> |
| 12 | + <stories value="Create Sales Rule"/> |
| 13 | + <title value="Create Cart Price Rule with Subtotal Incl Tax"/> |
| 14 | + <description value="Test that cart price rule with Subtotal Incl Tax works correctly"/> |
| 15 | + <severity value="CRITICAL"/> |
| 16 | + <useCaseId value="MC-37729"/> |
| 17 | + <testCaseId value="MC-38971"/> |
| 18 | + <group value="SalesRule"/> |
| 19 | + </annotations> |
| 20 | + <before> |
| 21 | + <!--Login to backend--> |
| 22 | + <actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/> |
| 23 | + <!--Create tax rate for US-CA-*--> |
| 24 | + <createData entity="defaultTaxRate" stepKey="taxRate"/> |
| 25 | + <!--Create tax rule--> |
| 26 | + <actionGroup ref="AdminCreateTaxRuleActionGroup" stepKey="createTaxRule"> |
| 27 | + <argument name="taxRate" value="$$taxRate$$"/> |
| 28 | + <argument name="taxRule" value="SimpleTaxRule"/> |
| 29 | + </actionGroup> |
| 30 | + <!--Create simple product--> |
| 31 | + <createData entity="SimpleProduct2" stepKey="product"> |
| 32 | + <field key="price">100</field> |
| 33 | + </createData> |
| 34 | + <!--Create cart price rule with no coupon and 50% discount--> |
| 35 | + <createData entity="ApiCartRule" stepKey="createCartPriceRule"/> |
| 36 | + <!--Add "subtotal incl tax > 100" condition to cart price rule--> |
| 37 | + <amOnPage url="{{AdminCartPriceRuleEditPage.url($$createCartPriceRule.rule_id$$)}}" stepKey="openEditRule"/> |
| 38 | + <actionGroup ref="SetCartAttributeConditionForCartPriceRuleActionGroup" stepKey="setCartAttributeConditionForCartPriceRule"> |
| 39 | + <argument name="attributeName" value="{{SalesRuleAddressConditions.base_subtotal_total_incl_tax}}"/> |
| 40 | + <argument name="operatorType" value="greater than"/> |
| 41 | + <argument name="value" value="100"/> |
| 42 | + </actionGroup> |
| 43 | + </before> |
| 44 | + <after> |
| 45 | + <!--Delete tax rule--> |
| 46 | + <actionGroup ref="AdminDeleteTaxRule" stepKey="deleteTaxRule"> |
| 47 | + <argument name="taxRuleCode" value="{{SimpleTaxRule.code}}" /> |
| 48 | + </actionGroup> |
| 49 | + <!--Delete tax rate--> |
| 50 | + <deleteData createDataKey="taxRate" stepKey="deleteTaxRate"/> |
| 51 | + <!--Delete product--> |
| 52 | + <deleteData createDataKey="product" stepKey="deleteProduct"/> |
| 53 | + <!--Delete cart price rule--> |
| 54 | + <deleteData createDataKey="createCartPriceRule" stepKey="deleteCartPriceRule"/> |
| 55 | + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> |
| 56 | + </after> |
| 57 | + |
| 58 | + <!--Open product --> |
| 59 | + <actionGroup ref="StorefrontOpenProductEntityPageActionGroup" stepKey="openProduct2Page"> |
| 60 | + <argument name="product" value="$$product$$"/> |
| 61 | + </actionGroup> |
| 62 | + <!--Add to cart --> |
| 63 | + <actionGroup ref="StorefrontAddToTheCartActionGroup" stepKey="product2AddToCart"/> |
| 64 | + <!--Click on mini cart--> |
| 65 | + <actionGroup ref="StorefrontClickOnMiniCartActionGroup" stepKey="clickOnMiniCart"/> |
| 66 | + <!--Click on view and edit cart link--> |
| 67 | + <actionGroup ref="ClickViewAndEditCartFromMiniCartActionGroup" stepKey="goToShoppingCartFromMinicart"/> |
| 68 | + <waitForPageLoad stepKey="waitForViewAndEditCartToOpen"/> |
| 69 | + <!--Assert that tax and discount are not applied by default--> |
| 70 | + <actionGroup ref="StorefrontCheckCartActionGroup" stepKey="AssertTaxAndDiscountIsNotApplied"> |
| 71 | + <argument name="subtotal" value="$100.00"/> |
| 72 | + <argument name="shipping" value="$5.00"/> |
| 73 | + <argument name="shippingMethod" value="Flat Rate - Fixed"/> |
| 74 | + <argument name="total" value="$105.00"/> |
| 75 | + </actionGroup> |
| 76 | + <dontSee selector="{{CheckoutCartSummarySection.discountAmount}}" stepKey="assertDiscountIsNotApplied"/> |
| 77 | + <!--Open "Estimate Shipping and Tax" section and fill US-CA address --> |
| 78 | + <actionGroup ref="StorefrontCartEstimateShippingAndTaxActionGroup" stepKey="fillEstimateShippingAndTaxSection"> |
| 79 | + <argument name="estimateAddress" value="EstimateAddressCalifornia"/> |
| 80 | + </actionGroup> |
| 81 | + <!--Assert that tax and discount are applied by to total amount--> |
| 82 | + <actionGroup ref="StorefrontCheckCartActionGroup" stepKey="AssertTaxAndDiscountIsApplied"> |
| 83 | + <argument name="subtotal" value="$100.00"/> |
| 84 | + <argument name="shipping" value="$5.00"/> |
| 85 | + <argument name="shippingMethod" value="Flat Rate - Fixed"/> |
| 86 | + <argument name="total" value="$60.00"/> |
| 87 | + </actionGroup> |
| 88 | + <see selector="{{CheckoutCartSummarySection.discountAmount}}" userInput="-$50.00" stepKey="assertDiscountIsApplied"/> |
| 89 | + </test> |
| 90 | +</tests> |
0 commit comments