|
| 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="CreateOrderFromEditCustomerPageTest"> |
| 12 | + <annotations> |
| 13 | + <group value="Sales"/> |
| 14 | + <stories value="Create Order"/> |
| 15 | + <title value="Create order from edit customer page and add products to wish list and shopping cart"/> |
| 16 | + <description value="Create an order from edit customer page and add products to the wish list and shopping cart "/> |
| 17 | + <severity value="CRITICAL"/> |
| 18 | + <testCaseId value="MC-16161"/> |
| 19 | + <group value="mtf_migrated"/> |
| 20 | + <group value="banana"/> |
| 21 | + </annotations> |
| 22 | + |
| 23 | + <before> |
| 24 | + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> |
| 25 | + <createData entity="FreeShippingMethodsSettingConfig" stepKey="freeShippingMethodsSettingConfig"/> |
| 26 | + |
| 27 | + <!--Create simple customer--> |
| 28 | + <createData entity="Simple_US_Customer_CA" stepKey="simpleCustomer"/> |
| 29 | + |
| 30 | + <!-- Create Simple Product --> |
| 31 | + <createData entity="SimpleProduct2" stepKey="simpleProduct"> |
| 32 | + <field key="price">10.00</field> |
| 33 | + </createData> |
| 34 | + <createData entity="SimpleProduct2" stepKey="simpleProduct1"> |
| 35 | + <field key="price">20.00</field> |
| 36 | + </createData> |
| 37 | + |
| 38 | + <!-- Create configurable product and add it to the category --> |
| 39 | + <createData entity="ApiCategory" stepKey="createCategory"/> |
| 40 | + <createData entity="ApiConfigurableProduct" stepKey="createConfigProduct"> |
| 41 | + <requiredEntity createDataKey="createCategory"/> |
| 42 | + </createData> |
| 43 | + |
| 44 | + <!-- Create an attribute with two options to be used in the first child product --> |
| 45 | + <createData entity="productAttributeWithTwoOptions" stepKey="createConfigProductAttribute"/> |
| 46 | + <createData entity="productAttributeOption1" stepKey="createConfigProductAttributeOption1"> |
| 47 | + <requiredEntity createDataKey="createConfigProductAttribute"/> |
| 48 | + </createData> |
| 49 | + |
| 50 | + <!-- Add the attribute we just created to default attribute set --> |
| 51 | + <createData entity="AddToDefaultSet" stepKey="createConfigAddToAttributeSet"> |
| 52 | + <requiredEntity createDataKey="createConfigProductAttribute"/> |
| 53 | + </createData> |
| 54 | + |
| 55 | + <!-- Get the option of the attribute we created --> |
| 56 | + <getData entity="ProductAttributeOptionGetter" index="1" stepKey="getConfigAttributeOption1"> |
| 57 | + <requiredEntity createDataKey="createConfigProductAttribute"/> |
| 58 | + </getData> |
| 59 | + |
| 60 | + <!-- Create a simple product and give it the attribute with option --> |
| 61 | + <createData entity="ApiSimpleOne" stepKey="createConfigChildProduct1"> |
| 62 | + <requiredEntity createDataKey="createConfigProductAttribute"/> |
| 63 | + <requiredEntity createDataKey="getConfigAttributeOption1"/> |
| 64 | + <field key="price">30.00</field> |
| 65 | + </createData> |
| 66 | + |
| 67 | + <!-- Create the configurable product --> |
| 68 | + <createData entity="ConfigurableProductTwoOptions" stepKey="createConfigProductOption"> |
| 69 | + <requiredEntity createDataKey="createConfigProduct"/> |
| 70 | + <requiredEntity createDataKey="createConfigProductAttribute"/> |
| 71 | + <requiredEntity createDataKey="getConfigAttributeOption1"/> |
| 72 | + </createData> |
| 73 | + |
| 74 | + <!-- Add simple product to the configurable product --> |
| 75 | + <createData entity="ConfigurableProductAddChild" stepKey="createConfigProductAddChild1"> |
| 76 | + <requiredEntity createDataKey="createConfigProduct"/> |
| 77 | + <requiredEntity createDataKey="createConfigChildProduct1"/> |
| 78 | + </createData> |
| 79 | + <magentoCLI command="indexer:reindex" stepKey="reindex"/> |
| 80 | + <magentoCLI command="cache:flush" stepKey="flushCache"/> |
| 81 | + </before> |
| 82 | + <after> |
| 83 | + <createData entity="DisableFreeShippingConfig" stepKey="disableFreeShippingConfig"/> |
| 84 | + <deleteData createDataKey="simpleCustomer" stepKey="deleteSimpleCustomer"/> |
| 85 | + <deleteData createDataKey="simpleProduct" stepKey="deleteSimpleProduct"/> |
| 86 | + <deleteData createDataKey="simpleProduct1" stepKey="deleteSimpleProduct1"/> |
| 87 | + <deleteData createDataKey="createConfigChildProduct1" stepKey="deleteConfigChildProduct"/> |
| 88 | + <deleteData createDataKey="createConfigProduct" stepKey="deleteConfigurableProduct"/> |
| 89 | + <deleteData createDataKey="createConfigProductAttribute" stepKey="deleteProductAttribute"/> |
| 90 | + <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> |
| 91 | + <actionGroup ref="logout" stepKey="logout"/> |
| 92 | + </after> |
| 93 | + |
| 94 | + <!--Filter and Open the customer edit page --> |
| 95 | + <actionGroup ref="AdminFilterCustomerByEmail" stepKey="filterTheCustomer"> |
| 96 | + <argument name="email" value="$$simpleCustomer.email$$"/> |
| 97 | + </actionGroup> |
| 98 | + <click selector="{{AdminCustomerGridSection.customerEditLinkByEmail($$simpleCustomer.email$$)}}" stepKey="clickOnEditButton"/> |
| 99 | + <waitForPageLoad stepKey="waitForCustomerEditPageToLoad"/> |
| 100 | + <click selector="{{AdminCustomerMainActionsSection.createOrderBtn}}" stepKey="clickOnCreateOrderButton"/> |
| 101 | + <waitForPageLoad stepKey="waitForOrderPageToLoad"/> |
| 102 | + |
| 103 | + <!--Add configurable product to order--> |
| 104 | + <actionGroup ref="addConfigurableProductToOrderFromAdmin" stepKey="addConfigurableProductToOrder"> |
| 105 | + <argument name="product" value="$$createConfigProduct$$"/> |
| 106 | + <argument name="attribute" value="$$createConfigProductAttribute$$"/> |
| 107 | + <argument name="option" value="$$getConfigAttributeOption1$$"/> |
| 108 | + </actionGroup> |
| 109 | + |
| 110 | + <!--Add Simple product to order--> |
| 111 | + <actionGroup ref="addSimpleProductToOrder" stepKey="addSimpleProductToOrder"> |
| 112 | + <argument name="product" value="$$simpleProduct$$"/> |
| 113 | + </actionGroup> |
| 114 | + |
| 115 | + <!--Add Second Simple product to order--> |
| 116 | + <actionGroup ref="addSimpleProductToOrder" stepKey="addSecondSimpleProductToOrder"> |
| 117 | + <argument name="product" value="$$simpleProduct1$$"/> |
| 118 | + </actionGroup> |
| 119 | + |
| 120 | + <!-- Move Products to the WishList --> |
| 121 | + <selectOption selector="{{AdminOrderFormItemsOrderedSection.moveProduct($$simpleProduct.name$$)}}" userInput="Move to Wish List" stepKey="moveProductToWishList"/> |
| 122 | + <selectOption selector="{{AdminOrderFormItemsOrderedSection.moveProduct($$createConfigProduct.name$$)}}" userInput="Move to Wish List" stepKey="moveConfigurableProductToWishList"/> |
| 123 | + <click selector="{{OrdersGridSection.update}}" stepKey="clickOnUpdateItemsAndQuantity"/> |
| 124 | + <waitForPageLoad stepKey="waitForAdminCreateOrderWishListSectionPageLoad"/> |
| 125 | + |
| 126 | + <!-- Assert products in Wish List section --> |
| 127 | + <see selector="{{AdminCreateOrderWishListSection.wishListBlock}}" userInput="$$simpleProduct.name$$" stepKey="seeSimpleProductInWishList"/> |
| 128 | + <see selector="{{AdminCreateOrderWishListSection.wishListBlock}}" userInput="$$createConfigProduct.name$$" stepKey="seeConfigurableProductInWishList"/> |
| 129 | + |
| 130 | + <!-- Add products to order from Wish List --> |
| 131 | + <waitForElementVisible selector="{{AdminCreateOrderWishListSection.addProductToOrderCheckBox($$simpleProduct.name$$)}}" stepKey="waitForCheckBoxToVisible"/> |
| 132 | + <click selector="{{AdminCreateOrderWishListSection.addProductToOrderCheckBox($$simpleProduct.name$$)}}" stepKey="selectProductToAddToOrder"/> |
| 133 | + <click selector="{{AdminCreateOrderWishListSection.addConfigProductToOrder($$createConfigProduct.name$$)}}" stepKey="AddConfigurableProductToOrder"/> |
| 134 | + <waitForElementVisible selector="{{AdminOrderFormConfigureProductSection.optionSelect($$createConfigProductAttribute.default_frontend_label$$)}}" stepKey="waitForConfigurablePopover"/> |
| 135 | + <selectOption selector="{{AdminOrderFormConfigureProductSection.optionSelect($$createConfigProductAttribute.default_frontend_label$$)}}" userInput="$$getConfigAttributeOption1.label$$" stepKey="selectConfigurableOption"/> |
| 136 | + <click selector="{{AdminOrderFormConfigureProductSection.ok}}" stepKey="clickOkButton"/> |
| 137 | + <click selector="{{AdminCustomerCreateNewOrderSection.updateChangesBtn}}" stepKey="clickOnUpdateButton"/> |
| 138 | + <waitForPageLoad stepKey="waitForAdminOrderItemsOrderedSectionPageLoad1"/> |
| 139 | + |
| 140 | + <!-- Assert Products in Order item section --> |
| 141 | + <see selector="{{AdminOrderItemsOrderedSection.productName}}" userInput="$$simpleProduct.name$$" stepKey="seeSimpleProductInOrderItemGrid"/> |
| 142 | + <see selector="{{AdminOrderItemsOrderedSection.productName}}" userInput="$$createConfigProduct.name$$" stepKey="seeConfigProductInOrderItemGrid"/> |
| 143 | + |
| 144 | + <!-- Move Products to the Shopping Cart --> |
| 145 | + <selectOption selector="{{AdminOrderFormItemsOrderedSection.moveProduct($$simpleProduct.name$$)}}" userInput="Move to Shopping Cart" stepKey="moveFirstSimpleProductToShoppingCart"/> |
| 146 | + <selectOption selector="{{AdminOrderFormItemsOrderedSection.moveProduct($$simpleProduct1.name$$)}}" userInput="Move to Shopping Cart" stepKey="moveSecondSimpleProductToShoppingCart"/> |
| 147 | + <click selector="{{OrdersGridSection.update}}" stepKey="clickOnUpdateItems"/> |
| 148 | + <waitForPageLoad stepKey="waitForAdminCreateOrderShoppingCartSectionPageLoad"/> |
| 149 | + |
| 150 | + <!-- Assert products in Shopping cart section --> |
| 151 | + <see selector="{{AdminCreateOrderShoppingCartSection.shoppingCartBlock}}" userInput="$$simpleProduct.name$$" stepKey="seeProductInShoppingCart"/> |
| 152 | + <see selector="{{AdminCreateOrderShoppingCartSection.shoppingCartBlock}}" userInput="$$simpleProduct1.name$$" stepKey="seeSecondProductInShoppingCart"/> |
| 153 | + |
| 154 | + <!-- Move products to the order from shopping cart --> |
| 155 | + <waitForElementVisible selector="{{AdminCreateOrderShoppingCartSection.addToOrderCheckBox($$simpleProduct.name$$)}}" stepKey="waitForAddToOrderCheckBox"/> |
| 156 | + <click selector="{{AdminCreateOrderShoppingCartSection.addToOrderCheckBox($$simpleProduct.name$$)}}" stepKey="selectFirstProduct"/> |
| 157 | + <click selector="{{AdminCreateOrderShoppingCartSection.addToOrderCheckBox($$simpleProduct1.name$$)}}" stepKey="selectSecondProduct"/> |
| 158 | + <click selector="{{AdminCustomerCreateNewOrderSection.updateChangesBtn}}" stepKey="clickOnUpdateButton1"/> |
| 159 | + <waitForPageLoad stepKey="waitForAdminCreateOrderShoppingCartSectionPageLoad1"/> |
| 160 | + |
| 161 | + <!-- After move, assert products are not present in Shopping cart section --> |
| 162 | + <dontSee selector="{{AdminCreateOrderShoppingCartSection.shoppingCartBlock}}" userInput="$$simpleProduct.name$$" stepKey="donSeeProductInShoppingCart"/> |
| 163 | + <dontSee selector="{{AdminCreateOrderShoppingCartSection.shoppingCartBlock}}" userInput="$$simpleProduct1.name$$" stepKey="dontSeeSecondProductInShoppingCart"/> |
| 164 | + |
| 165 | + <!-- After move, assert products are present in Wish List section --> |
| 166 | + <see selector="{{AdminCreateOrderWishListSection.wishListBlock}}" userInput="$$simpleProduct.name$$" stepKey="seeSimpleProductInWishList1"/> |
| 167 | + <see selector="{{AdminCreateOrderWishListSection.wishListBlock}}" userInput="$$createConfigProduct.name$$" stepKey="seeConfigurableProductInWishList1"/> |
| 168 | + |
| 169 | + <!-- After move, assert products are present in order items section --> |
| 170 | + <see selector="{{AdminOrderItemsOrderedSection.productName}}" userInput="$$simpleProduct.name$$" stepKey="seeSimpleProductInOrderItemGrid1"/> |
| 171 | + <see selector="{{AdminOrderItemsOrderedSection.productName}}" userInput="$$createConfigProduct.name$$" stepKey="seeConfigProductInOrderItemGrid1"/> |
| 172 | + <see selector="{{AdminOrderItemsOrderedSection.productName}}" userInput="$$simpleProduct1.name$$" stepKey="seeSecondProductInOrderItemGrid1"/> |
| 173 | + |
| 174 | + <!-- Select Free Shipping --> |
| 175 | + <waitForElementVisible selector="{{AdminInvoicePaymentShippingSection.getShippingMethodAndRates}}" stepKey="waitForShippingSection"/> |
| 176 | + <click selector="{{AdminInvoicePaymentShippingSection.getShippingMethodAndRates}}" stepKey="openShippingMethod"/> |
| 177 | + <waitForPageLoad stepKey="waitForShippingMethods"/> |
| 178 | + <click selector="{{AdminOrderFormPaymentSection.freeShippingOption}}" stepKey="chooseShippingMethod"/> |
| 179 | + <waitForPageLoad stepKey="waitForPageToLoad"/> |
| 180 | + |
| 181 | + <!-- Submit order --> |
| 182 | + <click selector="{{AdminOrderFormActionSection.SubmitOrder}}" stepKey="submitOrder"/> |
| 183 | + <waitForPageLoad stepKey="waitForAdminOrderFormLoad"/> |
| 184 | + |
| 185 | + <!-- Verify order information --> |
| 186 | + <actionGroup ref="verifyCreatedOrderInformation" stepKey="verifyCreatedOrderInformation"/> |
| 187 | + <grabTextFrom selector="|Order # (\d+)|" stepKey="orderId"/> |
| 188 | + |
| 189 | + <!-- Filter and Open the customer edit page --> |
| 190 | + <actionGroup ref="AdminFilterCustomerByEmail" stepKey="filterTheCustomer1"> |
| 191 | + <argument name="email" value="$$simpleCustomer.email$$"/> |
| 192 | + </actionGroup> |
| 193 | + <click selector="{{AdminCustomerGridSection.customerEditLinkByEmail($$simpleCustomer.email$$)}}" stepKey="clickOnEditButton1"/> |
| 194 | + <waitForPageLoad stepKey="waitForCustomerEditPageToLoad1"/> |
| 195 | + <click selector="{{AdminEditCustomerInformationSection.orders}}" stepKey="clickOnOrdersButton"/> |
| 196 | + <waitForPageLoad stepKey="waitForOrderPageToOpen"/> |
| 197 | + <click selector="{{AdminEditCustomerOrdersSection.orderIdInGrid('$orderId')}}" stepKey="selectOnOrderID"/> |
| 198 | + |
| 199 | + <!-- Assert ordered product in customer order section--> |
| 200 | + <waitForPageLoad stepKey="waitForOrderInformationToLoad"/> |
| 201 | + <see selector="{{AdminOrderItemsOrderedSection.productNameColumn}}" userInput="$createConfigProduct.name$" stepKey="seeConfigurableProductInGrid"/> |
| 202 | + <see selector="{{AdminOrderItemsOrderedSection.productNameColumn}}" userInput="$simpleProduct.name$" stepKey="seeFirstProductInGrid"/> |
| 203 | + <see selector="{{AdminOrderItemsOrderedSection.productNameColumn}}" userInput="$simpleProduct1.name$" stepKey="seeSecondProductInGrid"/> |
| 204 | + <see selector="{{AdminOrderItemsOrderedSection.statusColumn}}" userInput="{{OrderStatus.ordered}}" stepKey="seeProductStatus"/> |
| 205 | + <see selector="{{AdminOrderItemsOrderedSection.subtotalColumn}}" userInput="$createConfigChildProduct1.price$" stepKey="seeConfigurableProductSubtotal"/> |
| 206 | + <see selector="{{AdminOrderItemsOrderedSection.subtotalColumn}}" userInput="$simpleProduct.price$" stepKey="seeFirstProductSubtotal"/> |
| 207 | + <see selector="{{AdminOrderItemsOrderedSection.subtotalColumn}}" userInput="$simpleProduct1.price$" stepKey="seeSecondProductSubtotal"/> |
| 208 | + <see selector="{{AdminOrderTotalSection.subTotal}}" userInput="{{AdminOrderMultipleProducts.subtotal}}" stepKey="checkSubtotal" /> |
| 209 | + <see selector="{{AdminOrderTotalSection.shippingAndHandling}}" userInput="{{AdminOrderMultipleProducts.shipping}}" stepKey="checkShippingAndHandling" /> |
| 210 | + <see selector="{{AdminOrderTotalSection.grandTotal}}" userInput="{{AdminOrderMultipleProducts.grandTotal}}" stepKey="checkGrandTotal" /> |
| 211 | + </test> |
| 212 | +</tests> |
0 commit comments