Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MFTF]: Refactoring of AdminCreateInvoiceTest #31009

Merged
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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="AdminCreateInvoiceTest">
<test name="AdminCreateInvoiceTest" deprecated="Use AdminInvoiceOrderTest instead">
<annotations>
<features value="Sales"/>
<stories value="Create an Invoice via the Admin"/>
<title value="Admin should be able to create an invoice"/>
<title value="DEPRECATED. Admin should be able to create an invoice"/>
<description value="Admin should be able to create an invoice"/>
<severity value="MAJOR"/>
<testCaseId value="MAGETWO-72096"/>
<group value="sales"/>
<skip>
<issueId value="DEPRECATED">Use AdminInvoiceOrderTest instead</issueId>
</skip>
</annotations>
<before>
<createData entity="_defaultCategory" stepKey="createCategory"/>
Expand Down Expand Up @@ -87,4 +90,4 @@
<click selector="{{AdminInvoicesGridSection.firstRow}}" stepKey="clickInvoice2"/>
<see selector="{{AdminInvoiceDetailsInformationSection.orderStatus}}" userInput="Processing" stepKey="seeOrderStatus2"/>
</test>
</tests>
</tests>
66 changes: 66 additions & 0 deletions app/code/Magento/Sales/Test/Mftf/Test/AdminInvoiceOrderTest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<?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="AdminInvoiceOrderTest">
<annotations>
<features value="Sales"/>
<stories value="Create an Invoice via the Admin"/>
<title value="Admin should be able to create an invoice"/>
<description value="Admin should be able to create an invoice"/>
<severity value="MAJOR"/>
<testCaseId value="MAGETWO-72096"/>
<group value="sales"/>
</annotations>

<before>
<createData entity="_defaultCategory" stepKey="createCategory"/>
<createData entity="_defaultProduct" stepKey="createSimpleProductApi">
<requiredEntity createDataKey="createCategory"/>
</createData>
<createData entity="GuestCart" stepKey="createGuestCart"/>
<createData entity="SimpleCartItem" stepKey="addCartItem">
<requiredEntity createDataKey="createGuestCart"/>
<requiredEntity createDataKey="createSimpleProductApi"/>
</createData>
<createData entity="GuestAddressInformation" stepKey="addGuestOrderAddress">
<requiredEntity createDataKey="createGuestCart"/>
</createData>
<updateData createDataKey="createGuestCart" entity="GuestOrderPaymentMethod" stepKey="sendGuestPaymentInformation">
<requiredEntity createDataKey="createGuestCart"/>
</updateData>

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

</before>

<after>
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
<deleteData createDataKey="createSimpleProductApi" stepKey="deleteSimpleProductApi"/>
<actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally, we should remove all side effects created in the test. That means that it would be great to remove the GuestCart as well after the test, if possible.

Thanks

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rogyar, I suggest there is no need/possibility to delete GuestCartafter the test - as we place the order during the test. In addition, there is no operation with type="delete" in the GuestCartMeta.xml - probably because of the same logic.
Please, correct me if I'm mistaken.

Thanks.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's more or less what I was expecting. Just wanted to double-check, maybe we already have a routine for removing the quote.

Nevermind then, thank you for checking.

</after>

<actionGroup ref="AdminOpenOrderByEntityIdActionGroup" stepKey="openOrder">
<argument name="entityId" value="$createGuestCart.return$"/>
</actionGroup>

<actionGroup ref="AdminCreateInvoiceActionGroup" stepKey="createInvoice"/>

<actionGroup ref="FilterInvoiceGridByOrderIdWithCleanFiltersActionGroup" stepKey="filterInvoiceGridByOrderId">
<argument name="orderId" value="$createGuestCart.return$"/>
</actionGroup>

<actionGroup ref="AdminSelectFirstGridRowActionGroup" stepKey="openInvoiceFromGrid"/>

<actionGroup ref="AdminOrderViewCheckStatusActionGroup" stepKey="checkIfOrderStatusIsProcessing">
<argument name="status" value="Processing"/>
</actionGroup>

</test>
</tests>