Skip to content

Commit 75a7d85

Browse files
committed
Refactoring AdminGenerateUrlRewritesForProductInCategoriesSwitchOffTest
1 parent f824b9e commit 75a7d85

4 files changed

+84
-22
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: 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="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)}}" stepKey="seeValueInGrid"/>
20+
</actionGroup>
21+
</actionGroups>
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="AssertAdminRequestPathIsNotFoundInUrlRewriteGrigActionGroup">
12+
<annotations>
13+
<description>Assert the requested path is not shown in the URL Rewrite grid.</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="requestPath" type="string"/>
17+
</arguments>
18+
19+
<dontSeeElement selector="{{AdminUrlRewriteIndexSection.gridCellByColumnValue('Request Path', requestPath)}}" stepKey="valueInNotShownInGrid"/>
20+
</actionGroup>
21+
</actionGroups>

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

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -44,34 +44,31 @@
4444
</after>
4545

4646
<!-- 1. Open Marketing - SEO & Search - URL Rewrites -->
47-
<amOnPage url="{{AdminUrlRewriteIndexPage.url}}" stepKey="amOnUrlRewriteIndexPage"/>
48-
<click selector="{{AdminDataGridHeaderSection.filters}}" stepKey="openUrlRewriteGridFilters"/>
49-
<fillField selector="{{AdminDataGridHeaderSection.filterFieldInput('request_path')}}" userInput="$createSimpleProduct.custom_attributes[url_key]$.html" stepKey="inputProductName"/>
50-
<click selector="{{AdminDataGridHeaderSection.applyFilters}}" stepKey="clickOrderApplyFilters"/>
51-
<waitForPageLoad stepKey="waitForPageToLoad"/>
52-
<seeElement selector="{{AdminUrlRewriteIndexSection.gridCellByColumnValue('Request Path', $createSimpleProduct.custom_attributes[url_key]$.html)}}" stepKey="seeValue1"/>
53-
<seeElement selector="{{AdminUrlRewriteIndexSection.gridCellByColumnValue('Request Path', $createCategory.custom_attributes[url_key]$/$createSimpleProduct.custom_attributes[url_key]$.html)}}" stepKey="seeValue2"/>
47+
<actionGroup ref="AdminSearchUrlRewriteByRequestPathActionGroup" stepKey="searchingUrlRewrite">
48+
<argument name="requestPath" value="$createSimpleProduct.custom_attributes[url_key]$.html"/>
49+
</actionGroup>
50+
<actionGroup ref="AssertAdminRequestPathInUrlRewriteGrigActionGroup" stepKey="seeProductUrlInGrid">
51+
<argument name="requestPath" value="$createSimpleProduct.custom_attributes[url_key]$.html"/>
52+
</actionGroup>
53+
<actionGroup ref="AssertAdminRequestPathInUrlRewriteGrigActionGroup" stepKey="seeCategoryUrlInGrid">
54+
<argument name="requestPath" value="$createCategory.custom_attributes[url_key]$/$createSimpleProduct.custom_attributes[url_key]$.html"/>
55+
</actionGroup>
5456

5557
<!-- 2. Set the configuration for Generate "category/product" URL Rewrites to No-->
56-
<amOnPage url="{{CatalogConfigPage.url}}" stepKey="amOnCatalogConfigPage"/>
57-
<conditionalClick selector="{{CatalogSection.seo}}" dependentSelector="{{CatalogSection.CheckIfSeoTabExpand}}" visible="true" stepKey="expandSeoTab" />
58-
<waitForElementVisible selector="{{CatalogSection.GenerateUrlRewrites}}" stepKey="GenerateUrlRewritesSelect"/>
59-
<selectOption userInput="0" selector="{{CatalogSection.GenerateUrlRewrites}}" stepKey="selectUrlGenerationNo" />
60-
<waitForElementVisible selector="{{GenerateUrlRewritesConfirm.title}}" stepKey="waitForConfirmModal"/>
61-
<click selector="{{GenerateUrlRewritesConfirm.ok}}" stepKey="confirmSwitchingGenerationOff"/>
62-
<click selector="{{CatalogSection.save}}" stepKey="saveConfig" />
63-
<waitForPageLoad stepKey="waitForSavingSystemConfiguration"/>
58+
<magentoCLI command="config:set catalog/seo/generate_category_product_rewrites 0" stepKey="disableGenerateUrlRewrite"/>
6459

6560
<!-- 3. Flush cache-->
6661
<magentoCLI command="cache:flush" stepKey="cleanCache"/>
6762

6863
<!-- 4. Open Marketing - SEO & Search - URL Rewrites -->
69-
<amOnPage url="{{AdminUrlRewriteIndexPage.url}}" stepKey="amOnUrlRewriteIndexPage2"/>
70-
<click selector="{{AdminDataGridHeaderSection.filters}}" stepKey="openUrlRewriteGridFilters1"/>
71-
<fillField selector="{{AdminDataGridHeaderSection.filterFieldInput('request_path')}}" userInput="$createSimpleProduct.custom_attributes[url_key]$.html" stepKey="inputProductName2"/>
72-
<click selector="{{AdminDataGridHeaderSection.applyFilters}}" stepKey="clickOrderApplyFilters1"/>
73-
<waitForPageLoad stepKey="waitForPageToLoad1"/>
74-
<seeElement selector="{{AdminUrlRewriteIndexSection.gridCellByColumnValue('Request Path', $createSimpleProduct.custom_attributes[url_key]$.html)}}" stepKey="seeInListValue1"/>
75-
<dontSeeElement selector="{{AdminUrlRewriteIndexSection.gridCellByColumnValue('Request Path', $createCategory.custom_attributes[url_key]$/$createSimpleProduct.custom_attributes[url_key]$.html)}}" stepKey="dontSeeValue2"/>
64+
<actionGroup ref="AdminSearchUrlRewriteByRequestPathActionGroup" stepKey="searchingUrlRewriteAfterDisablingTheConfig">
65+
<argument name="requestPath" value="$createSimpleProduct.custom_attributes[url_key]$.html"/>
66+
</actionGroup>
67+
<actionGroup ref="AssertAdminRequestPathInUrlRewriteGrigActionGroup" stepKey="seeProductUrlInGridAfterDisablingTheConfig">
68+
<argument name="requestPath" value="$createSimpleProduct.custom_attributes[url_key]$.html"/>
69+
</actionGroup>
70+
<actionGroup ref="AssertAdminRequestPathIsNotFoundInUrlRewriteGrigActionGroup" stepKey="categoryUrlIsNotShownAfterDisablingTheConfig">
71+
<argument name="requestPath" value="$createCategory.custom_attributes[url_key]$/$createSimpleProduct.custom_attributes[url_key]$.html"/>
72+
</actionGroup>
7673
</test>
7774
</tests>

0 commit comments

Comments
 (0)