|
| 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="ShoppingCartAndMiniShoppingCartPerCustomerTest"> |
| 12 | + <annotations> |
| 13 | + <features value="Checkout"/> |
| 14 | + <stories value="Shopping Cart and Mini Shopping Cart per Customer"/> |
| 15 | + <title value="Shopping cart and mini shopping cart per customer test"/> |
| 16 | + <description value="Shopping cart and mini shopping cart per customer with enabled cached"/> |
| 17 | + <severity value="CRITICAL"/> |
| 18 | + <testCaseId value="MC-14730"/> |
| 19 | + <group value="checkout"/> |
| 20 | + </annotations> |
| 21 | + <before> |
| 22 | + <!-- Flush cache --> |
| 23 | + <magentoCLI command="cache:flush" stepKey="clearCache"/> |
| 24 | + |
| 25 | + <!-- Create two customers --> |
| 26 | + <createData entity="Simple_US_Customer" stepKey="createFirstCustomer"/> |
| 27 | + <createData entity="Simple_US_CA_Customer" stepKey="createSecondCustomer"/> |
| 28 | + |
| 29 | + <!-- Create products --> |
| 30 | + <createData entity="_defaultCategory" stepKey="createCategory"/> |
| 31 | + |
| 32 | + <!-- Create simple product --> |
| 33 | + <createData entity="_defaultProduct" stepKey="createSimpleProduct"> |
| 34 | + <requiredEntity createDataKey="createCategory"/> |
| 35 | + </createData> |
| 36 | + |
| 37 | + <!-- Create simple product with custom options --> |
| 38 | + <createData entity="_defaultProduct" stepKey="createSimpleProductWithCustomOptions"> |
| 39 | + <requiredEntity createDataKey="createCategory"/> |
| 40 | + </createData> |
| 41 | + <updateData createDataKey="createSimpleProductWithCustomOptions" entity="productWithDropdownAndFieldOptions" stepKey="updateProductWithCustomOption"/> |
| 42 | + </before> |
| 43 | + <after> |
| 44 | + <!-- Delete products --> |
| 45 | + <deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/> |
| 46 | + <deleteData createDataKey="createSimpleProductWithCustomOptions" stepKey="deleteSimpleProductWithCustomOptions"/> |
| 47 | + |
| 48 | + <!-- Delete category --> |
| 49 | + <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> |
| 50 | + |
| 51 | + <!-- Delete customers --> |
| 52 | + <deleteData createDataKey="createFirstCustomer" stepKey="deleteFirstCustomer"/> |
| 53 | + <deleteData createDataKey="createSecondCustomer" stepKey="deleteSecondCustomer"/> |
| 54 | + </after> |
| 55 | + |
| 56 | + <!-- Login as first customer --> |
| 57 | + <actionGroup ref="LoginToStorefrontActionGroup" stepKey="loginToStorefrontAccountAsFirstCustomer"> |
| 58 | + <argument name="Customer" value="$$createFirstCustomer$$"/> |
| 59 | + </actionGroup> |
| 60 | + |
| 61 | + <!-- Assert cart is empty --> |
| 62 | + <actionGroup ref="AssertShoppingCartIsEmptyActionGroup" stepKey="seeEmptyShoppingCartForFirstCustomer"/> |
| 63 | + |
| 64 | + <!-- Go to first product page --> |
| 65 | + <amOnPage url="{{StorefrontProductPage.url($$createSimpleProduct.custom_attributes[url_key]$$)}}" stepKey="goToFirstProductPage"/> |
| 66 | + <waitForPageLoad stepKey="waitForFirstProductPageLoad"/> |
| 67 | + |
| 68 | + <!-- Add the product to the shopping cart --> |
| 69 | + <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addFirstProductToCart"> |
| 70 | + <argument name="productName" value="$$createSimpleProduct.name$$"/> |
| 71 | + </actionGroup> |
| 72 | + |
| 73 | + <!-- Go to the second product page --> |
| 74 | + <amOnPage url="{{StorefrontProductPage.url($$createSimpleProductWithCustomOptions.custom_attributes[url_key]$$)}}" stepKey="goToSecondProductPage"/> |
| 75 | + <waitForPageLoad stepKey="waitForSecondProductPageLoad"/> |
| 76 | + |
| 77 | + <!-- Fill the custom options values --> |
| 78 | + <actionGroup ref="StorefrontSelectOptionDropDownActionGroup" stepKey="selectFirstOption"> |
| 79 | + <argument name="optionTitle" value="ProductOptionValueDropdown"/> |
| 80 | + <argument name="option" value="ProductOptionValueWithSkuDropdown1.title"/> |
| 81 | + </actionGroup> |
| 82 | + <fillField selector="{{StorefrontProductInfoMainSection.productOptionFieldInput(ProductOptionField.title)}}" userInput="OptionField" stepKey="fillProductOptionInputField"/> |
| 83 | + |
| 84 | + <!-- Add the product to the shopping cart --> |
| 85 | + <actionGroup ref="StorefrontAddToCartCustomOptionsProductPageActionGroup" stepKey="addSecondProductToCart"> |
| 86 | + <argument name="productName" value="$$createSimpleProductWithCustomOptions.name$$"/> |
| 87 | + </actionGroup> |
| 88 | + |
| 89 | + <!-- Logout first customer --> |
| 90 | + <actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="firstCustomerLogout"/> |
| 91 | + |
| 92 | + <!-- Login as second customer --> |
| 93 | + <actionGroup ref="LoginToStorefrontActionGroup" stepKey="loginToStorefrontAccountAsSecondCustomer"> |
| 94 | + <argument name="Customer" value="$$createSecondCustomer$$"/> |
| 95 | + </actionGroup> |
| 96 | + |
| 97 | + <!-- Assert cart is empty --> |
| 98 | + <actionGroup ref="AssertShoppingCartIsEmptyActionGroup" stepKey="seeEmptyShoppingCartForSecondCustomer"/> |
| 99 | + |
| 100 | + <!-- Go to first product page --> |
| 101 | + <amOnPage url="{{StorefrontProductPage.url($$createSimpleProduct.custom_attributes[url_key]$$)}}" stepKey="goToProductPage"/> |
| 102 | + <waitForPageLoad stepKey="waitForProductPage"/> |
| 103 | + |
| 104 | + <!-- Add the product to the shopping cart --> |
| 105 | + <actionGroup ref="AddProductWithQtyToCartFromStorefrontProductPage" stepKey="addProductToCart"> |
| 106 | + <argument name="productName" value="$$createSimpleProduct.name$$"/> |
| 107 | + <argument name="productQty" value="{{quoteQty2Price123.qty}}"/> |
| 108 | + </actionGroup> |
| 109 | + |
| 110 | + <!-- Logout second customer --> |
| 111 | + <actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="secondCustomerLogout"/> |
| 112 | + |
| 113 | + <!-- Login as first customer --> |
| 114 | + <actionGroup ref="LoginToStorefrontActionGroup" stepKey="loginAsFirstCustomer"> |
| 115 | + <argument name="Customer" value="$$createFirstCustomer$$"/> |
| 116 | + </actionGroup> |
| 117 | + |
| 118 | + <amOnPage url="{{CheckoutCartPage.url}}" stepKey="amOnPageShoppingCart"/> |
| 119 | + <waitForPageLoad stepKey="waitForCheckoutPageLoad"/> |
| 120 | + |
| 121 | + <!-- Assert first products present in shopping cart --> |
| 122 | + <actionGroup ref="StorefrontCheckCartSimpleProductActionGroup" stepKey="checkFirstProductInCart"> |
| 123 | + <argument name="product" value="$$createSimpleProduct$$"/> |
| 124 | + <argument name="productQuantity" value="ApiSimpleSingleQty.quantity"/> |
| 125 | + </actionGroup> |
| 126 | + |
| 127 | + <!-- Assert second products present in shopping cart --> |
| 128 | + <seeElement selector="{{CheckoutCartProductSection.ProductLinkByName($$createSimpleProductWithCustomOptions.name$$)}}" stepKey="assertProductName"/> |
| 129 | + <see selector="{{CheckoutCartProductSection.ProductPriceByName($$createSimpleProductWithCustomOptions.name$$)}}" userInput="{{quoteQty2Subtotal266.currency}}{{quoteQty2Subtotal266.price}}" stepKey="assertProductPrice"/> |
| 130 | + <see selector="{{CheckoutCartProductSection.ProductOptionByNameAndAttribute($$createSimpleProductWithCustomOptions.name$$, ProductOptionField.title)}}" userInput="OptionField" stepKey="seeFieldOption"/> |
| 131 | + <see selector="{{CheckoutCartProductSection.ProductOptionByNameAndAttribute($$createSimpleProductWithCustomOptions.name$$, ProductOptionValueDropdown.title)}}" userInput="{{ProductOptionValueWithSkuDropdown1.title}}" stepKey="seeDropDownOption"/> |
| 132 | + |
| 133 | + <!-- Assert subtotal and grand total --> |
| 134 | + <see selector="{{StorefrontProductPageSection.subTotal}}" userInput="{{quoteQty2Subtotal266.currency}}{{quoteQty2Subtotal266.subtotal}}" stepKey="seeFirstCustomerSubTotal"/> |
| 135 | + <see selector="{{StorefrontProductPageSection.orderTotal}}" userInput="{{quoteQty2Subtotal266.currency}}{{quoteQty2Subtotal266.total}}" stepKey="seeFirstCustomerOrderTotal"/> |
| 136 | + |
| 137 | + <!-- Assert products in mini cart for first customer --> |
| 138 | + <amOnPage url="{{StorefrontHomePage.url}}" stepKey="goToStoreFrontHomePage"/> |
| 139 | + <waitForPageLoad stepKey="waitForHomePageLoad"/> |
| 140 | + <actionGroup ref="assertOneProductNameInMiniCart" stepKey="assertFirstProductInMiniCart"> |
| 141 | + <argument name="productName" value="$$createSimpleProduct.name$$"/> |
| 142 | + </actionGroup> |
| 143 | + <actionGroup ref="assertOneProductNameInMiniCart" stepKey="assertSecondProductInMiniCart"> |
| 144 | + <argument name="productName" value="$$createSimpleProductWithCustomOptions.name$$"/> |
| 145 | + </actionGroup> |
| 146 | + <actionGroup ref="AssertMiniShoppingCartSubTotalActionGroup" stepKey="assertMiniCartSubTotal"> |
| 147 | + <argument name="dataQuote" value="quoteQty2Subtotal266"/> |
| 148 | + </actionGroup> |
| 149 | + |
| 150 | + <!-- Logout first customer --> |
| 151 | + <actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="logoutFirstCustomer"/> |
| 152 | + |
| 153 | + <!-- Login as second customer --> |
| 154 | + <actionGroup ref="LoginToStorefrontActionGroup" stepKey="loginAsSecondCustomer"> |
| 155 | + <argument name="Customer" value="$$createSecondCustomer$$"/> |
| 156 | + </actionGroup> |
| 157 | + |
| 158 | + <!-- Assert first products present in shopping cart --> |
| 159 | + <amOnPage url="{{CheckoutCartPage.url}}" stepKey="amOnShoppingCartPage"/> |
| 160 | + <waitForPageLoad stepKey="waitForShoppingCartPageLoad"/> |
| 161 | + <actionGroup ref="StorefrontCheckCartSimpleProductActionGroup" stepKey="checkProductInCart"> |
| 162 | + <argument name="product" value="$$createSimpleProduct$$"/> |
| 163 | + <argument name="productQuantity" value="quoteQty2Price123.qty"/> |
| 164 | + </actionGroup> |
| 165 | + |
| 166 | + <!-- Assert subtotal and grand total --> |
| 167 | + <see selector="{{StorefrontProductPageSection.subTotal}}" userInput="{{quoteQty2Price123.currency}}{{quoteQty2Price123.subtotal}}" stepKey="seeSecondCustomerSubTotal"/> |
| 168 | + <see selector="{{StorefrontProductPageSection.orderTotal}}" userInput="{{quoteQty2Price123.currency}}{{quoteQty2Price123.total}}" stepKey="seeSecondCustomerOrderTotal"/> |
| 169 | + |
| 170 | + <!-- Assert product in mini cart --> |
| 171 | + <amOnPage url="{{StorefrontHomePage.url}}" stepKey="goToHomePage"/> |
| 172 | + <waitForPageLoad stepKey="waitForHomePageToLoad"/> |
| 173 | + <click selector="{{StorefrontMinicartSection.showCart}}" stepKey="clickOnMiniCart"/> |
| 174 | + <waitForPageLoad stepKey="waitForPageToLoad"/> |
| 175 | + <actionGroup ref="AssertStorefrontMiniCartItemsActionGroup" stepKey="assertProductInMiniCart"> |
| 176 | + <argument name="productName" value="$$createSimpleProduct.name$$"/> |
| 177 | + <argument name="productPrice" value="$$createSimpleProduct.price$$"/> |
| 178 | + <argument name="cartSubtotal" value="{{quoteQty2Price123.currency}}{{quoteQty2Price123.subtotal}}"/> |
| 179 | + <argument name="qty" value="{{quoteQty2Price123.qty}}"/> |
| 180 | + </actionGroup> |
| 181 | + |
| 182 | + <!-- Logout second customer --> |
| 183 | + <actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="logoutSecondCustomer"/> |
| 184 | + </test> |
| 185 | +</tests> |
0 commit comments