Skip to content

Commit

Permalink
ENGCOM-8538: [MFTF] Refactoring of AdminMassOrdersCancelCompleteAndCl…
Browse files Browse the repository at this point in the history
…osedTest #31123

 - Merge Pull Request #31123 from AnnaAPak/magento2:ref-AdminMassOrdersCancelCompleteAndClosedAPITest
 - Merged commits:
   1. 9847f03
   2. e34fc78
   3. beb0fda
   4. 320748f
   5. d2ab2f3
   6. 7dcd88b
   7. 732c6ff
   8. a70dfc9
   9. a5dd5e9
   10. 424754f
   11. 035442d
   12. aaea37c
   13. bc231ce
   14. de26bef
  • Loading branch information
magento-engcom-team committed Dec 15, 2020
2 parents ad29452 + de26bef commit e2f906e
Show file tree
Hide file tree
Showing 9 changed files with 215 additions and 2 deletions.
17 changes: 17 additions & 0 deletions app/code/Magento/Sales/Test/Mftf/Data/CreditMemoData.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="CreditMemo" type="CreditMemo">
<var key="quote_id" entityKey="return" entityType="CustomerCart"/>
</entity>

</entities>
17 changes: 17 additions & 0 deletions app/code/Magento/Sales/Test/Mftf/Data/InvoiceData.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="Invoice" type="Invoice">
<var key="quote_id" entityKey="return" entityType="CustomerCart"/>
</entity>

</entities>
17 changes: 17 additions & 0 deletions app/code/Magento/Sales/Test/Mftf/Data/ShipmentData.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="Shipment" type="Shipment">
<var key="quote_id" entityKey="return" entityType="CustomerCart"/>
</entity>

</entities>
17 changes: 17 additions & 0 deletions app/code/Magento/Sales/Test/Mftf/Metadata/CreditMemoMeta.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="CreateCreditMemo" dataType="CreditMemo" type="create" auth="adminOauth" url="V1/order/{return}/refund" method="POST">
<contentType>application/json</contentType>
<object key="cartItem" dataType="CartItem">
<field key="quote_id">string</field>
</object>
</operation>
</operations>
17 changes: 17 additions & 0 deletions app/code/Magento/Sales/Test/Mftf/Metadata/InvoiceMeta.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="CreateInvoice" dataType="Invoice" type="create" auth="adminOauth" url="V1/order/{return}/invoice" method="POST">
<contentType>application/json</contentType>
<object key="cartItem" dataType="CartItem">
<field key="quote_id">string</field>
</object>
</operation>
</operations>
17 changes: 17 additions & 0 deletions app/code/Magento/Sales/Test/Mftf/Metadata/ShipmentMeta.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="CreateShipment" dataType="Shipment" type="create" auth="adminOauth" url="V1/order/{return}/ship" 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 @@ -41,5 +41,6 @@
<element name="viewLink" type="text" selector="//td/div[contains(.,'{{orderID}}')]/../..//a[@class='action-menu-item']" parameterized="true"/>
<element name="selectOrderID" type="checkbox" selector="//td/div[text()='{{orderId}}']/../preceding-sibling::td//input" parameterized="true" timeout="60"/>
<element name="orderId" type="text" selector="//table[contains(@class, 'data-grid')]//div[contains(text(), '{{orderId}}')]" parameterized="true"/>
<element name="orderIdByIncrementId" type="text" selector="//input[@class='admin__control-checkbox' and @value={{incrId}}]/parent::label/parent::td/following-sibling::td" parameterized="true"/>
</section>
</sections>
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
<?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="AdminMassOrdersCancelClosedAndCompleteTest">
<annotations>
<stories value="Mass Update Orders"/>
<title value="Mass cancel orders in status Complete, Closed"/>
<description value="Try to cancel orders in status Complete, Closed"/>
<severity value="MAJOR"/>
<testCaseId value="MC-39905"/>
<group value="sales"/>
<group value="mtf_migrated"/>
</annotations>

<before>

<actionGroup ref="AdminLoginActionGroup" stepKey="LoginAsAdmin"/>

<createData entity="ApiCategory" stepKey="createCategory"/>

<createData entity="defaultSimpleProduct" stepKey="createSimpleProduct">
<requiredEntity createDataKey="createCategory"/>
</createData>

<createData entity="GuestCart" stepKey="createGuestCartOne"/>
<createData entity="SimpleCartItem" stepKey="addCartItemOne">
<requiredEntity createDataKey="createGuestCartOne"/>
<requiredEntity createDataKey="createSimpleProduct"/>
</createData>
<createData entity="GuestAddressInformation" stepKey="addGuestOrderAddressOne">
<requiredEntity createDataKey="createGuestCartOne"/>
</createData>
<updateData createDataKey="createGuestCartOne" entity="GuestOrderPaymentMethod" stepKey="sendGuestPaymentInformationOne">
<requiredEntity createDataKey="createGuestCartOne"/>
</updateData>

<createData entity="Invoice" stepKey="invoiceOrderOne">
<requiredEntity createDataKey="createGuestCartOne"/>
</createData>

<createData entity="Shipment" stepKey="shipOrderOne">
<requiredEntity createDataKey="createGuestCartOne"/>
</createData>

<createData entity="GuestCart" stepKey="createGuestCartTwo"/>
<createData entity="SimpleCartItem" stepKey="addCartItemTwo">
<requiredEntity createDataKey="createGuestCartTwo"/>
<requiredEntity createDataKey="createSimpleProduct"/>
</createData>
<createData entity="GuestAddressInformation" stepKey="addGuestOrderAddressTwo">
<requiredEntity createDataKey="createGuestCartTwo"/>
</createData>
<updateData createDataKey="createGuestCartTwo" entity="GuestOrderPaymentMethod" stepKey="sendGuestPaymentInformationTwo">
<requiredEntity createDataKey="createGuestCartTwo"/>
</updateData>

<createData entity="Invoice" stepKey="invoiceOrderTwo">
<requiredEntity createDataKey="createGuestCartTwo"/>
</createData>

<createData entity="CreditMemo" stepKey="refundOrderTwo">
<requiredEntity createDataKey="createGuestCartTwo"/>
</createData>

</before>

<after>
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
<deleteData createDataKey="createSimpleProduct" stepKey="deleteProduct"/>
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
</after>

<actionGroup ref="AdminOrdersPageOpenActionGroup" stepKey="onOrderPage"/>
<actionGroup ref="AdminOrdersGridClearFiltersActionGroup" stepKey="clearFilters"/>

<grabTextFrom selector="{{AdminOrdersGridSection.orderIdByIncrementId($createGuestCartOne.return$)}}" stepKey="getOrderOneId"/>
<grabTextFrom selector="{{AdminOrdersGridSection.orderIdByIncrementId($createGuestCartTwo.return$)}}" stepKey="getOrderTwoId"/>

<actionGroup ref="AdminTwoOrderActionOnGridActionGroup" stepKey="massActionCancel">
<argument name="action" value="Cancel"/>
<argument name="orderId" value="$getOrderOneId"/>
<argument name="secondOrderId" value="$getOrderTwoId"/>
</actionGroup>
<see userInput="You cannot cancel the order(s)." stepKey="assertOrderCancelMassActionFailMessage"/>

<actionGroup ref="AdminOrderFilterByOrderIdAndStatusActionGroup" stepKey="seeFirstOrder">
<argument name="orderId" value="$getOrderOneId"/>
<argument name="orderStatus" value="Complete"/>
</actionGroup>
<see userInput="$getOrderOneId" selector="{{AdminOrdersGridSection.gridCell('1','ID')}}" stepKey="assertFirstOrderID"/>
<see userInput="Complete" selector="{{AdminOrdersGridSection.gridCell('1','Status')}}" stepKey="assertFirstOrderStatus"/>

<actionGroup ref="AdminOrderFilterByOrderIdAndStatusActionGroup" stepKey="seeSecondOrder">
<argument name="orderId" value="$getOrderTwoId"/>
<argument name="orderStatus" value="Closed"/>
</actionGroup>
<see userInput="$getOrderTwoId" selector="{{AdminOrdersGridSection.gridCell('1','ID')}}" stepKey="assertSecondOrderID"/>
<see userInput="Closed" selector="{{AdminOrdersGridSection.gridCell('1','Status')}}" stepKey="assertSecondStatus"/>
</test>
</tests>
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,18 @@

<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
<test name="AdminMassOrdersCancelCompleteAndClosedTest">
<test name="AdminMassOrdersCancelCompleteAndClosedTest" deprecated="Use AdminMassOrdersCancelClosedAndCompleteTest instead">
<annotations>
<stories value="Mass Update Orders"/>
<title value="Mass cancel orders in status Complete, Closed"/>
<title value="DEPRECATED. Mass cancel orders in status Complete, Closed"/>
<description value="Try to cancel orders in status Complete, Closed"/>
<severity value="MAJOR"/>
<testCaseId value="MC-16183"/>
<group value="sales"/>
<group value="mtf_migrated"/>
<skip>
<issueId value="DEPRECATED">Use AdminMassOrdersCancelClosedAndCompleteTest instead</issueId>
</skip>
</annotations>
<before>
<actionGroup ref="AdminLoginActionGroup" stepKey="LoginAsAdmin"/>
Expand Down

0 comments on commit e2f906e

Please sign in to comment.