Skip to content

Commit 2a71255

Browse files
committed
refactored AdminSortProductsGridByActionGroup
1 parent ad29452 commit 2a71255

File tree

3 files changed

+62
-20
lines changed

3 files changed

+62
-20
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AdminChangeWebSiteAssignedToProductActionGroup" extends="AddWebsiteToProductActionGroup">
12+
<annotations>
13+
<description>Extends AddWebsiteToProductActionGroup. Changes website assigned to product from websiteToDeselect to website</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="websiteToDeselect" type="string"/>
17+
</arguments>
18+
19+
<uncheckOption selector="{{ProductInWebsitesSection.website(websiteToDeselect)}}" stepKey="uncheckWebsite" after="checkWebsite"/>
20+
</actionGroup>
21+
</actionGroups>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AdminSortProductsGridByActionGroup">
12+
<annotations>
13+
<description>Sorts the Product Grid by field</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="field" type="string"/>
17+
</arguments>
18+
19+
<click selector="{{AdminProductGridSection.columnHeader(field)}}" stepKey="clickWebsitesHeaderToSort"/>
20+
<waitForLoadingMaskToDisappear stepKey="waitForApplyingChanges"/>
21+
</actionGroup>
22+
</actionGroups>

app/code/Magento/Catalog/Test/Mftf/Test/AdminSortingByWebsitesTest.xml

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
</createData>
2626

2727
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
28-
<!--Create new website -->
28+
2929
<actionGroup ref="AdminCreateWebsiteActionGroup" stepKey="createAdditionalWebsite">
3030
<argument name="newWebsiteName" value="{{customWebsite.name}}"/>
3131
<argument name="websiteCode" value="{{customWebsite.code}}"/>
@@ -54,31 +54,30 @@
5454
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
5555
</after>
5656

57-
<!--Assign Custom Website to Simple Product -->
58-
<actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="navigateToCatalogProductGrid"/>
59-
60-
<conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFiltersInitial"/>
57+
<actionGroup ref="AdminClearFiltersActionGroup" stepKey="navigateToCatalogProductGrid"/>
58+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="clickClearFiltersInitial"/>
6159
<actionGroup ref="OpenEditProductOnBackendActionGroup" stepKey="assignCustomWebsiteToProduct">
6260
<argument name="product" value="$$productAssignedToCustomWebsite$$"/>
6361
</actionGroup>
64-
<scrollTo selector="{{ProductInWebsitesSection.sectionHeader}}" stepKey="scrollToWebsites"/>
65-
<conditionalClick selector="{{ProductInWebsitesSection.sectionHeader}}" dependentSelector="{{AdminProductContentSection.sectionHeaderShow}}" visible="false" stepKey="expandSection"/>
66-
<waitForPageLoad stepKey="waitForPageOpened"/>
67-
<uncheckOption selector="{{ProductInWebsitesSection.website(_defaultWebsite.name)}}" stepKey="deselectMainWebsite"/>
68-
<checkOption selector="{{ProductInWebsitesSection.website(customWebsite.name)}}" stepKey="selectWebsite"/>
69-
70-
<actionGroup ref="AdminProductFormSaveActionGroup" stepKey="clickSave"/>
71-
<seeElement selector="{{AdminProductMessagesSection.successMessage}}" stepKey="seeSaveProductMessageAgain"/>
62+
<actionGroup ref="AdminChangeWebSiteAssignedToProductActionGroup" stepKey="scrollToWebsites">
63+
<argument name="website" value="{{customWebsite.name}}"/>
64+
<argument name="websiteToDeselect" value="{{_defaultWebsite.name}}"/>
65+
</actionGroup>
66+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="expandSection"/>
67+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForPageOpened"/>
68+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="deselectMainWebsite"/>
69+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="selectWebsite"/>
70+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="clickSave"/>
71+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeSaveProductMessageAgain"/>
7272

73-
<!--Navigate To Product Grid To Check Website Sorting-->
7473
<actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="navigateToCatalogProductGridToSortByWebsite"/>
75-
76-
<!--Sorting works (By Websites) ASC-->
77-
<click selector="{{AdminProductGridSection.columnHeader('Websites')}}" stepKey="clickWebsitesHeaderToSortAsc"/>
74+
<actionGroup ref="AdminSortProductsGridByActionGroup" stepKey="clickWebsitesHeaderToSortAsc">
75+
<argument name="field" value="Websites"/>
76+
</actionGroup>
7877
<see selector="{{AdminProductGridSection.productGridContentsOnRow('1')}}" userInput="Main Website" stepKey="checkIfProduct1WebsitesAsc"/>
79-
80-
<!--Sorting works (By Websites) DESC-->
81-
<click selector="{{AdminProductGridSection.columnHeader('Websites')}}" stepKey="clickWebsitesHeaderToSortDesc"/>
78+
<actionGroup ref="AdminSortProductsGridByActionGroup" stepKey="clickWebsitesHeaderToSortDesc">
79+
<argument name="field" value="Websites"/>
80+
</actionGroup>
8281
<see selector="{{AdminProductGridSection.productGridContentsOnRow('1')}}" userInput="{{customWebsite.name}}" stepKey="checkIfProduct1WebsitesDesc"/>
8382
</test>
8483
</tests>

0 commit comments

Comments
 (0)