|
| 1 | +<?xml version="1.0" encoding="UTF-8"?> |
| 2 | +<!-- |
| 3 | + /** |
| 4 | + * Copyright 2024 Adobe |
| 5 | + * All Rights Reserved. |
| 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="AdminImportTableRatesWithSpecificAmountTest"> |
| 10 | + <annotations> |
| 11 | + <features value="Shipping"/> |
| 12 | + <stories value="Offline Shipping Methods"/> |
| 13 | + <title value="Import table rate shipping prices with specific amount including and excluding virtual products"/> |
| 14 | + <description value="Admin imports table rate shipping prices with specific amount including and excluding virtual products and validates the shipping cost reflects as per the configurations"/> |
| 15 | + <severity value="MAJOR"/> |
| 16 | + <testCaseId value="AC-13526"/> |
| 17 | + <group value="shipping"/> |
| 18 | + </annotations> |
| 19 | + <before> |
| 20 | + <!--Create customer--> |
| 21 | + <createData entity="Simple_US_CA_Customer" stepKey="createCustomer"/> |
| 22 | + <!-- Add simple product --> |
| 23 | + <createData entity="SimpleProduct2" stepKey="createFirstSimpleProduct"> |
| 24 | + <field key="price">9.00</field> |
| 25 | + </createData> |
| 26 | + <createData entity="SimpleProduct2" stepKey="createSecondSimpleProduct"> |
| 27 | + <field key="price">11.00</field> |
| 28 | + </createData> |
| 29 | + <createData entity="SimpleProduct3" stepKey="createThirdSimpleProduct"> |
| 30 | + <field key="price">64.00</field> |
| 31 | + </createData> |
| 32 | + <createData entity="ApiVirtualProductWithDescription" stepKey="createVirtualProduct"/> |
| 33 | + </before> |
| 34 | + <after> |
| 35 | + <deleteData createDataKey="createVirtualProduct" stepKey="deleteVirtualProduct"/> |
| 36 | + <!-- Remove simple products--> |
| 37 | + <deleteData createDataKey="createFirstSimpleProduct" stepKey="deleteFirstSimpleProduct"/> |
| 38 | + <deleteData createDataKey="createSecondSimpleProduct" stepKey="deleteSecondSimpleProduct"/> |
| 39 | + <deleteData createDataKey="createThirdSimpleProduct" stepKey="deleteThirdSimpleProduct"/> |
| 40 | + <!-- Delete sales rule --> |
| 41 | + <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> |
| 42 | + <!-- Go to Stores > Configuration > Sales > Shipping Methods --> |
| 43 | + <actionGroup ref="AdminOpenShippingMethodsConfigPageActionGroup" stepKey="openShippingMethodConfigPage"/> |
| 44 | + <!-- Check Use Default checkbox for Default Condition and Active --> |
| 45 | + <checkOption selector="{{AdminShippingMethodTableRatesSection.carriersTableRateConditionName}}" stepKey="enableUseDefaultCondition"/> |
| 46 | + <checkOption selector="{{AdminShippingMethodTableRatesSection.enabledUseSystemValue}}" stepKey="enableUseDefaultActive"/> |
| 47 | + <actionGroup ref="AdminSaveConfigActionGroup" stepKey="saveConfigs"/> |
| 48 | + <!-- Log out --> |
| 49 | + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> |
| 50 | + <!-- Remove Virtual products--> |
| 51 | + </after> |
| 52 | + <!-- Login as admin --> |
| 53 | + <actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/> |
| 54 | + <!-- Go to Stores > Configuration > Sales > Shipping Methods --> |
| 55 | + <actionGroup ref="AdminOpenShippingMethodsConfigPageActionGroup" stepKey="openShippingMethodConfigPage"/> |
| 56 | + <!-- Switch to Website scope --> |
| 57 | + <actionGroup ref="AdminSwitchWebsiteActionGroup" stepKey="AdminSwitchStoreView"> |
| 58 | + <argument name="website" value="_defaultWebsite"/> |
| 59 | + </actionGroup> |
| 60 | + <!-- Enable Table Rate method and save config --> |
| 61 | + <actionGroup ref="AdminChangeTableRatesShippingMethodStatusActionGroup" stepKey="enableTableRatesShippingMethod"/> |
| 62 | + <!-- Uncheck Use Default checkbox for Default Condition --> |
| 63 | + <uncheckOption selector="{{AdminShippingMethodTableRatesSection.carriersTableRateConditionName}}" stepKey="disableUseDefaultCondition"/> |
| 64 | + <!-- Make sure you have Condition Price vs. Destination --> |
| 65 | + <selectOption selector="{{AdminShippingMethodTableRatesSection.condition}}" userInput="{{TableRateShippingMethodConfig.package_value_with_discount}}" stepKey="setCondition"/> |
| 66 | + <!-- Uncheck Use Default checkbox for include virtual price --> |
| 67 | + <uncheckOption selector="{{AdminShippingMethodTableRatesSection.carriersTableRateIncludeVirtualPrice}}" stepKey="uncheckIncludeVirtualPrice"/> |
| 68 | + <selectOption selector="{{AdminShippingMethodTableRatesSection.carriersTableRateIncludeVirtualPriceDropdown}}" userInput="No" stepKey="setIncludeVirtualPriceAsNo"/> |
| 69 | + <!-- Import file and save config --> |
| 70 | + <attachFile selector="{{AdminShippingMethodTableRatesSection.importFile}}" userInput="usa_tablerates.csv" stepKey="attachFileForImport"/> |
| 71 | + <actionGroup ref="AdminSaveConfigActionGroup" stepKey="saveConfigs"/> |
| 72 | + <actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex"> |
| 73 | + <argument name="indices" value=""/> |
| 74 | + </actionGroup> |
| 75 | + <!-- Login as Customer Login from Customer page --> |
| 76 | + <actionGroup ref="LoginToStorefrontActionGroup" stepKey="customerLogin"> |
| 77 | + <argument name="Customer" value="$$createCustomer$$" /> |
| 78 | + </actionGroup> |
| 79 | + <waitForPageLoad stepKey="waitForPageLoad"/> |
| 80 | + <!-- Add simple product to cart --> |
| 81 | + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="addProductToCart"> |
| 82 | + <argument name="product" value="$$createFirstSimpleProduct$$"/> |
| 83 | + </actionGroup> |
| 84 | + <!-- Assert that table rate value is correct for US --> |
| 85 | + <actionGroup ref="StorefrontCartPageOpenActionGroup" stepKey="goToCheckout"/> |
| 86 | + <waitForElementVisible selector="{{CheckoutCartSummarySection.estimateShippingAndTax}}" stepKey="seeEstimateShippingandTax"/> |
| 87 | + <conditionalClick selector="{{CheckoutCartSummarySection.estimateShippingAndTax}}" dependentSelector="{{CheckoutCartSummarySection.country}}" visible="false" stepKey="expandEstimateShippingandTax" /> |
| 88 | + <grabValueFrom selector="{{CheckoutCartSummarySection.shippingPrice}}" stepKey="grabShippingForUS"/> |
| 89 | + <waitForText selector="{{CheckoutCartSummarySection.shippingPrice}}" userInput="$grabShippingForUS" stepKey="seeShippingForUS1"/> |
| 90 | + <waitForPageLoad stepKey="waitForSelectCountry"/> |
| 91 | + <!-- Add Virtual product to cart --> |
| 92 | + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="addSecondProductToCart1"> |
| 93 | + <argument name="product" value="$$createVirtualProduct$$"/> |
| 94 | + </actionGroup> |
| 95 | + <!-- Assert that table rate value is correct for US --> |
| 96 | + <actionGroup ref="StorefrontCartPageOpenActionGroup" stepKey="goAgainToCheckout"/> |
| 97 | + <waitForElementVisible selector="{{CheckoutCartSummarySection.estimateShippingAndTax}}" stepKey="seeEstimateShippingandTax1"/> |
| 98 | + <conditionalClick selector="{{CheckoutCartSummarySection.estimateShippingAndTax}}" dependentSelector="{{CheckoutCartSummarySection.country}}" visible="false" stepKey="expandToEstimateShippingandTax1"/> |
| 99 | + <grabValueFrom selector="{{CheckoutCartSummarySection.shippingPrice}}" stepKey="grabShippingForUS1"/> |
| 100 | + <waitForText selector="{{CheckoutCartSummarySection.shippingPrice}}" userInput="$grabShippingForUS1" stepKey="seeShippingForUS"/> |
| 101 | + <!-- Customer Click On Mini Cart --> |
| 102 | + <actionGroup ref="StorefrontClickOnMiniCartActionGroup" stepKey="clickOnMiniCart"/> |
| 103 | + <!--Remove an item from the cart using minicart--> |
| 104 | + <actionGroup ref="RemoveProductFromMiniCartActionGroup" stepKey="removeProductFromMiniCart"> |
| 105 | + <argument name="productName" value="$$createFirstSimpleProduct.name$$"/> |
| 106 | + </actionGroup> |
| 107 | + <!-- Add simple product to cart --> |
| 108 | + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="addAnotherProductToCart"> |
| 109 | + <argument name="product" value="$$createSecondSimpleProduct$$"/> |
| 110 | + </actionGroup> |
| 111 | + <!-- Assert that table rate value is correct for US --> |
| 112 | + <actionGroup ref="StorefrontCartPageOpenActionGroup" stepKey="navigateToToCheckout"/> |
| 113 | + <waitForElementVisible selector="{{CheckoutCartSummarySection.estimateShippingAndTax}}" stepKey="seeEstimateShippingandTax2"/> |
| 114 | + <conditionalClick selector="{{CheckoutCartSummarySection.estimateShippingAndTax}}" dependentSelector="{{CheckoutCartSummarySection.country}}" visible="false" stepKey="expandEstimateShippingPrice"/> |
| 115 | + <grabValueFrom selector="{{CheckoutCartSummarySection.shippingPrice}}" stepKey="grabTableratePrice1"/> |
| 116 | + <waitForText selector="{{CheckoutCartSummarySection.shippingPrice}}" userInput="$grabTableratePrice1" stepKey="seeShippingForUS2"/> |
| 117 | + <!-- Assert product details in Mini Cart --> |
| 118 | + <actionGroup ref="StorefrontClickOnMiniCartActionGroup" stepKey="clickOnMiniCart1"/> |
| 119 | + <!--Remove an item from the cart using minicart--> |
| 120 | + <actionGroup ref="RemoveProductFromMiniCartActionGroup" stepKey="removeProductFromMiniCart1"> |
| 121 | + <argument name="productName" value="$$createSecondSimpleProduct.name$$"/> |
| 122 | + </actionGroup> |
| 123 | + <!-- Add simple product to cart --> |
| 124 | + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="addAnotherProductIntoCart"> |
| 125 | + <argument name="product" value="$$createThirdSimpleProduct$$"/> |
| 126 | + </actionGroup> |
| 127 | + <!-- Assert that table rate value is correct for US --> |
| 128 | + <actionGroup ref="StorefrontCartPageOpenActionGroup" stepKey="navigateAgainToToCheckout"/> |
| 129 | + <waitForElementVisible selector="{{CheckoutCartSummarySection.estimateShippingAndTax}}" stepKey="seeEstimateShippingandTax3"/> |
| 130 | + <conditionalClick selector="{{CheckoutCartSummarySection.estimateShippingAndTax}}" dependentSelector="{{CheckoutCartSummarySection.country}}" visible="false" stepKey="expandEstimateShippingPrice1"/> |
| 131 | + <waitForText selector="{{CheckoutCartSummarySection.shippingPrice}}" userInput="$4.99" stepKey="seeShippingForUS3"/> |
| 132 | + <!-- Assert product details in Mini Cart --> |
| 133 | + <actionGroup ref="StorefrontClickOnMiniCartActionGroup" stepKey="clickOnMiniCart2"/> |
| 134 | + <!--Remove an item from the cart using minicart--> |
| 135 | + <actionGroup ref="RemoveProductFromMiniCartActionGroup" stepKey="removeProductFromMiniCart3"> |
| 136 | + <argument name="productName" value="$$createThirdSimpleProduct.name$$"/> |
| 137 | + </actionGroup> |
| 138 | + <!-- Assert that table rate value is correct for US --> |
| 139 | + <actionGroup ref="StorefrontCartPageOpenActionGroup" stepKey="navigateAgainToToCheckout1"/> |
| 140 | + <waitForElementVisible selector="{{CheckoutCartSummarySection.estimateShippingAndTax}}" stepKey="seeEstimateShippingandTax4"/> |
| 141 | + <conditionalClick selector="{{CheckoutCartSummarySection.estimateShippingAndTax}}" dependentSelector="{{CheckoutCartSummarySection.country}}" visible="false" stepKey="expandEstimateShippingPrice2"/> |
| 142 | + <waitForElementNotVisible selector="{{CheckoutCartSummarySection.shippingPrice}}" stepKey="dontSeeShippingPriceForUS"/> |
| 143 | + <actionGroup ref="AdminOpenShippingMethodsConfigPageActionGroup" stepKey="openAgainShippingMethodConfigPage"/> |
| 144 | + <actionGroup ref="AdminSwitchWebsiteActionGroup" stepKey="AdminSwitchStoreView1"> |
| 145 | + <argument name="website" value="_defaultWebsite"/> |
| 146 | + </actionGroup> |
| 147 | + <selectOption selector="{{AdminShippingMethodTableRatesSection.carriersTableRateIncludeVirtualPriceDropdown}}" userInput="Yes" stepKey="setIncludeVirtualPriceAsYes"/> |
| 148 | + <actionGroup ref="AdminSaveConfigActionGroup" stepKey="saveConfig"/> |
| 149 | + <actionGroup ref="StorefrontOpenHomePageActionGroup" stepKey="navigateToStorefront"/> |
| 150 | + <actionGroup ref="StorefrontClickOnMiniCartActionGroup" stepKey="clickOnMiniCart3"/> |
| 151 | + <!--Remove an item from the cart using minicart--> |
| 152 | + <actionGroup ref="RemoveProductFromMiniCartActionGroup" stepKey="removeVirtualProductFromMiniCart"> |
| 153 | + <argument name="productName" value="$$createVirtualProduct.name$$"/> |
| 154 | + </actionGroup> |
| 155 | + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="addSimpleProductToCart"> |
| 156 | + <argument name="product" value="$$createFirstSimpleProduct$$"/> |
| 157 | + </actionGroup> |
| 158 | + <actionGroup ref="StorefrontCartPageOpenActionGroup" stepKey="goAgainToCheckout3"/> |
| 159 | + <waitForElementVisible selector="{{CheckoutCartSummarySection.estimateShippingAndTax}}" stepKey="seeEstimateShippingandTax5"/> |
| 160 | + <conditionalClick selector="{{CheckoutCartSummarySection.estimateShippingAndTax}}" dependentSelector="{{CheckoutCartSummarySection.country}}" visible="false" stepKey="expandEstimateShippingandTax1" /> |
| 161 | + <grabValueFrom selector="{{CheckoutCartSummarySection.shippingPrice}}" stepKey="grabAgainTableratePrice"/> |
| 162 | + <waitForText selector="{{CheckoutCartSummarySection.shippingPrice}}" userInput="$grabAgainTableratePrice" stepKey="seeShippingForUS5"/> |
| 163 | + <!-- Add Virtual product to cart --> |
| 164 | + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="addVirtualProductToCart"> |
| 165 | + <argument name="product" value="$$createVirtualProduct$$"/> |
| 166 | + </actionGroup> |
| 167 | + <!-- Assert that table rate value is correct for US --> |
| 168 | + <actionGroup ref="StorefrontCartPageOpenActionGroup" stepKey="goAgainToCheckout2"/> |
| 169 | + <waitForElementVisible selector="{{CheckoutCartSummarySection.estimateShippingAndTax}}" stepKey="seeEstimateShippingandTax6"/> |
| 170 | + <conditionalClick selector="{{CheckoutCartSummarySection.estimateShippingAndTax}}" dependentSelector="{{CheckoutCartSummarySection.country}}" visible="false" stepKey="expandEstimateTableRatePrice"/> |
| 171 | + <waitForText selector="{{CheckoutCartSummarySection.shippingPrice}}" userInput="$4.99" stepKey="seeShippingForUS4"/> |
| 172 | + </test> |
| 173 | +</tests> |
0 commit comments