Skip to content

Commit 9623f9a

Browse files
MC-6463: Product custom URL Key is preserved when assigned to a Category (with custom URL Key) alongside with another Product without custom URL Key
1 parent 56003dd commit 9623f9a

File tree

3 files changed

+153
-0
lines changed

3 files changed

+153
-0
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="AdminProductFormUpdateUrlKeyActionGroup">
12+
<annotations>
13+
<description>Update UrlKey for Product on Custom Store View.</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="newUrlKey" defaultValue="newUrlKey" type="string"/>
17+
</arguments>
18+
<conditionalClick selector="{{AdminProductSEOSection.sectionHeader}}" dependentSelector="{{AdminProductSEOSection.useDefaultUrl}}" visible="false" stepKey="clickOnSearchEngineOptimization"/>
19+
<waitForLoadingMaskToDisappear stepKey="waitLoadProductForm"/>
20+
<uncheckOption selector="{{AdminProductSEOSection.useDefaultUrl}}" stepKey="uncheckDefaultUrl"/>
21+
<fillField selector="{{AdminProductSEOSection.urlKeyInput}}" userInput="{{newUrlKey}}" stepKey="changeUrlKey"/>
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+
<!-- Check the simple product Url on the product page -->
12+
<actionGroup name="StorefrontCheckProductUrlActionGroup">
13+
<annotations>
14+
<description>Validates that the provided Simple Product Url is correct.</description>
15+
</annotations>
16+
<arguments>
17+
<argument name="productUrl" type="string"/>
18+
</arguments>
19+
<seeInCurrentUrl url="{{StorefrontProductPage.url(productUrl)}}" stepKey="checkUrl"/>
20+
</actionGroup>
21+
</actionGroups>
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
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+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10+
<test name="AdminProductCreateUrlRewriteForCustomStoreViewTest">
11+
<annotations>
12+
<features value="UrlRewrite"/>
13+
<stories value="Create Product"/>
14+
<title value="Product custom URL Key is preserved when assigned to a Category"/>
15+
<description value="Verify Product custom URL Key (for custom Store View) is preserved when assigned to a Category (with custom URL Key) alongside with another Product without custom URL Key"/>
16+
<testCaseId value="MC-6463"/>
17+
<severity value="MAJOR"/>
18+
<group value="mtf_migrated"/>
19+
</annotations>
20+
<before>
21+
<createData entity="_defaultCategory" stepKey="createCategory"/>
22+
<createData entity="SimpleProduct" stepKey="createProduct">
23+
<requiredEntity createDataKey="createCategory" />
24+
</createData>
25+
<createData entity="SimpleProduct" stepKey="createProductForUrlRewrite">
26+
<requiredEntity createDataKey="createCategory" />
27+
</createData>
28+
<actionGroup ref="LoginAsAdmin" stepKey="login"/>
29+
<!-- Create second store view-->
30+
<actionGroup ref="AdminCreateStoreViewActionGroup" stepKey="createCustomStoreView">
31+
<argument name="customStore" value="customStore"/>
32+
</actionGroup>
33+
</before>
34+
<after>
35+
<deleteData createDataKey="createProduct" stepKey="deleteProduct" />
36+
<deleteData createDataKey="createProductForUrlRewrite" stepKey="deleteProductForUrlRewrite" />
37+
<deleteData createDataKey="createCategory" stepKey="deleteCategory" />
38+
<actionGroup ref="AdminDeleteStoreViewActionGroup" stepKey="deleteStoreView">
39+
<argument name="customStore" value="customStore"/>
40+
</actionGroup>
41+
<actionGroup ref="AdminGridFilterResetActionGroup" stepKey="clearFilterForStores"/>
42+
<actionGroup ref="logout" stepKey="logout"/>
43+
</after>
44+
<!--Step 1. Navigate as Admin on Product Page for edit product`s Url Key-->
45+
<actionGroup ref="navigateToCreatedProductEditPage" stepKey="goToProductForUrlRewrite">
46+
<argument name="product" value="$$createProductForUrlRewrite$$"/>
47+
</actionGroup>
48+
<!--Step 2. As Admin switch on Custom Store View from Precondition -->
49+
<actionGroup ref="AdminSwitchStoreViewActionGroup" stepKey="switchToCustomStore">
50+
<argument name="storeView" value="customStore.name"/>
51+
</actionGroup>
52+
<!--Step 3. Set custom URL Key for product on Custom StoreView-->
53+
<actionGroup ref="AdminProductFormUpdateUrlKeyActionGroup" stepKey="updateUrlKeyForProduct">
54+
<argument name="newUrlKey" value="U2"/>
55+
</actionGroup>
56+
<actionGroup ref="saveProductForm" stepKey="saveProductWithNewUrl"/>
57+
<!--Step 4. Set URL Key for created category -->
58+
<actionGroup ref="navigateToCreatedCategory" stepKey="navigateToCreatedSubCategory">
59+
<argument name="Category" value="$$createCategory$$"/>
60+
</actionGroup>
61+
<actionGroup ref="ChangeSeoUrlKey" stepKey="updateUrlKeyForCategory">
62+
<argument name="value" value="U1"/>
63+
</actionGroup>
64+
<!--Step 5. On Storefront Assert what URL Key for Category is changed and is correct as for Default Store View -->
65+
<actionGroup ref="StorefrontNavigateCategoryPageActionGroup" stepKey="onCategoryPage">
66+
<argument name="category" value="$$createCategory$$"/>
67+
</actionGroup>
68+
<actionGroup ref="AssertStorefrontUrlRewriteRedirect" stepKey="assertUrlCategoryOnDefaultStore">
69+
<argument name="category" value="$$createCategory.name$$"/>
70+
<argument name="newRequestPath" value="u1.html"/>
71+
</actionGroup>
72+
<!--Step 6. On Storefront Assert what URL Key for product is correct(as initial URL) -->
73+
<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="amOnStorefrontProduct">
74+
<argument name="productUrl" value="$$createProduct.custom_attributes[url_key]$$"/>
75+
</actionGroup>
76+
<actionGroup ref="StorefrontCheckProductUrlActionGroup" stepKey="checkProductUrl">
77+
<argument name="productUrl" value="$$createProduct.custom_attributes[url_key]$$"/>
78+
</actionGroup>
79+
<!--Step 7. On Storefront Assert what URL Key for product is correct for Default Store View (as initial URL) -->
80+
<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="amOnStorefrontProductWithChangedUrl">
81+
<argument name="productUrl" value="$$createProductForUrlRewrite.custom_attributes[url_key]$$"/>
82+
</actionGroup>
83+
<actionGroup ref="StorefrontCheckProductUrlActionGroup" stepKey="checkProductWithChangedUrl">
84+
<argument name="productUrl" value="$$createProductForUrlRewrite.custom_attributes[url_key]$$"/>
85+
</actionGroup>
86+
<!--Step 8. On Storefront switch on created Custom Store View -->
87+
<actionGroup ref="StorefrontSwitchStoreViewActionGroup" stepKey="switchToCustomStoreViewOnStorefront">
88+
<argument name="storeView" value="customStore"/>
89+
</actionGroup>
90+
<!--Step 9. On Storefront Assert what URL Key for Category is changed and is correct for Custom Store View -->
91+
<actionGroup ref="AssertStorefrontUrlRewriteRedirect" stepKey="assertUrlCategoryOnCustomStore">
92+
<argument name="category" value="$$createCategory.name$$"/>
93+
<argument name="newRequestPath" value="u1.html"/>
94+
</actionGroup>
95+
<!--Step 10. On Storefront Assert what URL Key for product is correct for Custom Store View (as initial URL) -->
96+
<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="amOnCustomStoreProduct">
97+
<argument name="productUrl" value="$$createProduct.custom_attributes[url_key]$$"/>
98+
</actionGroup>
99+
<actionGroup ref="StorefrontCheckProductUrlActionGroup" stepKey="checkProductP1UrlonCustomStore">
100+
<argument name="productUrl" value="$$createProduct.custom_attributes[url_key]$$"/>
101+
</actionGroup>
102+
<!--Step 11. On Storefront Assert what URL Key for product is changed and is correct for Custom Store View -->
103+
<actionGroup ref="AssertStorefrontProductRedirect" stepKey="assertProductUrlRewriteInStoreFront">
104+
<argument name="productName" value="$$createProductForUrlRewrite.name$$"/>
105+
<argument name="productSku" value="$$createProductForUrlRewrite.sku$$"/>
106+
<argument name="productRequestPath" value="u2.html"/>
107+
</actionGroup>
108+
</test>
109+
</tests>

0 commit comments

Comments
 (0)