Skip to content

Commit 8b26e74

Browse files
committed
MC-16330: Clear url_rewrites for Simple Products in Categories When Auto Generation Switched Off
1 parent a14c4a8 commit 8b26e74

File tree

1 file changed

+15
-48
lines changed

1 file changed

+15
-48
lines changed

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

Lines changed: 15 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
* See COPYING.txt for license details.
66
*/
77
-->
8-
98
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
109
<test name="AdminGenerateUrlRewritesForProductInCategoriesSwitchOffTest">
1110
<annotations>
@@ -18,62 +17,33 @@
1817
<group value="urlRewrite"/>
1918
</annotations>
2019

21-
<!-- Preconditions-->
2220
<before>
2321
<!-- Set the configuration for Generate "category/product" URL Rewrites-->
2422
<comment userInput="Enable config to generate category/product URL Rewrites" stepKey="commentEnableConfig" />
2523
<magentoCLI command="config:set catalog/seo/generate_category_product_rewrites 1" stepKey="enableGenerateUrlRewrite"/>
2624
<!--Flush cache-->
2725
<magentoCLI command="cache:flush" stepKey="cleanCache1"/>
28-
<!-- Create 4 categories -->
29-
<createData entity="SimpleSubCategory" stepKey="simpleSubCategory0"/>
30-
<createData entity="SimpleSubCategory" stepKey="simpleSubCategory1"/>
31-
<createData entity="SubCategoryWithParent" stepKey="simpleSubCategory2">
32-
<requiredEntity createDataKey="simpleSubCategory1"/>
33-
</createData>
34-
<createData entity="SubCategoryWithParent" stepKey="simpleSubCategory3">
35-
<requiredEntity createDataKey="simpleSubCategory2"/>
36-
</createData>
37-
<!-- Create Simple product 1 and assign it to Category 3 and 0 -->
38-
<createData entity="ApiSimpleProduct" stepKey="createSimpleProduct">
39-
<requiredEntity createDataKey="simpleSubCategory3"/>
40-
<requiredEntity createDataKey="simpleSubCategory0"/>
26+
27+
<actionGroup ref="LoginAsAdmin" stepKey="login"/>
28+
<createData entity="SimpleSubCategory" stepKey="createCategory"/>
29+
<createData entity="SimpleProduct" stepKey="createSimpleProduct">
30+
<requiredEntity createDataKey="createCategory"/>
4131
</createData>
4232
</before>
4333
<after>
44-
<deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/>
45-
<deleteData createDataKey="simpleSubCategory1" stepKey="deletesimpleSubCategory1"/>
46-
<deleteData createDataKey="simpleSubCategory0" stepKey="deletesimpleSubCategory0"/>
47-
<amOnPage url="{{AdminLogoutPage.url}}" stepKey="amOnLogoutPage"/>
34+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
35+
<deleteData createDataKey="createSimpleProduct" stepKey="deleteProduct"/>
36+
<actionGroup ref="logout" stepKey="logout"/>
4837
</after>
49-
<!-- Steps -->
50-
<!-- 1. Log in to Admin -->
51-
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
52-
<!-- 2. Open Marketing - SEO & Search - URL Rewrites -->
38+
39+
<!-- 1. Open Marketing - SEO & Search - URL Rewrites -->
5340
<amOnPage url="{{AdminUrlRewriteIndexPage.url}}" stepKey="amOnUrlRewriteIndexPage"/>
5441
<fillField selector="{{AdminUrlRewriteIndexSection.requestPathFilter}}" userInput="$createSimpleProduct.custom_attributes[url_key]$.html" stepKey="inputProductName"/>
5542
<click selector="{{AdminDataGridHeaderSection.applyFilters}}" stepKey="clickSearchButton"/>
5643
<seeElement selector="{{AdminUrlRewriteIndexSection.requestPathColumnValue($createSimpleProduct.custom_attributes[url_key]$.html)}}" stepKey="seeValue1"/>
57-
<seeElement selector="{{AdminUrlRewriteIndexSection.requestPathColumnValue($simpleSubCategory0.custom_attributes[url_key]$/$createSimpleProduct.custom_attributes[url_key]$.html)}}" stepKey="seeValue2"/>
58-
<seeElement selector="{{AdminUrlRewriteIndexSection.requestPathColumnValue($simpleSubCategory1.custom_attributes[url_key]$/$createSimpleProduct.custom_attributes[url_key]$.html)}}" stepKey="seeValue3"/>
59-
<seeElement selector="{{AdminUrlRewriteIndexSection.requestPathColumnValue($simpleSubCategory1.custom_attributes[url_key]$/$simpleSubCategory2.custom_attributes[url_key]$/$createSimpleProduct.custom_attributes[url_key]$.html)}}" stepKey="seeValue4"/>
60-
<seeElement selector="{{AdminUrlRewriteIndexSection.requestPathColumnValue($simpleSubCategory1.custom_attributes[url_key]$/$simpleSubCategory2.custom_attributes[url_key]$/$simpleSubCategory3.custom_attributes[url_key]$/$createSimpleProduct.custom_attributes[url_key]$.html)}}" stepKey="seeValue5"/>
61-
62-
<!-- 3. Edit Category 2 for Default Store View: -->
63-
<actionGroup ref="switchCategoryStoreView" stepKey="switchStoreView">
64-
<argument name="Store" value="_defaultStore.name"/>
65-
<argument name="CatName" value="$$simpleSubCategory0.name$$"/>
66-
</actionGroup>
67-
<click selector="{{AdminCategorySEOSection.SectionHeader}}" stepKey="openSeoSection2"/>
68-
<uncheckOption selector="{{AdminCategorySEOSection.UrlKeyDefaultValueCheckbox}}" stepKey="uncheckRedirect2"/>
69-
<fillField selector="{{AdminCategorySEOSection.UrlKeyInput}}" userInput="$simpleSubCategory0.custom_attributes[url_key]$-new" stepKey="changeURLKey"/>
70-
<checkOption selector="{{AdminCategorySEOSection.UrlKeyRedirectCheckbox}}" stepKey="checkUrlKeyRedirect"/>
71-
72-
<!-- 4. Save Category 2 -->
73-
<click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="saveCategory"/>
74-
<seeElement selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="assertSuccessMessageAfterSaved"/>
44+
<seeElement selector="{{AdminUrlRewriteIndexSection.requestPathColumnValue($createCategory.custom_attributes[url_key]$/$createSimpleProduct.custom_attributes[url_key]$.html)}}" stepKey="seeValue2"/>
7545

76-
<!-- 5. Set the configuration for Generate "category/product" URL Rewrites to No-->
46+
<!-- 2. Set the configuration for Generate "category/product" URL Rewrites to No-->
7747
<amOnPage url="{{CatalogConfigPage.url}}" stepKey="amOnCatalogConfigPage"/>
7848
<conditionalClick selector="{{CatalogSection.seo}}" dependentSelector="{{CatalogSection.CheckIfSeoTabExpand}}" visible="true" stepKey="expandSeoTab" />
7949
<waitForElementVisible selector="{{CatalogSection.GenerateUrlRewrites}}" stepKey="GenerateUrlRewritesSelect"/>
@@ -83,17 +53,14 @@
8353
<click selector="{{CatalogSection.save}}" stepKey="saveConfig" />
8454
<waitForPageLoad stepKey="waitForSavingSystemConfiguration"/>
8555

86-
<!-- 6. Flush cache-->
56+
<!-- 3. Flush cache-->
8757
<magentoCLI command="cache:flush" stepKey="cleanCache"/>
8858

89-
<!-- 7. Open Marketing - SEO & Search - URL Rewrites -->
59+
<!-- 4. Open Marketing - SEO & Search - URL Rewrites -->
9060
<amOnPage url="{{AdminUrlRewriteIndexPage.url}}" stepKey="amOnUrlRewriteIndexPage2"/>
9161
<fillField selector="{{AdminUrlRewriteIndexSection.requestPathFilter}}" userInput="$createSimpleProduct.custom_attributes[url_key]$.html" stepKey="inputProductName2"/>
9262
<click selector="{{AdminDataGridHeaderSection.applyFilters}}" stepKey="clickSearchButton2"/>
9363
<seeElement selector="{{AdminUrlRewriteIndexSection.requestPathColumnValue($createSimpleProduct.custom_attributes[url_key]$.html)}}" stepKey="seeInListValue1"/>
94-
<dontSeeElement selector="{{AdminUrlRewriteIndexSection.requestPathColumnValue($simpleSubCategory1.custom_attributes[url_key]$/$createSimpleProduct.custom_attributes[url_key]$.html)}}" stepKey="dontSeeValue2"/>
95-
<dontSeeElement selector="{{AdminUrlRewriteIndexSection.requestPathColumnValue($simpleSubCategory1.custom_attributes[url_key]$/$simpleSubCategory2.custom_attributes[url_key]$/$createSimpleProduct.custom_attributes[url_key]$.html)}}" stepKey="dontSeeValue3"/>
96-
<dontSeeElement selector="{{AdminUrlRewriteIndexSection.requestPathColumnValue($simpleSubCategory1.custom_attributes[url_key]$/$simpleSubCategory2.custom_attributes[url_key]$/$simpleSubCategory3.custom_attributes[url_key]$/$createSimpleProduct.custom_attributes[url_key]$.html)}}" stepKey="dontSeeValue4"/>
97-
<seeElement selector="{{AdminUrlRewriteIndexSection.requestPathColumnValue($simpleSubCategory0.custom_attributes[url_key]$-new/$createSimpleProduct.custom_attributes[url_key]$.html)}}" stepKey="seeRedirect2"/>
64+
<dontSeeElement selector="{{AdminUrlRewriteIndexSection.requestPathColumnValue($createCategory.custom_attributes[url_key]$/$createSimpleProduct.custom_attributes[url_key]$.html)}}" stepKey="dontSeeValue2"/>
9865
</test>
9966
</tests>

0 commit comments

Comments
 (0)