Skip to content

[MFTF] Cancel created orders after checks on frontend #27698

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

Merged

Conversation

elevinskii
Copy link
Member

@elevinskii elevinskii commented Apr 10, 2020

Description

According to the isolation guidelines of Magento Functional Test Framework, all data created during tests have to be deleted. As we can't delete created orders - there's no way to delete an order neither via backend or webapi - I suppose it'd be an good idea to cancel them.

https://devdocs.magento.com/mftf/docs/guides/test-isolation.html

Updated CheckCheckoutSuccessPageAsRegisterCustomerTest and CheckCheckoutSuccessPageAsGuestTest after blocks, to cancel all orders which have been created in these tests.

New Action Groups

  1. AdminGridBulkActionGroup - massive action for all rows on Admin Grid page
  2. AdminGridColumnShowActionGroup - shows new column on Admin Grid page

Questions or comments

I spent so much time, trying to cancel orders by ids via webapi - but still don't know how to do that in MFTF. If someone has any thoughts or ideas - they'd be appreciated.

Resolved issues:

  1. resolves [Issue] [MFTF] Cancel created orders after checks on frontend #28324: [MFTF] Cancel created orders after checks on frontend

@m2-assistant
Copy link

m2-assistant bot commented Apr 10, 2020

Hi @elevinskii. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento give me test instance - deploy test instance based on PR changes
  • @magento give me 2.4-develop instance - deploy vanilla Magento instance

For more details, please, review the Magento Contributor Guide documentation.

Copy link
Contributor

@lbajsarowicz lbajsarowicz left a comment

Choose a reason for hiding this comment

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

Could you - by the way - extract the Tests to separate files? (There are 2 tests in the same file)

--- EDIT ---
I see that you used outdated 2.4-develop, that's why you have 2 tests in same file. Now these tests were isolated.

<!--Cancel orders-->
<actionGroup ref="AdminLoginActionGroup" stepKey="adminLogin"/>
<actionGroup ref="AdminOrdersGridClearFiltersActionGroup" stepKey="goToOrdersPage"/>
<waitForLoadingMaskToDisappear stepKey="waitAfterClearFilters"/>
Copy link
Contributor

Choose a reason for hiding this comment

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

If there's no such action - you can add it to AdminOrdersGridClearFiltersActionGroup

Copy link
Member Author

Choose a reason for hiding this comment

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

That's done - I've added wait action in the end of AdminOrdersGridClearFiltersActionGroup and did small refactoring for tests where this action group is used.

@elevinskii
Copy link
Member Author

I see that you used outdated 2.4-develop, that's why you have 2 tests in same file. Now these tests were isolated.

Sorry, overlooked that. Now the branch is updated.

lbajsarowicz
lbajsarowicz previously approved these changes Apr 13, 2020
Copy link
Contributor

@lbajsarowicz lbajsarowicz left a comment

Choose a reason for hiding this comment

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

✔️ Thank you for your contribution

Comment on lines +26 to +39
<!--Cancel orders-->
<actionGroup ref="AdminLoginActionGroup" stepKey="adminLogin"/>
<actionGroup ref="AdminOrdersGridClearFiltersActionGroup" stepKey="goToOrdersPage"/>
<actionGroup ref="AdminGridColumnShowActionGroup" stepKey="showCustomerEmailColumn">
<argument name="columnLabel" value="Customer Email"/>
</actionGroup>
<actionGroup ref="AdminGridFilterFillInputFieldActionGroup" stepKey="filterOrdersByCustomerEmail">
<argument name="filterInputName" value="customer_email"/>
<argument name="filterValue" value="{{CustomerEntityOne.email}}"/>
</actionGroup>
<actionGroup ref="AdminGridFilterApplyActionGroup" stepKey="applyFilters"/>
<actionGroup ref="AdminGridBulkActionGroup" stepKey="cancelOrders">
<argument name="actionLabel" value="Cancel"/>
</actionGroup>
Copy link
Contributor

Choose a reason for hiding this comment

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

Awesome! Perfect test example ❗

@magento-engcom-team
Copy link
Contributor

Hi @lbajsarowicz, thank you for the review.
ENGCOM-7334 has been created to process this Pull Request
✳️ @lbajsarowicz, could you please add one of the following labels to the Pull Request?

Label Description
Auto-Tests: Covered All changes in Pull Request is covered by auto-tests
Auto-Tests: Not Covered Changes in Pull Request requires coverage by auto-tests
Auto-Tests: Not Required Changes in Pull Request does not require coverage by auto-tests

@engcom-Alfa engcom-Alfa self-assigned this Apr 16, 2020
@slavvka
Copy link
Member

slavvka commented May 21, 2020

@magento run all tests

@engcom-Echo
Copy link
Contributor

@magento run all tests

… mftf-checkout-cancel-orders

� Conflicts:
�	app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersCancelCompleteAndClosedTest.xml
�	app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersCancelProcessingAndClosedTest.xml
�	app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersHoldOnCompleteTest.xml
�	app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersHoldOnPendingAndProcessingTest.xml
�	app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersReleasePendingOrderTest.xml
�	app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersUpdateCancelPendingOrderTest.xml
�	app/code/Magento/Sales/Test/Mftf/Test/AdminOrdersReleaseInUnholdStatusTest.xml
@engcom-Echo
Copy link
Contributor

@magento run all tests

@sidolov sidolov added Priority: P3 May be fixed according to the position in the backlog. Severity: S3 Affects non-critical data or functionality and does not force users to employ a workaround. labels Aug 14, 2020
@sidolov sidolov removed this from the 2.4.1 milestone Aug 20, 2020
@sidolov
Copy link
Contributor

sidolov commented Aug 26, 2020

@magento run all tests

@sidolov
Copy link
Contributor

sidolov commented Aug 26, 2020

@elevinskii please, take a look at failed test

@engcom-Echo
Copy link
Contributor

engcom-Echo commented Sep 1, 2020

Hi @elevinskii. Please, take a look at a failed tests. Can you fix them?

@gabrieldagama
Copy link
Contributor

The risk was set to low due to: Changes on this PR don't affect the platform, just the test suite.

Copy link
Contributor

@lbajsarowicz lbajsarowicz left a comment

Choose a reason for hiding this comment

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

✔️ Looks correct for me.

@magento-engcom-team
Copy link
Contributor

Hi @lbajsarowicz, thank you for the review.
ENGCOM-7334 has been created to process this Pull Request

@engcom-Alfa
Copy link
Contributor

QA not applicable

@m2-assistant
Copy link

m2-assistant bot commented Sep 18, 2020

Hi @elevinskii, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Auto-Tests: Covered All changes in Pull Request is covered by auto-tests Component: Backend Component: CatalogInventory Component: Checkout Component: Sales Component: Ui Priority: P3 May be fixed according to the position in the backlog. Progress: accept Release Line: 2.4 Risk: low Severity: S3 Affects non-critical data or functionality and does not force users to employ a workaround.
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

[Issue] [MFTF] Cancel created orders after checks on frontend
10 participants