Skip to content

Commit 815ef76

Browse files
committed
refactored AdminOrdersReleaseInUnholdStatusTest
1 parent fadbf69 commit 815ef76

File tree

3 files changed

+60
-23
lines changed

3 files changed

+60
-23
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<!--
4+
/**
5+
* Copyright © Magento, Inc. All rights reserved.
6+
* See COPYING.txt for license details.
7+
*/
8+
-->
9+
10+
<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
11+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd">
12+
13+
<entity name="HoldOrder" type="HoldOrder">
14+
<var key="quote_id" entityKey="return" entityType="CustomerCart"/>
15+
</entity>
16+
17+
</entities>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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+
<operations xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataOperation.xsd">
11+
<operation name="CreateHoldOrder" dataType="HoldOrder" type="create" auth="adminOauth" url="V1/orders/{return}/hold" method="POST">
12+
<contentType>application/json</contentType>
13+
<object key="cartItem" dataType="CartItem">
14+
<field key="quote_id">string</field>
15+
</object>
16+
</operation>
17+
</operations>

app/code/Magento/Sales/Test/Mftf/Test/AdminOrdersReleaseInUnholdStatusTest.xml

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -21,53 +21,56 @@
2121
<before>
2222
<actionGroup ref="AdminLoginActionGroup" stepKey="LoginAsAdmin"/>
2323

24-
<!-- Create Data -->
2524
<createData entity="Simple_US_Customer" stepKey="createCustomer"/>
2625
<createData entity="_defaultCategory" stepKey="createCategory"/>
2726
<createData entity="defaultSimpleProduct" stepKey="createProduct">
2827
<requiredEntity createDataKey="createCategory"/>
2928
</createData>
29+
<createData entity="CustomerCart" stepKey="createCustomerCart">
30+
<requiredEntity createDataKey="createCustomer"/>
31+
</createData>
32+
<createData entity="CustomerCartItem" stepKey="addCartItemOne">
33+
<requiredEntity createDataKey="createCustomerCart"/>
34+
<requiredEntity createDataKey="createProduct"/>
35+
</createData>
36+
<createData entity="CustomerAddressInformation" stepKey="addCustomerOrderAddress">
37+
<requiredEntity createDataKey="createCustomerCart"/>
38+
</createData>
39+
<updateData createDataKey="createCustomerCart" entity="CustomerOrderPaymentMethod" stepKey="sendCustomerPaymentInformationOne">
40+
<requiredEntity createDataKey="createCustomerCart"/>
41+
</updateData>
42+
<createData entity="HoldOrder" stepKey="holdOrder">
43+
<requiredEntity createDataKey="createCustomerCart"/>
44+
</createData>
3045
</before>
3146
<after>
32-
<!-- Delete data -->
3347
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/>
3448
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
3549
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
3650
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
3751
</after>
3852

39-
<!-- Create order -->
40-
<actionGroup ref="CreateOrderActionGroup" stepKey="createFirstOrder">
41-
<argument name="product" value="$$createProduct$$"/>
42-
<argument name="customer" value="$$createCustomer$$"/>
43-
</actionGroup>
44-
<grabTextFrom selector="|Order # (\d+)|" stepKey="getOrderId"/>
45-
<assertNotEmpty stepKey="assertOrderIdIsNotEmpty" after="getOrderId">
46-
<actualResult type="const">$getOrderId</actualResult>
47-
</assertNotEmpty>
48-
49-
<!-- Hold Order -->
50-
<click selector="{{AdminOrderDetailsMainActionsSection.hold}}" stepKey="pushButtonHold"/>
51-
<waitForPageLoad stepKey="waitForHold"/>
52-
<see userInput="You put the order on hold." stepKey="seeHoldMessage"/>
53+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="createFirstOrder"/>
54+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="getOrderId"/>
55+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="assertOrderIdIsNotEmpty"/>
56+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="pushButtonHold"/>
57+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForHold"/>
58+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeHoldMessage"/>
5359

54-
<!-- Navigate to backend: Go to Sales > Orders -->
5560
<actionGroup ref="AdminOrdersPageOpenActionGroup" stepKey="onOrderPage"/>
5661
<actionGroup ref="AdminOrdersGridClearFiltersActionGroup" stepKey="clearFilters"/>
57-
58-
<!-- Select Mass Action according to dataset: Unhold -->
62+
<grabTextFrom selector="{{AdminOrdersGridSection.orderIdByIncrementId($createCustomerCart.return$)}}" stepKey="grabOrderId"/>
5963
<actionGroup ref="AdminOrderActionOnGridActionGroup" stepKey="actionUnold">
6064
<argument name="action" value="Unhold"/>
61-
<argument name="orderId" value="$getOrderId"/>
65+
<argument name="orderId" value="$grabOrderId"/>
6266
</actionGroup>
6367
<see userInput="1 order(s) have been released from on hold status." stepKey="assertOrderReleaseSuccessMessage"/>
6468

65-
<!--Assert order in orders grid -->
6669
<actionGroup ref="AdminOrderFilterByOrderIdAndStatusActionGroup" stepKey="seeFirstOrder">
67-
<argument name="orderId" value="{$getOrderId}"/>
70+
<argument name="orderId" value="{$grabOrderId}"/>
6871
<argument name="orderStatus" value="Pending"/>
6972
</actionGroup>
70-
<see userInput="{$getOrderId}" selector="{{AdminOrdersGridSection.gridCell('1','ID')}}" stepKey="assertOrderID"/>
73+
<see userInput="{$grabOrderId}" selector="{{AdminOrdersGridSection.gridCell('1','ID')}}" stepKey="assertOrderID"/>
7174
<see userInput="Pending" selector="{{AdminOrdersGridSection.gridCell('1','Status')}}" stepKey="assertOrderStatus"/>
7275
</test>
7376
</tests>

0 commit comments

Comments
 (0)