Skip to content

Commit 9ce991c

Browse files
committed
Refactoring some tests
1 parent fa2f6e6 commit 9ce991c

File tree

4 files changed

+72
-70
lines changed

4 files changed

+72
-70
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: 15 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -44,48 +44,30 @@
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="openCategory">
48+
<argument name="category" value="$$createThreeLevelNestedCategories$$"/>
49+
</actionGroup>
4950

5051
<!--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"/>
52+
<actionGroup ref="AdminUncheckPermanentRedirectCheckBoxActionGroup" stepKey="changeSeoUrlKey">
53+
<argument name="value" value="updatedurl"/>
54+
</actionGroup>
55+
<actionGroup ref="AssertAdminCategorySaveSuccessMessageActionGroup" stepKey="assertSuccessMessage"/>
5956

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

63-
<!-- Open Url Rewrite Page -->
64-
<amOnPage url="{{AdminUrlRewriteIndexPage.url}}" stepKey="openUrlRewriteIndexPage"/>
65-
<waitForPageLoad stepKey="waitForUrlRewritePage"/>
66-
6760
<!-- 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"/>
61+
<actionGroup ref="AdminSearchByRequestPathActionGroup" stepKey="searchByRequestPath">
62+
<argument name="redirectPath" value="$$createDefaultCategory.name$$/$$createTwoLevelNestedCategories.name$$/updatedurl.html" />
63+
<argument name="redirectType" value="No" />
64+
<argument name="targetPath" value="catalog/category/view/id/{$categoryId}"/>
65+
</actionGroup>
8066

8167
<!-- Verify third level category's old URL path doesn't show redirect path-->
82-
<click selector="{{AdminDataGridHeaderSection.clearFilters}}" stepKey="clickOnResetButton1"/>
83-
<waitForPageLoad stepKey="waitForPageToLoad3"/>
68+
<actionGroup ref="AdminSearchDeletedUrlRewriteActionGroup" stepKey="searcOldUrlRewriteInGrid">
69+
<argument name="requestPath" value="{{Three_nested_categories.name_lwr}}"/>
70+
</actionGroup>
8471

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."/>
9072
</test>
9173
</tests>

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

Lines changed: 15 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -42,53 +42,31 @@
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"/>-->
4745
<actionGroup ref="AdminCategoriesOpenCategoryActionGroup" stepKey="openCategory">
48-
<argument name="category" value="$$createThreeLevelNestedCategories.name$$"/>
46+
<argument name="category" value="$$createThreeLevelNestedCategories$$"/>
4947
</actionGroup>
5048

5149
<!--Update category UrlKey and check permanent redirect for old URL -->
52-
<scrollTo selector="{{AdminCategorySEOSection.SectionHeader}}" x="0" y="-80" stepKey="scrollToSearchEngineOptimization1"/>
53-
<click selector="{{AdminCategorySEOSection.SectionHeader}}" stepKey="selectSearchEngineOptimization"/>
54-
<waitForPageLoad stepKey="waitForPageToLoad1"/>
55-
<fillField selector="{{AdminCategorySEOSection.UrlKeyInput}}" userInput="updateredirecturl" stepKey="updateUrlKey"/>
56-
<checkOption selector="{{AdminCategorySEOSection.UrlKeyRedirectCheckbox}}" stepKey="checkPermanentRedirectCheckBox"/>
57-
<click selector="{{AdminCategorySEOSection.SectionHeader}}" stepKey="selectSearchEngineOptimization1"/>
58-
<actionGroup ref="AdminSaveCategoryActionGroup" stepKey="saveUpdatedCategory"/>
59-
<!--<seeElement selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="seeSuccessMessage"/>-->
50+
<actionGroup ref="AdminSelectPermanentRedirectCheckBoxActionGroup" stepKey="changeSeoUrlKey">
51+
<argument name="value" value="updateredirecturl"/>
52+
</actionGroup>
6053
<actionGroup ref="AssertAdminCategorySaveSuccessMessageActionGroup" stepKey="assertSuccessMessage"/>
6154

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

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

8365
<!-- Verify third level category's Redirect path, Target Path and Redirect type for old URL -->
84-
<click selector="{{AdminDataGridHeaderSection.clearFilters}}" stepKey="clickOnResetButton1"/>
85-
<waitForPageLoad stepKey="waitForPageToLoad4"/>
86-
<click selector="{{AdminDataGridHeaderSection.filters}}" stepKey="openUrlRewriteGridFilters1"/>
87-
<fillField selector="{{AdminDataGridHeaderSection.filterFieldInput('request_path')}}" userInput="$$createThreeLevelNestedCategories.name$$" stepKey="fillOldUrlInRedirectPathFilter"/>
88-
<click selector="{{AdminDataGridHeaderSection.applyFilters}}" stepKey="clickOrderApplyFilters1"/>
89-
<waitForPageLoad stepKey="waitForPageToLoad5"/>
90-
<see selector="{{AdminUrlRewriteIndexSection.gridCellByColumnRowNumber('1', 'Request Path')}}" userInput="$$createDefaultCategory.name$$/$$createTwoLevelNestedCategories.name$$/$$createThreeLevelNestedCategories.name$$.html" stepKey="seeTheRedirectPathForOldUrl"/>
91-
<see selector="{{AdminUrlRewriteIndexSection.gridCellByColumnRowNumber('1', 'Target Path')}}" userInput="$$createDefaultCategory.name$$/$$createTwoLevelNestedCategories.name$$/updateredirecturl.html" stepKey="seeTheTargetPathForOldUrl"/>
92-
<see selector="{{AdminUrlRewriteIndexSection.gridCellByColumnRowNumber('1', 'Redirect Type')}}" userInput="Permanent (301)" stepKey="seeTheRedirectTypeForOldUrl"/>
66+
<actionGroup ref="AdminSearchByRequestPathActionGroup" stepKey="searchByRequestPathForOldUrl">
67+
<argument name="redirectPath" value="$$createDefaultCategory.name$$/$$createTwoLevelNestedCategories.name$$/$$createThreeLevelNestedCategories.name$$.html" />
68+
<argument name="redirectType" value="Permanent (301)" />
69+
<argument name="targetPath" value="$$createDefaultCategory.name$$/$$createTwoLevelNestedCategories.name$$/updateredirecturl.html"/>
70+
</actionGroup>
9371
</test>
9472
</tests>

0 commit comments

Comments
 (0)