Skip to content

Commit 5aff9fd

Browse files
committed
MC-4772: Convert HoldCreatedOrderTest to MFTF
1 parent d51d9d7 commit 5aff9fd

File tree

4 files changed

+116
-0
lines changed

4 files changed

+116
-0
lines changed

app/code/Magento/Customer/Test/Mftf/Section/StorefrontCustomerOrderViewSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,6 @@
1616
<element name="printOrderLink" type="text" selector="a.action.print" timeout="30"/>
1717
<element name="shippingAddress" type="text" selector=".box.box-order-shipping-address"/>
1818
<element name="billingAddress" type="text" selector=".box.box-order-billing-address"/>
19+
<element name="orderStatusInGrid" type="text" selector="//td[contains(.,'{{orderId}}')]/../td[contains(.,'{{status}}')]" parameterized="true"/>
1920
</section>
2021
</sections>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AdminSelectFlatRateShippingMethodActionGroup">
12+
<waitForPageLoad stepKey="waitForOrderPageToLoad"/>
13+
<click selector="{{AdminInvoicePaymentShippingSection.getShippingMethodAndRates}}" stepKey="openShippingMethod"/>
14+
<waitForPageLoad stepKey="waitForShippingMethods"/>
15+
<click selector="{{AdminInvoicePaymentShippingSection.shippingMethod}}" stepKey="chooseShippingMethod"/>
16+
<waitForPageLoad stepKey="waitForPageToLoad"/>
17+
</actionGroup>
18+
</actionGroups>

app/code/Magento/Sales/Test/Mftf/Section/AdminOrderDetailsMainActionsSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,6 @@
1919
<element name="reorder" type="button" selector="#order_reorder" timeout="30"/>
2020
<element name="edit" type="button" selector="#order_edit" timeout="30"/>
2121
<element name="modalOk" type="button" selector=".action-accept"/>
22+
<element name="unhold" type="button" selector="#order-view-unhold-button" timeout="30"/>
2223
</section>
2324
</sections>
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
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="AdminHoldCreatedOrderTest">
12+
<annotations>
13+
<group value="sales"/>
14+
<stories value="Hold Created Order"/>
15+
<title value="Hold the created order"/>
16+
<description value="Create an order and hold the order"/>
17+
<severity value="CRITICAL"/>
18+
<testCaseId value="MC-16160"/>
19+
<group value="mtf_migrated"/>
20+
</annotations>
21+
22+
<before>
23+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
24+
25+
<!--Set default flat rate shipping method settings-->
26+
<createData entity="FlatRateShippingMethodDefault" stepKey="setDefaultFlatRateShippingMethod"/>
27+
28+
<!--Create simple customer-->
29+
<createData entity="Simple_US_Customer_CA" stepKey="simpleCustomer"/>
30+
31+
<!-- Create Simple Products -->
32+
<createData entity="SimpleProduct2" stepKey="simpleProduct">
33+
<field key="price">10.00</field>
34+
</createData>
35+
<createData entity="SimpleProduct2" stepKey="simpleProduct1">
36+
<field key="price">20.00</field>
37+
</createData>
38+
</before>
39+
<after>
40+
<deleteData createDataKey="simpleCustomer" stepKey="deleteSimpleCustomer"/>
41+
<deleteData createDataKey="simpleProduct" stepKey="deleteSimpleProduct"/>
42+
<deleteData createDataKey="simpleProduct1" stepKey="deleteSimpleProduct1"/>
43+
<actionGroup ref="logout" stepKey="logout"/>
44+
</after>
45+
46+
<!--Create new customer order-->
47+
<actionGroup ref="navigateToNewOrderPageExistingCustomer" stepKey="navigateToNewOrderWithExistingCustomer">
48+
<argument name="customer" value="$$simpleCustomer$$"/>
49+
</actionGroup>
50+
51+
<!--Add Simple product to order-->
52+
<actionGroup ref="addSimpleProductToOrder" stepKey="addSimpleProductToTheOrder">
53+
<argument name="product" value="$$simpleProduct$$"/>
54+
</actionGroup>
55+
56+
<!--Add second product to order-->
57+
<actionGroup ref="addSimpleProductToOrder" stepKey="addSecondProductToTheOrder">
58+
<argument name="product" value="$$simpleProduct1$$"/>
59+
</actionGroup>
60+
61+
<!--Select FlatRate shipping method-->
62+
<actionGroup ref="AdminSelectFlatRateShippingMethodActionGroup" stepKey="selectFlatRateShippingMethod"/>
63+
64+
<!-- Submit order -->
65+
<click selector="{{AdminOrderFormActionSection.SubmitOrder}}" stepKey="submitOrder"/>
66+
67+
<!-- Verify order information -->
68+
<actionGroup ref="verifyCreatedOrderInformation" stepKey="verifyCreatedOrderInformation"/>
69+
<grabTextFrom selector="|Order # (\d+)|" stepKey="orderId"/>
70+
71+
<!-- Hold the Order -->
72+
<click selector="{{AdminOrderDetailsMainActionsSection.hold}}" stepKey="clickOnHoldButton"/>
73+
<see selector="{{AdminOrderDetailsMessagesSection.successMessage}}" userInput="You put the order on hold" stepKey="seeSuccessHoldMessage"/>
74+
75+
<!--Assert Order Status and Unhold button-->
76+
<see selector="{{AdminOrderDetailsInformationSection.orderStatus}}" userInput="On Hold" stepKey="seeOrderStatusOnHold"/>
77+
<seeElement selector="{{AdminOrderDetailsMainActionsSection.unhold}}" stepKey="seeUnholdButton"/>
78+
79+
<!--Assert invoice, cancel, reorder, ship, and edit buttons are unavailable-->
80+
<dontSeeElement selector="{{AdminOrderDetailsMainActionsSection.invoice}}" stepKey="dontSeeInvoiceButton"/>
81+
<dontSeeElement selector="{{AdminOrderDetailsMainActionsSection.cancel}}" stepKey="dontSeeCancelButton"/>
82+
<dontSeeElement selector="{{AdminOrderDetailsMainActionsSection.reorder}}" stepKey="dontSeeReorderButton"/>
83+
<dontSeeElement selector="{{AdminOrderDetailsMainActionsSection.ship}}" stepKey="dontSeeShipButton"/>
84+
<dontSeeElement selector="{{AdminOrderDetailsMainActionsSection.edit}}" stepKey="dontSeeEditButton"/>
85+
86+
<!--Log in to Storefront as Customer -->
87+
<actionGroup ref="LoginToStorefrontActionGroup" stepKey="signUp">
88+
<argument name="Customer" value="$$simpleCustomer$$"/>
89+
</actionGroup>
90+
91+
<!-- Assert OrderId and status in frontend order grid -->
92+
<click selector="{{StorefrontCustomerSidebarSection.sidebarCurrentTab('My Orders')}}" stepKey="clickOnMyOrders"/>
93+
<waitForPageLoad stepKey="waitForOrderDetailsToLoad"/>
94+
<seeElement selector="{{StorefrontCustomerOrderViewSection.orderStatusInGrid('$orderId', 'On Hold')}}" stepKey="seeOrderStatusInGrid"/>
95+
</test>
96+
</tests>

0 commit comments

Comments
 (0)