Skip to content

Commit 09d4afa

Browse files
ENGCOM-7596: MFTF: Refactoring AdminUrlRewritesForProductInAnchorCategoriesTest #28408
- Merge Pull Request #28408 from kate-kyzyma/magento2:Refactoring-AdminUrlRewritesForProductInAnchorCategoriesTest - Merged commits: 1. 9648beb 2. a16b5a7 3. 26d03a3
2 parents 63a6786 + 26d03a3 commit 09d4afa

File tree

4 files changed

+95
-33
lines changed

4 files changed

+95
-33
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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="AdminSearchUrlRewriteByRequestPathActionGroup" extends="AdminSearchAndSelectUrlRewriteInGridActionGroup">
12+
<annotations>
13+
<description>EXTENDS: SearchAndSelectUrlRewrite. Removes 'clickOnRowSelectButton' and 'clickOnEditButton'.</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="requestPath" type="string"/>
17+
</arguments>
18+
19+
<remove keyForRemoval="clickOnRowSelectButton"/>
20+
<remove keyForRemoval="clickOnEditButton"/>
21+
<remove keyForRemoval="waitForEditPageToLoad"/>
22+
</actionGroup>
23+
</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="AssertAdminRequestPathInUrlRewriteGrigActionGroup">
12+
<annotations>
13+
<description>Assert the requested path is shown in the URL Rewrite grid.</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="requestPath" type="string"/>
17+
</arguments>
18+
19+
<seeElement selector="{{AdminUrlRewriteIndexSection.gridCellByColumnValue('Request Path', requestPath)}}"
20+
stepKey="seeValueInGrid"/>
21+
</actionGroup>
22+
</actionGroups>

app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUrlRewritesForProductInAnchorCategoriesTest/AdminUrlRewritesForProductInAnchorCategoriesTest.xml

Lines changed: 44 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -39,47 +39,60 @@
3939
<after>
4040
<deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/>
4141
<deleteData createDataKey="simpleSubCategory1" stepKey="deletesimpleSubCategory1"/>
42-
<amOnPage url="{{AdminLogoutPage.url}}" stepKey="amOnLogoutPage"/>
42+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
4343
</after>
4444
<!-- Steps -->
4545
<!-- 1. Log in to Admin -->
4646
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
4747
<!-- 2. Open Marketing - SEO & Search - URL Rewrites -->
48-
<amOnPage url="{{AdminUrlRewriteIndexPage.url}}" stepKey="amOnUrlRewriteIndexPage"/>
49-
<click selector="{{AdminDataGridHeaderSection.filters}}" stepKey="openUrlRewriteGridFilters"/>
50-
<fillField selector="{{AdminDataGridHeaderSection.filterFieldInput('request_path')}}" userInput="$createSimpleProduct.custom_attributes[url_key]$.html" stepKey="inputProductName"/>
51-
<click selector="{{AdminDataGridHeaderSection.applyFilters}}" stepKey="clickOrderApplyFilters"/>
52-
<waitForPageLoad stepKey="waitForPageToLoad"/>
53-
<seeElement selector="{{AdminUrlRewriteIndexSection.gridCellByColumnValue('Request Path', $createSimpleProduct.custom_attributes[url_key]$.html)}}" stepKey="seeValue1"/>
54-
<seeElement selector="{{AdminUrlRewriteIndexSection.gridCellByColumnValue('Request Path', $simpleSubCategory1.custom_attributes[url_key]$/$createSimpleProduct.custom_attributes[url_key]$.html)}}" stepKey="seeValue2"/>
55-
<seeElement selector="{{AdminUrlRewriteIndexSection.gridCellByColumnValue('Request Path', $simpleSubCategory1.custom_attributes[url_key]$/$simpleSubCategory2.custom_attributes[url_key]$/$createSimpleProduct.custom_attributes[url_key]$.html)}}" stepKey="seeValue3"/>
56-
<seeElement selector="{{AdminUrlRewriteIndexSection.gridCellByColumnValue('Request Path', $simpleSubCategory1.custom_attributes[url_key]$/$simpleSubCategory2.custom_attributes[url_key]$/$simpleSubCategory3.custom_attributes[url_key]$/$createSimpleProduct.custom_attributes[url_key]$.html)}}" stepKey="seeValue4"/>
57-
48+
<actionGroup ref="AdminSearchUrlRewriteByRequestPathActionGroup" stepKey="searchingUrlRewrite">
49+
<argument name="requestPath" value="$createSimpleProduct.custom_attributes[url_key]$.html"/>
50+
</actionGroup>
51+
<actionGroup ref="AssertAdminRequestPathInUrlRewriteGrigActionGroup" stepKey="seeValueOne">
52+
<argument name="requestPath" value="$createSimpleProduct.custom_attributes[url_key]$.html"/>
53+
</actionGroup>
54+
<actionGroup ref="AssertAdminRequestPathInUrlRewriteGrigActionGroup" stepKey="seeValueTwo">
55+
<argument name="requestPath" value="$simpleSubCategory1.custom_attributes[url_key]$/$createSimpleProduct.custom_attributes[url_key]$.html"/>
56+
</actionGroup>
57+
<actionGroup ref="AssertAdminRequestPathInUrlRewriteGrigActionGroup" stepKey="seeValueThree">
58+
<argument name="requestPath" value="$simpleSubCategory1.custom_attributes[url_key]$/$simpleSubCategory2.custom_attributes[url_key]$/$createSimpleProduct.custom_attributes[url_key]$.html"/>
59+
</actionGroup>
60+
<actionGroup ref="AssertAdminRequestPathInUrlRewriteGrigActionGroup" stepKey="seeValueFour">
61+
<argument name="requestPath" value="$simpleSubCategory1.custom_attributes[url_key]$/$simpleSubCategory2.custom_attributes[url_key]$/$simpleSubCategory3.custom_attributes[url_key]$/$createSimpleProduct.custom_attributes[url_key]$.html"/>
62+
</actionGroup>
5863
<!-- 3. Edit Category 1 for DEFAULT Store View: -->
5964
<actionGroup ref="SwitchCategoryStoreViewActionGroup" stepKey="switchStoreView">
6065
<argument name="Store" value="_defaultStore.name"/>
6166
<argument name="CatName" value="$$simpleSubCategory1.name$$"/>
6267
</actionGroup>
63-
<click selector="{{AdminCategorySEOSection.SectionHeader}}" stepKey="openSeoSection2"/>
64-
<uncheckOption selector="{{AdminCategorySEOSection.UrlKeyDefaultValueCheckbox}}" stepKey="uncheckRedirect2"/>
65-
<fillField selector="{{AdminCategorySEOSection.UrlKeyInput}}" userInput="$simpleSubCategory1.custom_attributes[url_key]$-new" stepKey="changeURLKey"/>
66-
<checkOption selector="{{AdminCategorySEOSection.UrlKeyRedirectCheckbox}}" stepKey="checkUrlKeyRedirect"/>
67-
<!-- 4. Save Category 1 -->
68-
<click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="saveCategory"/>
69-
<seeElement selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="assertSuccessMessageAfterSaved"/>
70-
68+
<!-- 4. Change URL key for category and save changes -->
69+
<actionGroup ref="ChangeSeoUrlKeyForSubCategoryActionGroup" stepKey="changeFirstCategoryUrlKey">
70+
<argument name="value" value="$simpleSubCategory1.custom_attributes[url_key]$new"/>
71+
</actionGroup>
7172
<!-- 5. Open Marketing - SEO & Search - URL Rewrites -->
72-
<amOnPage url="{{AdminUrlRewriteIndexPage.url}}" stepKey="amOnUrlRewriteIndexPage2"/>
73-
<click selector="{{AdminDataGridHeaderSection.filters}}" stepKey="openUrlRewriteGridFilters1"/>
74-
<fillField selector="{{AdminDataGridHeaderSection.filterFieldInput('request_path')}}" userInput="$createSimpleProduct.custom_attributes[url_key]$.html" stepKey="inputProductName2"/>
75-
<click selector="{{AdminDataGridHeaderSection.applyFilters}}" stepKey="clickOrderApplyFilters1"/>
76-
<waitForPageLoad stepKey="waitForPageToLoad1"/>
77-
<seeElement selector="{{AdminUrlRewriteIndexSection.gridCellByColumnValue('Request Path', $createSimpleProduct.custom_attributes[url_key]$.html)}}" stepKey="seeInListValue1"/>
78-
<seeElement selector="{{AdminUrlRewriteIndexSection.gridCellByColumnValue('Request Path', $simpleSubCategory1.custom_attributes[url_key]$/$createSimpleProduct.custom_attributes[url_key]$.html)}}" stepKey="seeInListValue2"/>
79-
<seeElement selector="{{AdminUrlRewriteIndexSection.gridCellByColumnValue('Request Path', $simpleSubCategory1.custom_attributes[url_key]$/$simpleSubCategory2.custom_attributes[url_key]$/$createSimpleProduct.custom_attributes[url_key]$.html)}}" stepKey="seeInListValue3"/>
80-
<seeElement selector="{{AdminUrlRewriteIndexSection.gridCellByColumnValue('Request Path', $simpleSubCategory1.custom_attributes[url_key]$/$simpleSubCategory2.custom_attributes[url_key]$/$simpleSubCategory3.custom_attributes[url_key]$/$createSimpleProduct.custom_attributes[url_key]$.html)}}" stepKey="seeInListValue4"/>
81-
<seeElement selector="{{AdminUrlRewriteIndexSection.gridCellByColumnValue('Request Path', $simpleSubCategory1.custom_attributes[url_key]$-new/$createSimpleProduct.custom_attributes[url_key]$.html)}}" stepKey="seeInListValue5"/>
82-
<seeElement selector="{{AdminUrlRewriteIndexSection.gridCellByColumnValue('Request Path', $simpleSubCategory1.custom_attributes[url_key]$-new/$simpleSubCategory2.custom_attributes[url_key]$/$createSimpleProduct.custom_attributes[url_key]$.html)}}" stepKey="seeInListValue6"/>
83-
<seeElement selector="{{AdminUrlRewriteIndexSection.gridCellByColumnValue('Request Path', $simpleSubCategory1.custom_attributes[url_key]$-new/$simpleSubCategory2.custom_attributes[url_key]$/$simpleSubCategory3.custom_attributes[url_key]$/$createSimpleProduct.custom_attributes[url_key]$.html)}}" stepKey="seeInListValue7"/>
73+
<actionGroup ref="AdminSearchUrlRewriteByRequestPathActionGroup" stepKey="searchingUrlRewriteSecondTime">
74+
<argument name="requestPath" value="$createSimpleProduct.custom_attributes[url_key]$.html"/>
75+
</actionGroup>
76+
<actionGroup ref="AssertAdminRequestPathInUrlRewriteGrigActionGroup" stepKey="seeInListValueOne">
77+
<argument name="requestPath" value="$createSimpleProduct.custom_attributes[url_key]$.html"/>
78+
</actionGroup>
79+
<actionGroup ref="AssertAdminRequestPathInUrlRewriteGrigActionGroup" stepKey="seeInListValueTwo">
80+
<argument name="requestPath" value="$simpleSubCategory1.custom_attributes[url_key]$/$createSimpleProduct.custom_attributes[url_key]$.html"/>
81+
</actionGroup>
82+
<actionGroup ref="AssertAdminRequestPathInUrlRewriteGrigActionGroup" stepKey="seeInListValuethree">
83+
<argument name="requestPath" value="$simpleSubCategory1.custom_attributes[url_key]$/$simpleSubCategory2.custom_attributes[url_key]$/$createSimpleProduct.custom_attributes[url_key]$.html"/>
84+
</actionGroup>
85+
<actionGroup ref="AssertAdminRequestPathInUrlRewriteGrigActionGroup" stepKey="seeInListValueFour">
86+
<argument name="requestPath" value="$simpleSubCategory1.custom_attributes[url_key]$/$simpleSubCategory2.custom_attributes[url_key]$/$simpleSubCategory3.custom_attributes[url_key]$/$createSimpleProduct.custom_attributes[url_key]$.html"/>
87+
</actionGroup>
88+
<actionGroup ref="AssertAdminRequestPathInUrlRewriteGrigActionGroup" stepKey="seeInListValueFive">
89+
<argument name="requestPath" value="$simpleSubCategory1.custom_attributes[url_key]$new/$createSimpleProduct.custom_attributes[url_key]$.html"/>
90+
</actionGroup>
91+
<actionGroup ref="AssertAdminRequestPathInUrlRewriteGrigActionGroup" stepKey="seeInListValue1Six">
92+
<argument name="requestPath" value="$simpleSubCategory1.custom_attributes[url_key]$new/$simpleSubCategory2.custom_attributes[url_key]$/$createSimpleProduct.custom_attributes[url_key]$.html"/>
93+
</actionGroup>
94+
<actionGroup ref="AssertAdminRequestPathInUrlRewriteGrigActionGroup" stepKey="seeInListValueSeven">
95+
<argument name="requestPath" value="$simpleSubCategory1.custom_attributes[url_key]$new/$simpleSubCategory2.custom_attributes[url_key]$/$simpleSubCategory3.custom_attributes[url_key]$/$createSimpleProduct.custom_attributes[url_key]$.html"/>
96+
</actionGroup>
8497
</test>
8598
</tests>

app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUrlRewritesForProductInAnchorCategoriesTest/AdminUrlRewritesForProductInAnchorCategoriesTestAllStoreViewTest.xml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,13 @@
2828
</before>
2929
<remove keyForRemoval="switchStoreView"/>
3030
<!-- 3. Edit Category 1 for All store view: -->
31-
<actionGroup ref="NavigateToCreatedCategoryActionGroup" stepKey="goToCategoryPage" after="seeValue4">
31+
<actionGroup ref="NavigateToCreatedCategoryActionGroup" stepKey="goToCategoryPage" after="seeValueFour">
3232
<argument name="Category" value="$$simpleSubCategory1$$"/>
3333
</actionGroup>
34-
<remove keyForRemoval="uncheckRedirect2"/>
34+
<remove keyForRemoval="changeFirstCategoryUrlKey"/>
35+
<!-- 4. Change URL key for category and save changes -->
36+
<actionGroup ref="ChangeSeoUrlKeyActionGroup" stepKey="changeCategoryUrlKey" after="goToCategoryPage">
37+
<argument name="value" value="$simpleSubCategory1.custom_attributes[url_key]$new"/>
38+
</actionGroup>
3539
</test>
3640
</tests>

0 commit comments

Comments
 (0)