Skip to content

Commit a3cc49a

Browse files
ENGCOM-8583: [MFTF] Refactoring AdminSortingByWebsitesTest #31371
2 parents c1ab666 + cfac462 commit a3cc49a

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}}"/>
@@ -52,31 +52,30 @@
5252
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
5353
</after>
5454

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

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

0 commit comments

Comments
 (0)