Skip to content

Commit

Permalink
Merge pull request #125 from magento-pangolin/MC-4770
Browse files Browse the repository at this point in the history
MC-4770
  • Loading branch information
soumyau committed Jun 10, 2019
2 parents 9336220 + 75fc8fa commit d7d29cf
Show file tree
Hide file tree
Showing 7 changed files with 256 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
<section name="AdminEditCustomerOrdersSection">
<element name="orderGrid" type="text" selector="#customer_orders_grid_table"/>
<element name="orderIdInGrid" type="text" selector="//td[contains(., '{{orderId}}')]" parameterized="true"/>
</section>
</sections>
15 changes: 10 additions & 5 deletions app/code/Magento/Sales/Test/Mftf/Data/OrderData.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
<data key="shipping">10.00</data>
<data key="grandTotal">256.00</data>
</entity>
<entity name="AdminOrderSimpleProductWithCatalogRule" type="order">
<data key="subtotal">110.70</data>
<data key="shipping">5.00</data>
<data key="grandTotal">115.70</data>
</entity>
<entity name="AdminOrderSimpleProduct" type="order">
<data key="subtotal">123.00</data>
<data key="shipping">5.00</data>
Expand All @@ -23,12 +28,11 @@
<data key="from">200</data>
<data key="to">400</data>
</entity>
<entity name="AdminOrderSimpleProductWithCatalogRule" type="order">
<data key="subtotal">110.70</data>
<data key="shipping">5.00</data>
<data key="grandTotal">115.70</data>
<entity name="AdminOrderMultipleProducts" type="order">
<data key="subtotal">60.00</data>
<data key="shipping">0.00</data>
<data key="grandTotal">60.00</data>
</entity>

<entity name="OrderStatus" type="status">
<data key="canceled">Canceled</data>
<data key="closed">Closed</data>
Expand All @@ -39,5 +43,6 @@
<data key="pending">Pending</data>
<data key="pendingPayment">Pending Payment</data>
<data key="processing">Processing</data>
<data key="ordered">Ordered</data>
</entity>
</entities>
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
<section name="AdminCreateOrderShoppingCartSection">
<element name="shoppingCartBlock" type="text" selector="#sidebar_data_cart"/>
<element name="addToOrderCheckBox" type="checkbox" selector="//div[@id='order-sidebar_cart']//tr[td[.='{{productName}}']]//input[contains(@name,'sidebar[add_cart_item]')]" parameterized="true" timeout="30"/>
</section>
</sections>
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
<section name="AdminCreateOrderWishListSection">
<element name="wishListBlock" type="text" selector="#sidebar_data_wishlist"/>
<element name="addProductToOrderCheckBox" type="checkbox" selector="//div[@id='order-sidebar_wishlist']//tr[td[.='{{productName}}']]//input[contains(@name,'sidebar[add_wishlist_item]')]" parameterized="true" timeout="30"/>
<element name="addConfigProductToOrder" type="text" selector="//div[@id='order-sidebar_wishlist']//tr[td[contains(.,'{{configProductName}}')]]//a[contains(@class, 'icon-configure')]" parameterized="true" timeout="30"/>
</section>
</sections>
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@
<element name="itemsOrderedSummaryText" type="textarea" selector="//table[@class='data-table admin__table-primary order-tables']/tfoot/tr"/>
<element name="configureSelectAttribute" type="select" selector="select[id*=attribute]"/>
<element name="itemsSKU" type="text" selector="(//div[contains(@class, 'product-sku-block')])[{{productNumber}}]" parameterized="true"/>
<element name="moveProduct" type="select" selector="//td[contains(.,'{{productName}}')]/../..//td//select" parameterized="true"/>
</section>
</sections>
Original file line number Diff line number Diff line change
@@ -0,0 +1,212 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
<test name="CreateOrderFromEditCustomerPageTest">
<annotations>
<group value="Sales"/>
<stories value="Create Order"/>
<title value="Create order from edit customer page and add products to wish list and shopping cart"/>
<description value="Create an order from edit customer page and add products to the wish list and shopping cart "/>
<severity value="CRITICAL"/>
<testCaseId value="MC-16161"/>
<group value="mtf_migrated"/>
<group value="banana"/>
</annotations>

<before>
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
<createData entity="FreeShippingMethodsSettingConfig" stepKey="freeShippingMethodsSettingConfig"/>

<!--Create simple customer-->
<createData entity="Simple_US_Customer_CA" stepKey="simpleCustomer"/>

<!-- Create Simple Product -->
<createData entity="SimpleProduct2" stepKey="simpleProduct">
<field key="price">10.00</field>
</createData>
<createData entity="SimpleProduct2" stepKey="simpleProduct1">
<field key="price">20.00</field>
</createData>

<!-- Create configurable product and add it to the category -->
<createData entity="ApiCategory" stepKey="createCategory"/>
<createData entity="ApiConfigurableProduct" stepKey="createConfigProduct">
<requiredEntity createDataKey="createCategory"/>
</createData>

<!-- Create an attribute with two options to be used in the first child product -->
<createData entity="productAttributeWithTwoOptions" stepKey="createConfigProductAttribute"/>
<createData entity="productAttributeOption1" stepKey="createConfigProductAttributeOption1">
<requiredEntity createDataKey="createConfigProductAttribute"/>
</createData>

<!-- Add the attribute we just created to default attribute set -->
<createData entity="AddToDefaultSet" stepKey="createConfigAddToAttributeSet">
<requiredEntity createDataKey="createConfigProductAttribute"/>
</createData>

<!-- Get the option of the attribute we created -->
<getData entity="ProductAttributeOptionGetter" index="1" stepKey="getConfigAttributeOption1">
<requiredEntity createDataKey="createConfigProductAttribute"/>
</getData>

<!-- Create a simple product and give it the attribute with option -->
<createData entity="ApiSimpleOne" stepKey="createConfigChildProduct1">
<requiredEntity createDataKey="createConfigProductAttribute"/>
<requiredEntity createDataKey="getConfigAttributeOption1"/>
<field key="price">30.00</field>
</createData>

<!-- Create the configurable product -->
<createData entity="ConfigurableProductTwoOptions" stepKey="createConfigProductOption">
<requiredEntity createDataKey="createConfigProduct"/>
<requiredEntity createDataKey="createConfigProductAttribute"/>
<requiredEntity createDataKey="getConfigAttributeOption1"/>
</createData>

<!-- Add simple product to the configurable product -->
<createData entity="ConfigurableProductAddChild" stepKey="createConfigProductAddChild1">
<requiredEntity createDataKey="createConfigProduct"/>
<requiredEntity createDataKey="createConfigChildProduct1"/>
</createData>
<magentoCLI command="indexer:reindex" stepKey="reindex"/>
<magentoCLI command="cache:flush" stepKey="flushCache"/>
</before>
<after>
<createData entity="DisableFreeShippingConfig" stepKey="disableFreeShippingConfig"/>
<deleteData createDataKey="simpleCustomer" stepKey="deleteSimpleCustomer"/>
<deleteData createDataKey="simpleProduct" stepKey="deleteSimpleProduct"/>
<deleteData createDataKey="simpleProduct1" stepKey="deleteSimpleProduct1"/>
<deleteData createDataKey="createConfigChildProduct1" stepKey="deleteConfigChildProduct"/>
<deleteData createDataKey="createConfigProduct" stepKey="deleteConfigurableProduct"/>
<deleteData createDataKey="createConfigProductAttribute" stepKey="deleteProductAttribute"/>
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
<actionGroup ref="logout" stepKey="logout"/>
</after>

<!--Filter and Open the customer edit page -->
<actionGroup ref="AdminFilterCustomerByEmail" stepKey="filterTheCustomer">
<argument name="email" value="$$simpleCustomer.email$$"/>
</actionGroup>
<click selector="{{AdminCustomerGridSection.customerEditLinkByEmail($$simpleCustomer.email$$)}}" stepKey="clickOnEditButton"/>
<waitForPageLoad stepKey="waitForCustomerEditPageToLoad"/>
<click selector="{{AdminCustomerMainActionsSection.createOrderBtn}}" stepKey="clickOnCreateOrderButton"/>
<waitForPageLoad stepKey="waitForOrderPageToLoad"/>

<!--Add configurable product to order-->
<actionGroup ref="addConfigurableProductToOrderFromAdmin" stepKey="addConfigurableProductToOrder">
<argument name="product" value="$$createConfigProduct$$"/>
<argument name="attribute" value="$$createConfigProductAttribute$$"/>
<argument name="option" value="$$getConfigAttributeOption1$$"/>
</actionGroup>

<!--Add Simple product to order-->
<actionGroup ref="addSimpleProductToOrder" stepKey="addSimpleProductToOrder">
<argument name="product" value="$$simpleProduct$$"/>
</actionGroup>

<!--Add Second Simple product to order-->
<actionGroup ref="addSimpleProductToOrder" stepKey="addSecondSimpleProductToOrder">
<argument name="product" value="$$simpleProduct1$$"/>
</actionGroup>

<!-- Move Products to the WishList -->
<selectOption selector="{{AdminOrderFormItemsOrderedSection.moveProduct($$simpleProduct.name$$)}}" userInput="Move to Wish List" stepKey="moveProductToWishList"/>
<selectOption selector="{{AdminOrderFormItemsOrderedSection.moveProduct($$createConfigProduct.name$$)}}" userInput="Move to Wish List" stepKey="moveConfigurableProductToWishList"/>
<click selector="{{OrdersGridSection.update}}" stepKey="clickOnUpdateItemsAndQuantity"/>
<waitForPageLoad stepKey="waitForAdminCreateOrderWishListSectionPageLoad"/>

<!-- Assert products in Wish List section -->
<see selector="{{AdminCreateOrderWishListSection.wishListBlock}}" userInput="$$simpleProduct.name$$" stepKey="seeSimpleProductInWishList"/>
<see selector="{{AdminCreateOrderWishListSection.wishListBlock}}" userInput="$$createConfigProduct.name$$" stepKey="seeConfigurableProductInWishList"/>

<!-- Add products to order from Wish List -->
<waitForElementVisible selector="{{AdminCreateOrderWishListSection.addProductToOrderCheckBox($$simpleProduct.name$$)}}" stepKey="waitForCheckBoxToVisible"/>
<click selector="{{AdminCreateOrderWishListSection.addProductToOrderCheckBox($$simpleProduct.name$$)}}" stepKey="selectProductToAddToOrder"/>
<click selector="{{AdminCreateOrderWishListSection.addConfigProductToOrder($$createConfigProduct.name$$)}}" stepKey="AddConfigurableProductToOrder"/>
<waitForElementVisible selector="{{AdminOrderFormConfigureProductSection.optionSelect($$createConfigProductAttribute.default_frontend_label$$)}}" stepKey="waitForConfigurablePopover"/>
<selectOption selector="{{AdminOrderFormConfigureProductSection.optionSelect($$createConfigProductAttribute.default_frontend_label$$)}}" userInput="$$getConfigAttributeOption1.label$$" stepKey="selectConfigurableOption"/>
<click selector="{{AdminOrderFormConfigureProductSection.ok}}" stepKey="clickOkButton"/>
<click selector="{{AdminCustomerCreateNewOrderSection.updateChangesBtn}}" stepKey="clickOnUpdateButton"/>
<waitForPageLoad stepKey="waitForAdminOrderItemsOrderedSectionPageLoad1"/>

<!-- Assert Products in Order item section -->
<see selector="{{AdminOrderItemsOrderedSection.productName}}" userInput="$$simpleProduct.name$$" stepKey="seeSimpleProductInOrderItemGrid"/>
<see selector="{{AdminOrderItemsOrderedSection.productName}}" userInput="$$createConfigProduct.name$$" stepKey="seeConfigProductInOrderItemGrid"/>

<!-- Move Products to the Shopping Cart -->
<selectOption selector="{{AdminOrderFormItemsOrderedSection.moveProduct($$simpleProduct.name$$)}}" userInput="Move to Shopping Cart" stepKey="moveFirstSimpleProductToShoppingCart"/>
<selectOption selector="{{AdminOrderFormItemsOrderedSection.moveProduct($$simpleProduct1.name$$)}}" userInput="Move to Shopping Cart" stepKey="moveSecondSimpleProductToShoppingCart"/>
<click selector="{{OrdersGridSection.update}}" stepKey="clickOnUpdateItems"/>
<waitForPageLoad stepKey="waitForAdminCreateOrderShoppingCartSectionPageLoad"/>

<!-- Assert products in Shopping cart section -->
<see selector="{{AdminCreateOrderShoppingCartSection.shoppingCartBlock}}" userInput="$$simpleProduct.name$$" stepKey="seeProductInShoppingCart"/>
<see selector="{{AdminCreateOrderShoppingCartSection.shoppingCartBlock}}" userInput="$$simpleProduct1.name$$" stepKey="seeSecondProductInShoppingCart"/>

<!-- Move products to the order from shopping cart -->
<waitForElementVisible selector="{{AdminCreateOrderShoppingCartSection.addToOrderCheckBox($$simpleProduct.name$$)}}" stepKey="waitForAddToOrderCheckBox"/>
<click selector="{{AdminCreateOrderShoppingCartSection.addToOrderCheckBox($$simpleProduct.name$$)}}" stepKey="selectFirstProduct"/>
<click selector="{{AdminCreateOrderShoppingCartSection.addToOrderCheckBox($$simpleProduct1.name$$)}}" stepKey="selectSecondProduct"/>
<click selector="{{AdminCustomerCreateNewOrderSection.updateChangesBtn}}" stepKey="clickOnUpdateButton1"/>
<waitForPageLoad stepKey="waitForAdminCreateOrderShoppingCartSectionPageLoad1"/>

<!-- After move, assert products are not present in Shopping cart section -->
<dontSee selector="{{AdminCreateOrderShoppingCartSection.shoppingCartBlock}}" userInput="$$simpleProduct.name$$" stepKey="donSeeProductInShoppingCart"/>
<dontSee selector="{{AdminCreateOrderShoppingCartSection.shoppingCartBlock}}" userInput="$$simpleProduct1.name$$" stepKey="dontSeeSecondProductInShoppingCart"/>

<!-- After move, assert products are present in Wish List section -->
<see selector="{{AdminCreateOrderWishListSection.wishListBlock}}" userInput="$$simpleProduct.name$$" stepKey="seeSimpleProductInWishList1"/>
<see selector="{{AdminCreateOrderWishListSection.wishListBlock}}" userInput="$$createConfigProduct.name$$" stepKey="seeConfigurableProductInWishList1"/>

<!-- After move, assert products are present in order items section -->
<see selector="{{AdminOrderItemsOrderedSection.productName}}" userInput="$$simpleProduct.name$$" stepKey="seeSimpleProductInOrderItemGrid1"/>
<see selector="{{AdminOrderItemsOrderedSection.productName}}" userInput="$$createConfigProduct.name$$" stepKey="seeConfigProductInOrderItemGrid1"/>
<see selector="{{AdminOrderItemsOrderedSection.productName}}" userInput="$$simpleProduct1.name$$" stepKey="seeSecondProductInOrderItemGrid1"/>

<!-- Select Free Shipping -->
<waitForElementVisible selector="{{AdminInvoicePaymentShippingSection.getShippingMethodAndRates}}" stepKey="waitForShippingSection"/>
<click selector="{{AdminInvoicePaymentShippingSection.getShippingMethodAndRates}}" stepKey="openShippingMethod"/>
<waitForPageLoad stepKey="waitForShippingMethods"/>
<click selector="{{AdminOrderFormPaymentSection.freeShippingOption}}" stepKey="chooseShippingMethod"/>
<waitForPageLoad stepKey="waitForPageToLoad"/>

<!-- Submit order -->
<click selector="{{AdminOrderFormActionSection.SubmitOrder}}" stepKey="submitOrder"/>
<waitForPageLoad stepKey="waitForAdminOrderFormLoad"/>

<!-- Verify order information -->
<actionGroup ref="verifyCreatedOrderInformation" stepKey="verifyCreatedOrderInformation"/>
<grabTextFrom selector="|Order # (\d+)|" stepKey="orderId"/>

<!-- Filter and Open the customer edit page -->
<actionGroup ref="AdminFilterCustomerByEmail" stepKey="filterTheCustomer1">
<argument name="email" value="$$simpleCustomer.email$$"/>
</actionGroup>
<click selector="{{AdminCustomerGridSection.customerEditLinkByEmail($$simpleCustomer.email$$)}}" stepKey="clickOnEditButton1"/>
<waitForPageLoad stepKey="waitForCustomerEditPageToLoad1"/>
<click selector="{{AdminEditCustomerInformationSection.orders}}" stepKey="clickOnOrdersButton"/>
<waitForPageLoad stepKey="waitForOrderPageToOpen"/>
<click selector="{{AdminEditCustomerOrdersSection.orderIdInGrid('$orderId')}}" stepKey="selectOnOrderID"/>

<!-- Assert ordered product in customer order section-->
<waitForPageLoad stepKey="waitForOrderInformationToLoad"/>
<see selector="{{AdminOrderItemsOrderedSection.productNameColumn}}" userInput="$createConfigProduct.name$" stepKey="seeConfigurableProductInGrid"/>
<see selector="{{AdminOrderItemsOrderedSection.productNameColumn}}" userInput="$simpleProduct.name$" stepKey="seeFirstProductInGrid"/>
<see selector="{{AdminOrderItemsOrderedSection.productNameColumn}}" userInput="$simpleProduct1.name$" stepKey="seeSecondProductInGrid"/>
<see selector="{{AdminOrderItemsOrderedSection.statusColumn}}" userInput="{{OrderStatus.ordered}}" stepKey="seeProductStatus"/>
<see selector="{{AdminOrderItemsOrderedSection.subtotalColumn}}" userInput="$createConfigChildProduct1.price$" stepKey="seeConfigurableProductSubtotal"/>
<see selector="{{AdminOrderItemsOrderedSection.subtotalColumn}}" userInput="$simpleProduct.price$" stepKey="seeFirstProductSubtotal"/>
<see selector="{{AdminOrderItemsOrderedSection.subtotalColumn}}" userInput="$simpleProduct1.price$" stepKey="seeSecondProductSubtotal"/>
<see selector="{{AdminOrderTotalSection.subTotal}}" userInput="{{AdminOrderMultipleProducts.subtotal}}" stepKey="checkSubtotal" />
<see selector="{{AdminOrderTotalSection.shippingAndHandling}}" userInput="{{AdminOrderMultipleProducts.shipping}}" stepKey="checkShippingAndHandling" />
<see selector="{{AdminOrderTotalSection.grandTotal}}" userInput="{{AdminOrderMultipleProducts.grandTotal}}" stepKey="checkGrandTotal" />
</test>
</tests>
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<item name="grandTotal" xsi:type="string">19.00</item>
</data>
<data name="issue" xsi:type="string">MAGETWO-65165: Unable to add product to wish list using 'create order' interface</data>
<data name="tag" xsi:type="string">to_maintain:yes, mftf_migrated:yes</data>
<constraint name="Magento\Sales\Test\Constraint\AssertOrderSuccessCreateMessage" />
<constraint name="Magento\Sales\Test\Constraint\AssertOrderGrandTotal" />
<constraint name="Magento\Sales\Test\Constraint\AssertProductInCustomerShoppingCartOnBackendGrid" />
Expand Down

0 comments on commit d7d29cf

Please sign in to comment.