Skip to content

Commit ce394ef

Browse files
committed
Refactoring AdminUrlRewritesForProductsWithConfigurationTurnedOffTest
1 parent f824b9e commit ce394ef

5 files changed

+109
-9
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>
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="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)}}"
20+
stepKey="valueInNotShownInGrid"/>
21+
</actionGroup>
22+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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="AssertStorefrontProductRedirectWithoutSkuValidationActionGroup"
12+
extends="AssertStorefrontProductRedirectActionGroup">
13+
<annotations>
14+
<description>EXTENDS: torefrontProductRedirect. Removes 'seeProductSkuInStoreFrontPage'.</description>
15+
</annotations>
16+
<arguments>
17+
<argument name="productName" type="string"/>
18+
<argument name="productSku" type="string"/>
19+
<argument name="productRequestPath" type="string"/>
20+
</arguments>
21+
22+
<remove keyForRemoval="seeProductSkuInStoreFrontPage"/>
23+
</actionGroup>
24+
</actionGroups>

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

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,26 @@
4141
<!--Flush cache-->
4242
<magentoCLI command="cache:flush" stepKey="cleanCache2"/>
4343
</after>
44+
4445
<!-- 1. Log in to Admin -->
4546
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
47+
4648
<!-- 2. 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="seeProducturl"/>
53-
<dontSeeElement selector="{{AdminUrlRewriteIndexSection.gridCellByColumnValue('Request Path', $simpleSubCategory1.custom_attributes[url_key]$/$createSimpleProduct.custom_attributes[url_key]$.html)}}" stepKey="dontSeeCategoryProducturlKey"/>
54-
<amOnPage url="/$simpleSubCategory1.custom_attributes[url_key]$/$createSimpleProduct.custom_attributes[url_key]$.html" stepKey="navigateToProductPage"/>
55-
<see selector="{{StorefrontProductInfoMainSection.productName}}" userInput="$$createSimpleProduct.name$$" stepKey="seeProductName"/>
49+
<actionGroup ref="AdminSearchUrlRewriteByRequestPathActionGroup" stepKey="searchingUrlRewrite">
50+
<argument name="requestPath" value="$createSimpleProduct.custom_attributes[url_key]$.html"/>
51+
</actionGroup>
52+
<actionGroup ref="AssertAdminRequestPathInUrlRewriteGrigActionGroup" stepKey="seeProductUrlInGrid">
53+
<argument name="requestPath" value="$createSimpleProduct.custom_attributes[url_key]$.html"/>
54+
</actionGroup>
55+
<actionGroup ref="AssertAdminRequestPathIsNotFoundInUrlRewriteGrigActionGroup" stepKey="categoryProductUrlIsNotShown">
56+
<argument name="requestPath" value="$simpleSubCategory1.custom_attributes[url_key]$/$createSimpleProduct.custom_attributes[url_key]$.html"/>
57+
</actionGroup>
58+
59+
<!-- 3. Assert the Redirect works and Product is present on StoreFront-->
60+
<actionGroup ref="AssertStorefrontProductRedirectWithoutSkuValidationActionGroup" stepKey="verifyProductInStoreFrontPage">
61+
<argument name="productName" value="$$createSimpleProduct.name$$"/>
62+
<argument name="productSku" value="$$createSimpleProduct.sku$$"/>
63+
<argument name="productRequestPath" value="/$simpleSubCategory1.custom_attributes[url_key]$/$createSimpleProduct.custom_attributes[url_key]$.html"/>
64+
</actionGroup>
5665
</test>
5766
</tests>

0 commit comments

Comments
 (0)