Skip to content

Commit

Permalink
refactored AdminOrdersReleaseInUnholdStatusTest
Browse files Browse the repository at this point in the history
  • Loading branch information
AnnaAPak committed Dec 29, 2020
1 parent fadbf69 commit 815ef76
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 23 deletions.
17 changes: 17 additions & 0 deletions app/code/Magento/Sales/Test/Mftf/Data/HoldOrderData.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>

<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd">

<entity name="HoldOrder" type="HoldOrder">
<var key="quote_id" entityKey="return" entityType="CustomerCart"/>
</entity>

</entities>
17 changes: 17 additions & 0 deletions app/code/Magento/Sales/Test/Mftf/Metadata/HoldOrderMeta.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<operations xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataOperation.xsd">
<operation name="CreateHoldOrder" dataType="HoldOrder" type="create" auth="adminOauth" url="V1/orders/{return}/hold" method="POST">
<contentType>application/json</contentType>
<object key="cartItem" dataType="CartItem">
<field key="quote_id">string</field>
</object>
</operation>
</operations>
Original file line number Diff line number Diff line change
Expand Up @@ -21,53 +21,56 @@
<before>
<actionGroup ref="AdminLoginActionGroup" stepKey="LoginAsAdmin"/>

<!-- Create Data -->
<createData entity="Simple_US_Customer" stepKey="createCustomer"/>
<createData entity="_defaultCategory" stepKey="createCategory"/>
<createData entity="defaultSimpleProduct" stepKey="createProduct">
<requiredEntity createDataKey="createCategory"/>
</createData>
<createData entity="CustomerCart" stepKey="createCustomerCart">
<requiredEntity createDataKey="createCustomer"/>
</createData>
<createData entity="CustomerCartItem" stepKey="addCartItemOne">
<requiredEntity createDataKey="createCustomerCart"/>
<requiredEntity createDataKey="createProduct"/>
</createData>
<createData entity="CustomerAddressInformation" stepKey="addCustomerOrderAddress">
<requiredEntity createDataKey="createCustomerCart"/>
</createData>
<updateData createDataKey="createCustomerCart" entity="CustomerOrderPaymentMethod" stepKey="sendCustomerPaymentInformationOne">
<requiredEntity createDataKey="createCustomerCart"/>
</updateData>
<createData entity="HoldOrder" stepKey="holdOrder">
<requiredEntity createDataKey="createCustomerCart"/>
</createData>
</before>
<after>
<!-- Delete data -->
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/>
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
</after>

<!-- Create order -->
<actionGroup ref="CreateOrderActionGroup" stepKey="createFirstOrder">
<argument name="product" value="$$createProduct$$"/>
<argument name="customer" value="$$createCustomer$$"/>
</actionGroup>
<grabTextFrom selector="|Order # (\d+)|" stepKey="getOrderId"/>
<assertNotEmpty stepKey="assertOrderIdIsNotEmpty" after="getOrderId">
<actualResult type="const">$getOrderId</actualResult>
</assertNotEmpty>

<!-- Hold Order -->
<click selector="{{AdminOrderDetailsMainActionsSection.hold}}" stepKey="pushButtonHold"/>
<waitForPageLoad stepKey="waitForHold"/>
<see userInput="You put the order on hold." stepKey="seeHoldMessage"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="createFirstOrder"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="getOrderId"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="assertOrderIdIsNotEmpty"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="pushButtonHold"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForHold"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeHoldMessage"/>

<!-- Navigate to backend: Go to Sales > Orders -->
<actionGroup ref="AdminOrdersPageOpenActionGroup" stepKey="onOrderPage"/>
<actionGroup ref="AdminOrdersGridClearFiltersActionGroup" stepKey="clearFilters"/>

<!-- Select Mass Action according to dataset: Unhold -->
<grabTextFrom selector="{{AdminOrdersGridSection.orderIdByIncrementId($createCustomerCart.return$)}}" stepKey="grabOrderId"/>
<actionGroup ref="AdminOrderActionOnGridActionGroup" stepKey="actionUnold">
<argument name="action" value="Unhold"/>
<argument name="orderId" value="$getOrderId"/>
<argument name="orderId" value="$grabOrderId"/>
</actionGroup>
<see userInput="1 order(s) have been released from on hold status." stepKey="assertOrderReleaseSuccessMessage"/>

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

0 comments on commit 815ef76

Please sign in to comment.