|
| 1 | +<?xml version="1.0" encoding="UTF-8"?><!-- |
| 2 | + /** |
| 3 | + * Copyright © Magento, Inc. All rights reserved. |
| 4 | + * See COPYING.txt for license details. |
| 5 | + */ |
| 6 | +--> |
| 7 | + |
| 8 | +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> |
| 9 | + <test name="SalesRuleDiscountIsAppliedOnPackageValueForTableRateTest"> |
| 10 | + <annotations> |
| 11 | + <features value="Shipping"/> |
| 12 | + <stories value="Offline Shipping Methods"/> |
| 13 | + <title value="SalesRule Discount Is Applied On PackageValue For TableRate"/> |
| 14 | + <description value="SalesRule Discount Is Applied On PackageValue For TableRate"/> |
| 15 | + <severity value="AVERAGE"/> |
| 16 | + <testCaseId value="MC-38271"/> |
| 17 | + <group value="shipping"/> |
| 18 | + </annotations> |
| 19 | + <before> |
| 20 | + <!-- Add simple product --> |
| 21 | + <createData entity="SimpleProduct2" stepKey="createSimpleProduct"> |
| 22 | + <field key="price">13.00</field> |
| 23 | + </createData> |
| 24 | + |
| 25 | + <!-- Create cart price rule --> |
| 26 | + <createData entity="ActiveSalesRuleForNotLoggedIn" stepKey="createCartPriceRule"/> |
| 27 | + <createData entity="SimpleSalesRuleCoupon" stepKey="createCouponForCartPriceRule"> |
| 28 | + <requiredEntity createDataKey="createCartPriceRule"/> |
| 29 | + </createData> |
| 30 | + |
| 31 | + <!-- Login as admin --> |
| 32 | + <actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/> |
| 33 | + |
| 34 | + <!-- Go to Stores > Configuration > Sales > Shipping Methods --> |
| 35 | + <actionGroup ref="AdminOpenShippingMethodsConfigPageActionGroup" stepKey="openShippingMethodConfigPage"/> |
| 36 | + |
| 37 | + <!-- Switch to Website scope --> |
| 38 | + <actionGroup ref="AdminSwitchWebsiteActionGroup" stepKey="AdminSwitchStoreView"> |
| 39 | + <argument name="website" value="_defaultWebsite"/> |
| 40 | + </actionGroup> |
| 41 | + |
| 42 | + <!-- Enable Table Rate method and save config --> |
| 43 | + <actionGroup ref="AdminChangeTableRatesShippingMethodStatusActionGroup" stepKey="enableTableRatesShippingMethod"/> |
| 44 | + |
| 45 | + <!-- Uncheck Use Default checkbox for Default Condition --> |
| 46 | + <uncheckOption selector="{{AdminShippingMethodTableRatesSection.carriersTableRateConditionName}}" stepKey="disableUseDefaultCondition"/> |
| 47 | + |
| 48 | + <!-- Make sure you have Condition Price vs. Destination --> |
| 49 | + <selectOption selector="{{AdminShippingMethodTableRatesSection.condition}}" userInput="{{TableRateShippingMethodConfig.package_value_with_discount}}" stepKey="setCondition"/> |
| 50 | + |
| 51 | + <!-- Import file and save config --> |
| 52 | + <attachFile selector="{{AdminShippingMethodTableRatesSection.importFile}}" userInput="usa_tablerates.csv" stepKey="attachFileForImport"/> |
| 53 | + <actionGroup ref="AdminSaveConfigActionGroup" stepKey="saveConfigs"/> |
| 54 | + </before> |
| 55 | + <after> |
| 56 | + <!-- Go to Stores > Configuration > Sales > Shipping Methods --> |
| 57 | + <actionGroup ref="AdminOpenShippingMethodsConfigPageActionGroup" stepKey="openShippingMethodConfigPage"/> |
| 58 | + |
| 59 | + <!-- Switch to Website scope --> |
| 60 | + <actionGroup ref="AdminSwitchWebsiteActionGroup" stepKey="AdminSwitchStoreView"> |
| 61 | + <argument name="website" value="_defaultWebsite"/> |
| 62 | + </actionGroup> |
| 63 | + |
| 64 | + <!-- Check Use Default checkbox for Default Condition and Active --> |
| 65 | + <checkOption selector="{{AdminShippingMethodTableRatesSection.carriersTableRateConditionName}}" stepKey="enableUseDefaultCondition"/> |
| 66 | + <checkOption selector="{{AdminShippingMethodTableRatesSection.enabledUseSystemValue}}" stepKey="enableUseDefaultActive"/> |
| 67 | + |
| 68 | + <actionGroup ref="AdminSaveConfigActionGroup" stepKey="saveConfigs"/> |
| 69 | + |
| 70 | + <!-- Log out --> |
| 71 | + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> |
| 72 | + |
| 73 | + <!-- Remove simple product--> |
| 74 | + <deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/> |
| 75 | + |
| 76 | + <!-- Delete sales rule --> |
| 77 | + <deleteData createDataKey="createCartPriceRule" stepKey="deleteCartPriceRule"/> |
| 78 | + |
| 79 | + </after> |
| 80 | + <!-- Add simple product to cart --> |
| 81 | + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="addProductToCart"> |
| 82 | + <argument name="product" value="$$createSimpleProduct$$"/> |
| 83 | + </actionGroup> |
| 84 | + |
| 85 | + <!-- Assert that table rate value is correct for US --> |
| 86 | + <actionGroup ref="StorefrontCartPageOpenActionGroup" stepKey="goToCheckout"/> |
| 87 | + <waitForElement time="30" selector="{{CheckoutCartSummarySection.estimateShippingAndTaxForm}}" stepKey="waitForEstimateShippingAndTaxForm"/> |
| 88 | + <waitForElement time="30" selector="{{CheckoutCartSummarySection.shippingMethodForm}}" stepKey="waitForShippingMethodForm"/> |
| 89 | + <conditionalClick selector="{{CheckoutCartSummarySection.estimateShippingAndTax}}" dependentSelector="{{CheckoutCartSummarySection.country}}" visible="false" stepKey="expandEstimateShippingandTax" /> |
| 90 | + <selectOption selector="{{CheckoutCartSummarySection.country}}" userInput="United States" stepKey="selectUSCountry"/> |
| 91 | + <waitForPageLoad stepKey="waitForSelectCountry"/> |
| 92 | + <see selector="{{CheckoutCartSummarySection.shippingPrice}}" userInput="$5.99" stepKey="seeShippingForUS"/> |
| 93 | + |
| 94 | + <!-- Apply Coupon --> |
| 95 | + <actionGroup ref="StorefrontApplyCouponActionGroup" stepKey="applyDiscount"> |
| 96 | + <argument name="coupon" value="$$createCouponForCartPriceRule$$"/> |
| 97 | + </actionGroup> |
| 98 | + |
| 99 | + <see selector="{{CheckoutCartSummarySection.shippingPrice}}" userInput="$7.99" stepKey="seeShippingForUSWithDiscount"/> |
| 100 | + </test> |
| 101 | +</tests> |
0 commit comments