Skip to content

Commit 008e0fa

Browse files
authored
ENGCOM-8434: Replace repetitive actions with Action Groups in AdminUpdateTopCategoryUrlWithNoRedirectTest and AdminUpdateTopCategoryUrlWithRedirectTest #30562
2 parents 42a659d + fe1c846 commit 008e0fa

4 files changed

+123
-64
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="AdminSelectPermanentRedirectCheckBoxActionGroup" extends="ChangeSeoUrlKeyActionGroup">
12+
<annotations>
13+
<description>EXTENDS: ChangeSeoUrlKeyActionGroup. Select "Create Permanent Redirect for old URL" option</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="value" type="string"/>
17+
</arguments>
18+
19+
<checkOption selector="{{AdminCategorySEOSection.UrlKeyRedirectCheckbox}}" stepKey="checkPermanentRedirectCheckBox" after="enterURLKey"/>
20+
</actionGroup>
21+
</actionGroups>
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="AdminUncheckPermanentRedirectCheckBoxActionGroup" extends="ChangeSeoUrlKeyActionGroup">
12+
<annotations>
13+
<description>EXTENDS: ChangeSeoUrlKeyActionGroup. Uncheck "Create Permanent Redirect for old URL" option</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="value" type="string"/>
17+
</arguments>
18+
19+
<uncheckOption selector="{{AdminCategorySEOSection.UrlKeyRedirectCheckbox}}" stepKey="uncheckPermanentRedirectCheckBox" after="enterURLKey"/>
20+
</actionGroup>
21+
</actionGroups>

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

Lines changed: 38 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -44,48 +44,56 @@
4444

4545
<!-- Open 3rd Level category -->
4646
<actionGroup ref="AdminExpandCategoryTreeActionGroup" stepKey="clickOnExpandTree"/>
47-
<click selector="{{AdminCategorySidebarTreeSection.categoryInTree($$createThreeLevelNestedCategories.name$$)}}" stepKey="selectCategory"/>
48-
<waitForPageLoad stepKey="waitForPageToLoad"/>
47+
<actionGroup ref="AdminCategoriesOpenCategoryActionGroup" stepKey="selectCategory">
48+
<argument name="category" value="$$createThreeLevelNestedCategories$$"/>
49+
</actionGroup>
50+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForPageToLoad"/>
4951

5052
<!--Update category UrlKey and uncheck permanent redirect for old URL -->
51-
<scrollTo selector="{{AdminCategorySEOSection.SectionHeader}}" x="0" y="-80" stepKey="scrollToSearchEngineOptimization1"/>
52-
<click selector="{{AdminCategorySEOSection.SectionHeader}}" stepKey="selectSearchEngineOptimization"/>
53-
<waitForPageLoad stepKey="waitForPageToLoad1"/>
54-
<fillField selector="{{AdminCategorySEOSection.UrlKeyInput}}" userInput="updatedurl" stepKey="updateUrlKey"/>
55-
<uncheckOption selector="{{AdminCategorySEOSection.UrlKeyRedirectCheckbox}}" stepKey="uncheckPermanentRedirectCheckBox"/>
56-
<click selector="{{AdminCategorySEOSection.SectionHeader}}" stepKey="selectSearchEngineOptimization1"/>
57-
<actionGroup ref="AdminSaveCategoryActionGroup" stepKey="saveUpdatedCategory"/>
58-
<seeElement selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="seeSuccessMessage"/>
53+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="scrollToSearchEngineOptimization1"/>
54+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="selectSearchEngineOptimization"/>
55+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForPageToLoad1"/>
56+
<actionGroup ref="AdminUncheckPermanentRedirectCheckBoxActionGroup" stepKey="updateUrlKey">
57+
<argument name="value" value="updatedurl"/>
58+
</actionGroup>
59+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="uncheckPermanentRedirectCheckBox"/>
60+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="selectSearchEngineOptimization1"/>
61+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="saveUpdatedCategory"/>
62+
<actionGroup ref="AssertAdminCategorySaveSuccessMessageActionGroup" stepKey="seeSuccessMessage"/>
5963

6064
<!-- Get Category Id -->
6165
<grabFromCurrentUrl stepKey="categoryId" regex="#\/([0-9]*)?\/$#"/>
6266

6367
<!-- Open Url Rewrite Page -->
64-
<amOnPage url="{{AdminUrlRewriteIndexPage.url}}" stepKey="openUrlRewriteIndexPage"/>
65-
<waitForPageLoad stepKey="waitForUrlRewritePage"/>
68+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="openUrlRewriteIndexPage"/>
69+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForUrlRewritePage"/>
6670

6771
<!-- Verify third level category's Redirect Path, Target Path and Redirect Type after the URL Update -->
68-
<conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}"
69-
dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}"
70-
visible="true"
71-
stepKey="clickOnResetButton"/>
72-
<waitForPageLoad stepKey="waitForPageToLoad0"/>
73-
<click selector="{{AdminDataGridHeaderSection.filters}}" stepKey="openUrlRewriteGridFilters"/>
74-
<fillField selector="{{AdminDataGridHeaderSection.filterFieldInput('request_path')}}" userInput="updatedurl" stepKey="fillUpdatedUrlInRedirectPathFilter"/>
75-
<click selector="{{AdminDataGridHeaderSection.applyFilters}}" stepKey="clickOrderApplyFilters"/>
76-
<waitForPageLoad stepKey="waitForPageToLoad2"/>
77-
<see stepKey="seeTheRedirectType" selector="{{AdminUrlRewriteIndexSection.gridCellByColumnRowNumber('1', 'Redirect Type')}}" userInput="No" />
78-
<see stepKey="seeTheTargetPath" selector="{{AdminUrlRewriteIndexSection.gridCellByColumnRowNumber('1', 'Target Path')}}" userInput="catalog/category/view/id/{$categoryId}"/>
79-
<see selector="{{AdminUrlRewriteIndexSection.gridCellByColumnRowNumber('1', 'Request Path')}}" userInput="$$createDefaultCategory.name$$/$$createTwoLevelNestedCategories.name$$/updatedurl.html" stepKey="seeTheRedirectPath"/>
72+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="clickOnResetButton"/>
73+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForPageToLoad0"/>
74+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="openUrlRewriteGridFilters"/>
75+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="fillUpdatedUrlInRedirectPathFilter"/>
76+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="clickOrderApplyFilters"/>
77+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForPageToLoad2"/>
78+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeTheRedirectType"/>
79+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeTheTargetPath"/>
80+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeTheRedirectPath"/>
81+
<actionGroup ref="AdminSearchByRequestPathActionGroup" stepKey="searchByRequestPath">
82+
<argument name="redirectPath" value="$$createDefaultCategory.name$$/$$createTwoLevelNestedCategories.name$$/updatedurl.html" />
83+
<argument name="redirectType" value="No" />
84+
<argument name="targetPath" value="catalog/category/view/id/{$categoryId}"/>
85+
</actionGroup>
8086

8187
<!-- Verify third level category's old URL path doesn't show redirect path-->
8288
<actionGroup ref="AdminClearGridFiltersActionGroup" stepKey="clickOnResetButton1"/>
8389
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForPageToLoad3"/>
84-
85-
<click selector="{{AdminDataGridHeaderSection.filters}}" stepKey="openUrlRewriteGridFilters1"/>
86-
<fillField selector="{{AdminDataGridHeaderSection.filterFieldInput('request_path')}}" userInput="{{Three_nested_categories.name_lwr}}" stepKey="fillOldUrlInRedirectPathFilter"/>
87-
<click selector="{{AdminDataGridHeaderSection.applyFilters}}" stepKey="clickOrderApplyFilters1"/>
88-
<waitForPageLoad stepKey="waitForPageToLoad4"/>
89-
<see stepKey="seeEmptyRecodsMessage" selector="{{AdminDataGridTableSection.dataGridEmpty}}" userInput="We couldn't find any records."/>
90+
<actionGroup ref="AdminSearchDeletedUrlRewriteActionGroup" stepKey="searcOldUrlRewriteInGrid">
91+
<argument name="requestPath" value="{{Three_nested_categories.name_lwr}}"/>
92+
</actionGroup>
93+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="openUrlRewriteGridFilters1"/>
94+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="fillOldUrlInRedirectPathFilter"/>
95+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="clickOrderApplyFilters1"/>
96+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForPageToLoad4"/>
97+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeEmptyRecodsMessage"/>
9098
</test>
9199
</tests>

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

Lines changed: 43 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -42,49 +42,58 @@
4242

4343
<!-- Open 3rd Level category -->
4444
<actionGroup ref="AdminExpandCategoryTreeActionGroup" stepKey="clickOnExpandTree"/>
45-
<click selector="{{AdminCategorySidebarTreeSection.categoryInTree($$createThreeLevelNestedCategories.name$$)}}" stepKey="selectCategory"/>
46-
<waitForPageLoad stepKey="waitForPageToLoad"/>
45+
<actionGroup ref="AdminCategoriesOpenCategoryActionGroup" stepKey="selectCategory">
46+
<argument name="category" value="$$createThreeLevelNestedCategories$$"/>
47+
</actionGroup>
48+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForPageToLoad"/>
4749

4850
<!--Update category UrlKey and check permanent redirect for old URL -->
49-
<scrollTo selector="{{AdminCategorySEOSection.SectionHeader}}" x="0" y="-80" stepKey="scrollToSearchEngineOptimization1"/>
50-
<click selector="{{AdminCategorySEOSection.SectionHeader}}" stepKey="selectSearchEngineOptimization"/>
51-
<waitForPageLoad stepKey="waitForPageToLoad1"/>
52-
<fillField selector="{{AdminCategorySEOSection.UrlKeyInput}}" userInput="updateredirecturl" stepKey="updateUrlKey"/>
53-
<checkOption selector="{{AdminCategorySEOSection.UrlKeyRedirectCheckbox}}" stepKey="checkPermanentRedirectCheckBox"/>
54-
<click selector="{{AdminCategorySEOSection.SectionHeader}}" stepKey="selectSearchEngineOptimization1"/>
55-
<actionGroup ref="AdminSaveCategoryActionGroup" stepKey="saveUpdatedCategory"/>
56-
<seeElement selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="seeSuccessMessage"/>
51+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="scrollToSearchEngineOptimization1"/>
52+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="selectSearchEngineOptimization"/>
53+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForPageToLoad1"/>
54+
<actionGroup ref="AdminSelectPermanentRedirectCheckBoxActionGroup" stepKey="updateUrlKey">
55+
<argument name="value" value="updateredirecturl"/>
56+
</actionGroup>
57+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="checkPermanentRedirectCheckBox"/>
58+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="selectSearchEngineOptimization1"/>
59+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="saveUpdatedCategory"/>
60+
<actionGroup ref="AssertAdminCategorySaveSuccessMessageActionGroup" stepKey="seeSuccessMessage"/>
5761

5862
<!-- Get Category ID -->
5963
<grabFromCurrentUrl stepKey="categoryId" regex="#\/([0-9]*)?\/$#"/>
6064

61-
<!-- Open Url Rewrite Page -->
62-
<amOnPage url="{{AdminUrlRewriteIndexPage.url}}" stepKey="openUrlRewriteIndexPage"/>
63-
<waitForPageLoad stepKey="waitForUrlRewritePage"/>
64-
65-
<!-- Verify third level category's Redirect Path, Target Path and Redirect Type after the URL update -->
66-
<conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}"
67-
dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}"
68-
visible="true"
69-
stepKey="clickOnResetButton"/>
70-
<waitForPageLoad stepKey="waitForPageToLoad2"/>
71-
<click selector="{{AdminDataGridHeaderSection.filters}}" stepKey="openUrlRewriteGridFilters"/>
72-
<fillField selector="{{AdminDataGridHeaderSection.filterFieldInput('request_path')}}" userInput="updateredirecturl" stepKey="fillUpdatedURLInRedirectPathFilter"/>
73-
<click selector="{{AdminDataGridHeaderSection.applyFilters}}" stepKey="clickOrderApplyFilters"/>
74-
<waitForPageLoad stepKey="waitForPageToLoad3"/>
75-
<see selector="{{AdminUrlRewriteIndexSection.gridCellByColumnRowNumber('1', 'Redirect Type')}}" userInput="No" stepKey="seeTheRedirectType"/>
76-
<see selector="{{AdminUrlRewriteIndexSection.gridCellByColumnRowNumber('1', 'Target Path')}}" userInput="catalog/category/view/id/{$categoryId}" stepKey="seeTheTargetPath"/>
77-
<see selector="{{AdminUrlRewriteIndexSection.gridCellByColumnRowNumber('1', 'Request Path')}}" userInput="$$createDefaultCategory.name$$/$$createTwoLevelNestedCategories.name$$/updateredirecturl.html" stepKey="seeTheRedirectPath"/>
65+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="openUrlRewriteIndexPage"/>
66+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForUrlRewritePage"/>
67+
<!-- Verify third level category's Redirect Path, Target Path and Redirect Type for updated URL-->
68+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="clickOnResetButton"/>
69+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForPageToLoad2"/>
70+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="openUrlRewriteGridFilters"/>
71+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="fillUpdatedURLInRedirectPathFilter"/>
72+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="clickOrderApplyFilters"/>
73+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForPageToLoad3"/>
74+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeTheRedirectType"/>
75+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeTheTargetPath"/>
76+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeTheRedirectPath"/>
77+
<actionGroup ref="AdminSearchByRequestPathActionGroup" stepKey="searchByRequestPath">
78+
<argument name="redirectPath" value="$$createDefaultCategory.name$$/$$createTwoLevelNestedCategories.name$$/updateredirecturl.html" />
79+
<argument name="redirectType" value="No" />
80+
<argument name="targetPath" value="catalog/category/view/id/{$categoryId}"/>
81+
</actionGroup>
7882

7983
<!-- Verify third level category's Redirect path, Target Path and Redirect type for old URL -->
8084
<actionGroup ref="AdminClearGridFiltersActionGroup" stepKey="clickOnResetButton1"/>
8185
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForPageToLoad4"/>
82-
<click selector="{{AdminDataGridHeaderSection.filters}}" stepKey="openUrlRewriteGridFilters1"/>
83-
<fillField selector="{{AdminDataGridHeaderSection.filterFieldInput('request_path')}}" userInput="$$createThreeLevelNestedCategories.name$$" stepKey="fillOldUrlInRedirectPathFilter"/>
84-
<click selector="{{AdminDataGridHeaderSection.applyFilters}}" stepKey="clickOrderApplyFilters1"/>
85-
<waitForPageLoad stepKey="waitForPageToLoad5"/>
86-
<see selector="{{AdminUrlRewriteIndexSection.gridCellByColumnRowNumber('1', 'Request Path')}}" userInput="$$createDefaultCategory.name$$/$$createTwoLevelNestedCategories.name$$/$$createThreeLevelNestedCategories.name$$.html" stepKey="seeTheRedirectPathForOldUrl"/>
87-
<see selector="{{AdminUrlRewriteIndexSection.gridCellByColumnRowNumber('1', 'Target Path')}}" userInput="$$createDefaultCategory.name$$/$$createTwoLevelNestedCategories.name$$/updateredirecturl.html" stepKey="seeTheTargetPathForOldUrl"/>
88-
<see selector="{{AdminUrlRewriteIndexSection.gridCellByColumnRowNumber('1', 'Redirect Type')}}" userInput="Permanent (301)" stepKey="seeTheRedirectTypeForOldUrl"/>
86+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="openUrlRewriteGridFilters1"/>
87+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="fillOldUrlInRedirectPathFilter"/>
88+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="clickOrderApplyFilters1"/>
89+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForPageToLoad5"/>
90+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeTheRedirectPathForOldUrl"/>
91+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeTheTargetPathForOldUrl"/>
92+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeTheRedirectTypeForOldUrl"/>
93+
<actionGroup ref="AdminSearchByRequestPathActionGroup" stepKey="searchByRequestPathForOldUrl">
94+
<argument name="redirectPath" value="$$createDefaultCategory.name$$/$$createTwoLevelNestedCategories.name$$/$$createThreeLevelNestedCategories.name$$.html" />
95+
<argument name="redirectType" value="Permanent (301)" />
96+
<argument name="targetPath" value="$$createDefaultCategory.name$$/$$createTwoLevelNestedCategories.name$$/updateredirecturl.html"/>
97+
</actionGroup>
8998
</test>
9099
</tests>

0 commit comments

Comments
 (0)