|
| 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="TableRatesShippingMethodForDifferentStatesTest"> |
| 12 | + <annotations> |
| 13 | + <features value="Shipping"/> |
| 14 | + <stories value="Table Rates"/> |
| 15 | + <title value="Table rates shipping method for different states test"/> |
| 16 | + <description value="Checkout with Table Rates for different states of the USA"/> |
| 17 | + <severity value="CRITICAL"/> |
| 18 | + <testCaseId value="MC-13581"/> |
| 19 | + <group value="shipping"/> |
| 20 | + </annotations> |
| 21 | + <before> |
| 22 | + <!-- Create product --> |
| 23 | + <createData entity="SimpleProduct2" stepKey="createProduct"/> |
| 24 | + |
| 25 | + <!-- Create customer --> |
| 26 | + <createData entity="Simple_US_Customer_CA" stepKey="createCustomer"/> |
| 27 | + |
| 28 | + <!-- Login as admin --> |
| 29 | + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> |
| 30 | + </before> |
| 31 | + <after> |
| 32 | + <!-- Delete product --> |
| 33 | + <deleteData createDataKey="createProduct" stepKey="deleteProduct"/> |
| 34 | + |
| 35 | + <!-- Delete customer --> |
| 36 | + <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> |
| 37 | + |
| 38 | + <!-- Log out --> |
| 39 | + <actionGroup ref="logout" stepKey="logout"/> |
| 40 | + </after> |
| 41 | + |
| 42 | + <!-- Go to Stores > Configuration > Sales > Shipping Methods --> |
| 43 | + <actionGroup ref="AdminOpenShippingMethodsConfigPageActionGroup" stepKey="openShippingMethodConfigPage"/> |
| 44 | + |
| 45 | + <!-- Switch to Website scope --> |
| 46 | + <actionGroup ref="AdminSwitchWebsiteActionGroup" stepKey="AdminSwitchStoreView"> |
| 47 | + <argument name="website" value="_defaultWebsite"/> |
| 48 | + </actionGroup> |
| 49 | + |
| 50 | + <!-- Enable Table Rate method and save config --> |
| 51 | + <actionGroup ref="AdminChangeTableRatesShippingMethodStatusActionGroup" stepKey="enableTableRatesShippingMethod"/> |
| 52 | + <actionGroup ref="AdminSaveConfigActionGroup" stepKey="saveConfig"/> |
| 53 | + |
| 54 | + <!-- Make sure you have Condition Weight vs. Destination --> |
| 55 | + <see selector="{{AdminShippingMethodTableRatesSection.condition}}" userInput="{{TableRatesWeightVSDestination.condition}}" stepKey="seeDefaultCondition"/> |
| 56 | + |
| 57 | + <!-- Import file and save config --> |
| 58 | + <attachFile selector="{{AdminShippingMethodTableRatesSection.importFile}}" userInput="table_rate_30895.csv" stepKey="attachFileForImport"/> |
| 59 | + <actionGroup ref="AdminSaveConfigActionGroup" stepKey="saveConfigs"/> |
| 60 | + |
| 61 | + <!-- Login as customer --> |
| 62 | + <actionGroup ref="LoginToStorefrontActionGroup" stepKey="loginAsCustomer"> |
| 63 | + <argument name="Customer" value="$$createCustomer$$"/> |
| 64 | + </actionGroup> |
| 65 | + |
| 66 | + <!-- Add product to the shopping cart --> |
| 67 | + <actionGroup ref="OpenStoreFrontProductPageActionGroup" stepKey="openProductPage"> |
| 68 | + <argument name="productUrlKey" value="$$createProduct.custom_attributes[url_key]$$"/> |
| 69 | + </actionGroup> |
| 70 | + <actionGroup ref="StorefrontAddProductToCartActionGroup" stepKey="addProductToCart"> |
| 71 | + <argument name="product" value="$$createProduct$$"/> |
| 72 | + <argument name="productCount" value="1"/> |
| 73 | + </actionGroup> |
| 74 | + |
| 75 | + <!-- Open the shopping cart page --> |
| 76 | + <actionGroup ref="StorefrontOpenCartFromMinicartActionGroup" stepKey="openShoppingCart"/> |
| 77 | + |
| 78 | + <!-- Expand Estimate Shipping and Tax section in Summary --> |
| 79 | + <conditionalClick selector="{{CheckoutCartSummarySection.estimateShippingAndTax}}" dependentSelector="{{CheckoutCartSummarySection.country}}" visible="false" stepKey="expandEstimateShippingAndTax"/> |
| 80 | + <waitForLoadingMaskToDisappear stepKey="waitForLoadingMask"/> |
| 81 | + |
| 82 | + <!-- See available Table Rate option --> |
| 83 | + <actionGroup ref="StorefrontAssertShippingMethodPresentInCartActionGroup" stepKey="assertShippingMethodLabel"> |
| 84 | + <argument name="shippingMethod" value="{{TableRatesWeightVSDestination.title}}"/> |
| 85 | + </actionGroup> |
| 86 | + <actionGroup ref="StorefrontAssertShippingMethodOptionPresentInCartActionGroup" stepKey="assertShippingMethodOption"> |
| 87 | + <argument name="methodName" value="{{TableRatesWeightVSDestination.methodName}}"/> |
| 88 | + <argument name="price" value="{{TableRatesWeightVSDestination.priceCA}}"/> |
| 89 | + </actionGroup> |
| 90 | + |
| 91 | + <!-- Change State to New York --> |
| 92 | + <selectOption selector="{{CheckoutCartSummarySection.stateProvince}}" userInput="{{US_Address_NY.state}}" stepKey="selectAnotherState"/> |
| 93 | + <waitForPageLoad stepKey="waitForShippingMethodLoad"/> |
| 94 | + |
| 95 | + <!-- See available Table Rate option for another state --> |
| 96 | + <actionGroup ref="StorefrontAssertShippingMethodPresentInCartActionGroup" stepKey="assertShippingMethodLabelForAnotherState"> |
| 97 | + <argument name="shippingMethod" value="{{TableRatesWeightVSDestination.title}}"/> |
| 98 | + </actionGroup> |
| 99 | + <actionGroup ref="StorefrontAssertShippingMethodOptionPresentInCartActionGroup" stepKey="assertShippingMethodOptionForAnotherState"> |
| 100 | + <argument name="methodName" value="{{TableRatesWeightVSDestination.methodName}}"/> |
| 101 | + <argument name="price" value="{{TableRatesWeightVSDestination.price}}"/> |
| 102 | + </actionGroup> |
| 103 | + |
| 104 | + <!-- Rollback config --> |
| 105 | + <actionGroup ref="AdminOpenShippingMethodsConfigPageActionGroup" stepKey="openShippingMethodSystemConfigPage"/> |
| 106 | + <actionGroup ref="AdminSwitchWebsiteActionGroup" stepKey="AdminSwitchStoreViewToMainWebsite"> |
| 107 | + <argument name="website" value="_defaultWebsite"/> |
| 108 | + </actionGroup> |
| 109 | + <actionGroup ref="AdminChangeTableRatesShippingMethodStatusActionGroup" stepKey="disableTableRatesShippingMethod"> |
| 110 | + <argument name="status" value="0"/> |
| 111 | + </actionGroup> |
| 112 | + <actionGroup ref="AdminSaveConfigActionGroup" stepKey="saveSystemConfig"/> |
| 113 | + </test> |
| 114 | +</tests> |
0 commit comments