Skip to content

Commit 12055f9

Browse files
committed
Remove active category in the cache key
- Add functional tests coverage;
1 parent 44f8890 commit 12055f9

File tree

2 files changed

+310
-37
lines changed

2 files changed

+310
-37
lines changed

app/code/Magento/Catalog/Test/Mftf/Test/StorefrontCatalogNavigationMenuHighlightingTest.xml renamed to app/code/Magento/Catalog/Test/Mftf/Test/StorefrontNoStoreCodeNoCategoryPathHtmlSuffixNavigationTest.xml

Lines changed: 24 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -7,34 +7,28 @@
77
-->
88

99
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10-
<test name="StorefrontCatalogNavigationMenuHighlightingTest">
10+
<test name="StorefrontNoStoreCodeNoCategoryPathHtmlSuffixNavigationTest">
1111
<annotations>
1212
<features value="Catalog"/>
13-
<stories value="Navigation Menu Category Highlighting"/>
14-
<title value="Validation of Category Highlighting in Storefront Navigation Menu"/>
15-
<description value="This test verifies that the correct category is highlighted in the navigation menu when navigating through categories and products on the storefront. It covers different configurations regarding store codes and category paths in URLs."/>
13+
<stories value="Navigation Menu Highlighting with .html Suffix, No Store Code, No Category Path"/>
14+
<title value="Validation of Navigation Menu Highlighting with .html Suffix, No Store Code and No Category Path in URLs"/>
15+
<description value="This test verifies that the correct category is highlighted in the navigation menu when navigating through categories and products on the storefront, specifically with .html URL suffixes and the settings 'Add Store Code to Urls: No' and 'Use Categories Path for Product URLs: No'. The test focuses on the impact of these configurations on category highlighting."/>
1616
<testCaseId value="AC-10833"/>
1717
<severity value="MAJOR"/>
1818
<group value="catalog"/>
1919
<group value="theme"/>
2020
</annotations>
2121
<before>
2222
<!-- Create categories -->
23+
<createData entity="ApiCategory" stepKey="category_0"/>
2324
<createData entity="ApiCategory" stepKey="category_1"/>
24-
<createData entity="ApiCategory" stepKey="category_2"/>
2525
<createData entity="SubCategoryWithParent" stepKey="category_1_1">
2626
<requiredEntity createDataKey="category_1"/>
2727
</createData>
2828
<createData entity="NewSubCategoryWithParent" stepKey="category_1_2">
2929
<requiredEntity createDataKey="category_1"/>
3030
</createData>
31-
<!-- Create products in the categories -->
32-
<createData entity="ApiSimpleProduct" stepKey="product_1">
33-
<requiredEntity createDataKey="category_1"/>
34-
</createData>
35-
<createData entity="ApiSimpleProduct" stepKey="product_2">
36-
<requiredEntity createDataKey="category_2"/>
37-
</createData>
31+
<!-- Create products -->
3832
<createData entity="ApiSimpleProduct" stepKey="product_1_1">
3933
<requiredEntity createDataKey="category_1_1"/>
4034
</createData>
@@ -49,34 +43,26 @@
4943
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex">
5044
<argument name="indices" value=""/>
5145
</actionGroup>
52-
</before>
53-
<after>
54-
<!-- Delete categories and products -->
55-
<deleteData createDataKey="category_1" stepKey="deleteCategory1" />
56-
<deleteData createDataKey="category_2" stepKey="deleteCategory2" />
57-
<deleteData createDataKey="product_1" stepKey="deleteProduct1" />
58-
<deleteData createDataKey="product_2" stepKey="deleteProduct2" />
59-
<deleteData createDataKey="product_1_1" stepKey="deleteProduct_1_1" />
60-
<deleteData createDataKey="product_1_2" stepKey="deleteProduct_1_2" />
61-
<deleteData createDataKey="product_1_1_1_2" stepKey="deleteProduct_1_1_1_2" />
46+
<!-- Set url suffixes -->
47+
<magentoCLI command="config:set catalog/seo/category_url_suffix .html" stepKey="setCategoryUrlSuffix"/>
48+
<magentoCLI command="config:set catalog/seo/product_url_suffix .html" stepKey="setProductUrlSuffix"/>
6249
<!-- Set "Add Store Code to Urls": No -->
6350
<magentoCLI command="config:set {{StorefrontDisableAddStoreCodeToUrls.path}} {{StorefrontDisableAddStoreCodeToUrls.value}}" stepKey="disableStoreCodeToUrls"/>
6451
<!-- Set "Use Categories Path for Product URLs": No -->
6552
<magentoCLI command="config:set {{DisableCategoriesPathForProductUrls.path}} {{DisableCategoriesPathForProductUrls.value}}" stepKey="disableCategoriesPathForProductUrls"/>
6653
<!-- Flush needed cache -->
6754
<actionGroup ref="CliCacheFlushActionGroup" stepKey="flushCacheAfterChangingConfig">
68-
<argument name="tags" value="config full_page"/>
55+
<argument name="tags" value=""/>
6956
</actionGroup>
57+
</before>
58+
<after>
59+
<!-- Delete categories and products -->
60+
<deleteData createDataKey="category_0" stepKey="deleteCategory0" />
61+
<deleteData createDataKey="category_1" stepKey="deleteCategory1" />
62+
<deleteData createDataKey="product_1_1" stepKey="deleteProduct_1_1" />
63+
<deleteData createDataKey="product_1_2" stepKey="deleteProduct_1_2" />
64+
<deleteData createDataKey="product_1_1_1_2" stepKey="deleteProduct_1_1_1_2" />
7065
</after>
71-
<!-- Set "Add Store Code to Urls": No -->
72-
<magentoCLI command="config:set {{StorefrontDisableAddStoreCodeToUrls.path}} {{StorefrontDisableAddStoreCodeToUrls.value}}" stepKey="disableStoreCodeToUrls"/>
73-
<!-- Set "Use Categories Path for Product URLs": No -->
74-
<magentoCLI command="config:set {{DisableCategoriesPathForProductUrls.path}} {{DisableCategoriesPathForProductUrls.value}}" stepKey="disableCategoriesPathForProductUrls"/>
75-
<!-- Flush needed cache -->
76-
<actionGroup ref="CliCacheFlushActionGroup" stepKey="flushCacheAfterChangingConfig">
77-
<argument name="tags" value="config full_page"/>
78-
</actionGroup>
79-
8066
<!-- Open storefront homepage -->
8167
<actionGroup ref="StorefrontOpenHomePageActionGroup" stepKey="openStorefrontPage"/>
8268

@@ -127,6 +113,7 @@
127113
<actualResult type="const">$highlightedParentCategoryAmount_Try2</actualResult>
128114
<expectedResult type="int">1</expectedResult>
129115
</assertEquals>
116+
130117
<!-- From Category 1.1 page open product assigned to both Category 1_1 & Category 1_2 -->
131118
<actionGroup ref="StorefrontOpenProductFromCategoryPageActionGroup" stepKey="openProductFromCategoryPage">
132119
<argument name="productName" value="$product_1_1_1_2.name$"/>
@@ -137,7 +124,7 @@
137124
<actionGroup ref="StorefrontAssertProductSkuOnProductPageActionGroup" stepKey="seeCorrectSku">
138125
<argument name="productSku" value="$product_1_1_1_2.sku$"/>
139126
</actionGroup>
140-
<!-- Check if parent Category 1 has 'has-active' class and selected Category 1.1 child category has 'active' class -->
127+
<!-- Check if parent Category 1 has 'has-active' class and Category 1.1 child category has 'active' class -->
141128
<grabAttributeFrom selector="{{AdminCategorySidebarTreeSection.categoryHighlighted($$category_1.name$$)}}" userInput="class" stepKey="grabCategory_1_Class_Try2"/>
142129
<assertStringContainsString stepKey="assertCategory_1_HasActive_Try2">
143130
<actualResult type="const">$grabCategory_1_Class_Try2</actualResult>
@@ -175,7 +162,7 @@
175162
<expectedResult type="int">0</expectedResult>
176163
</assertEquals>
177164

178-
<!-- Click on Category 1_2 -->
165+
<!-- Open Category 1_2 -->
179166
<moveMouseOver selector="{{StorefrontHeaderSection.NavigationCategoryByName($$category_1.name$$)}}" stepKey="hoverOverCategory1_Try2"/>
180167
<click selector="{{AdminCategorySidebarTreeSection.categoryInFrontendTree($$category_1_2.name$$)}}" stepKey="clickCategory_1_2_Name"/>
181168
<waitForPageLoad stepKey="waitForCategory_1_2_Page"/>
@@ -205,7 +192,7 @@
205192
<!-- Open direct Category 1.2 url -->
206193
<amOnPage url="/$$category_1.custom_attributes[url_key]$$/$$category_1_2.custom_attributes[url_key]$$.html" stepKey="openCategoryPageDirectly"/>
207194
<waitForPageLoad stepKey="waitForCategoryStoreFrontPageToLoad"/>
208-
<!-- Check if parent Category 1 has 'has-active' class and selected Category 1.2 child category has 'active' class -->
195+
<!-- Check if parent Category 1 has 'has-active' class and Category 1.2 child category has 'active' class -->
209196
<grabAttributeFrom selector="{{AdminCategorySidebarTreeSection.categoryHighlighted($$category_1.name$$)}}" userInput="class" stepKey="grabCategory_1_Class_Try4"/>
210197
<assertStringContainsString stepKey="assertCategory_1_HasActive_Try4">
211198
<actualResult type="const">$grabCategory_1_Class_Try4</actualResult>
@@ -238,7 +225,7 @@
238225
<actionGroup ref="StorefrontAssertProductSkuOnProductPageActionGroup" stepKey="seeCorrectSku_Try2">
239226
<argument name="productSku" value="$product_1_1_1_2.sku$"/>
240227
</actionGroup>
241-
<!-- Check if parent Category 1 has 'has-active' class and selected Category 1.2 child category has 'active' class -->
228+
<!-- Check if parent Category 1 has 'has-active' class and Category 1.2 child category has 'active' class -->
242229
<grabAttributeFrom selector="{{AdminCategorySidebarTreeSection.categoryHighlighted($$category_1.name$$)}}" userInput="class" stepKey="grabCategory_1_Class_Try5"/>
243230
<assertStringContainsString stepKey="assertCategory_1_HasActive_Try5">
244231
<actualResult type="const">$grabCategory_1_Class_Try5</actualResult>
@@ -261,7 +248,7 @@
261248
<expectedResult type="int">1</expectedResult>
262249
</assertEquals>
263250

264-
<!-- Open Product (assigned to both categories) page url directly -->
251+
<!-- Open product assigned to both Category 1_1 & Category 1_2 by its direct page url -->
265252
<actionGroup ref="OpenStoreFrontProductPageActionGroup" stepKey="openProductPageDirectly">
266253
<argument name="productUrlKey" value="$product_1_1_1_2.custom_attributes[url_key]$"/>
267254
</actionGroup>

0 commit comments

Comments
 (0)