Skip to content

Commit c9d1ea8

Browse files
committed
ACP2E-4208: "Confirm Form Resubmission" on Catalog Search with "Remember Category Pagination"
1 parent a2b6d98 commit c9d1ea8

File tree

3 files changed

+27
-7
lines changed

3 files changed

+27
-7
lines changed

app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontSearchSetDefaultDisplaySettingsActionGroup.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,12 @@
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
1111
<actionGroup name="StorefrontSearchSetDefaultDisplaySettingsActionGroup">
1212
<annotations>
13-
<description>Sets search display to default settings: grid mode, relevance descending, 12 items per page</description>
13+
<description>Sets search display to default settings: grid mode, relevance descending, 12 items per page. Fails if not on search results page.</description>
1414
</annotations>
1515

16+
<!-- Check if we're on the search results page -->
17+
<seeInCurrentUrl url="{{StorefrontCatalogSearchPage.url}}" stepKey="verifyOnSearchPage"/>
18+
1619
<!-- Set display mode to grid (default) -->
1720
<click selector="{{StorefrontSearchTopToolbarSection.gridMode}}" stepKey="selectGridMode"/>
1821
<waitForPageLoad stepKey="waitForGridModeApplied"/>

app/code/Magento/CatalogSearch/Test/Mftf/Section/StorefrontSearchTopToolbarSection.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
1111
<section name="StorefrontSearchTopToolbarSection">
1212
<element name="searchResultsToolbar" type="block" selector=".toolbar.toolbar-products" timeout="30"/>
13-
<element name="gridMode" type="button" selector=".//*[@class='toolbar toolbar-products'][1]//*[@data-value='grid']" timeout="30"/>
14-
<element name="listMode" type="button" selector=".//*[@class='toolbar toolbar-products'][1]//*[@data-value='list']" timeout="30"/>
15-
<element name="sortByDropdown" type="select" selector=".catalogsearch-result-index .toolbar-products #sorter" timeout="30"/>
16-
<element name="sortDirectionAsc" type="button" selector=".//*[@class='toolbar toolbar-products'][1]//a[contains(@class, 'sort-asc')]" timeout="30"/>
17-
<element name="sortDirectionDesc" type="button" selector=".//*[@class='toolbar toolbar-products'][1]//a[contains(@class, 'sort-desc')]" timeout="30"/>
18-
<element name="showDropdown" type="select" selector=".catalogsearch-result-index .toolbar-products #limiter" timeout="30"/>
13+
<element name="gridMode" type="button" selector=".toolbar.toolbar-products .modes .mode-grid" timeout="30"/>
14+
<element name="listMode" type="button" selector=".toolbar.toolbar-products .modes .mode-list" timeout="30"/>
15+
<element name="sortByDropdown" type="select" selector=".toolbar.toolbar-products .sorter #sorter" timeout="30"/>
16+
<element name="sortDirectionAsc" type="button" selector=".toolbar.toolbar-products .sorter a.sort-asc" timeout="30"/>
17+
<element name="sortDirectionDesc" type="button" selector=".toolbar.toolbar-products .sorter a.sort-desc" timeout="30"/>
18+
<element name="showDropdown" type="select" selector=".toolbar.toolbar-products .limiter #limiter" timeout="30"/>
1919
</section>
2020
</sections>

app/code/Magento/CatalogSearch/Test/Mftf/Test/StorefrontSearchToolbarTest.xml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,5 +122,22 @@
122122
<see userInput="StorefrontSearchToolbarTestProduct C" selector="{{StorefrontCategoryMainSection.productNameByPosition('1')}}" stepKey="finalVerifyProductCFirst"/>
123123
<see userInput="StorefrontSearchToolbarTestProduct B" selector="{{StorefrontCategoryMainSection.productNameByPosition('2')}}" stepKey="finalVerifyProductBSecond"/>
124124
<see userInput="StorefrontSearchToolbarTestProduct A" selector="{{StorefrontCategoryMainSection.productNameByPosition('3')}}" stepKey="finalVerifyProductAThird"/>
125+
126+
<!-- Step 8: Verify sorting functionality still works after back button navigation -->
127+
<comment userInput="Test that sorting functionality is still operational after back button navigation" stepKey="commentTestSortingStillWorks"/>
128+
129+
<!-- Change sort direction to ascending to test sorting still works -->
130+
<click selector="{{StorefrontSearchTopToolbarSection.sortDirectionDesc}}" stepKey="changeSortToAscendingAfterBack"/>
131+
<waitForPageLoad stepKey="waitForAscendingSortingAfterBack"/>
132+
133+
<!-- Verify Product A is now first (alphabetically first in ascending order) -->
134+
<see userInput="StorefrontSearchToolbarTestProduct A" selector="{{StorefrontCategoryMainSection.productNameByPosition('1')}}" stepKey="verifyProductAFirstAfterSortChange"/>
135+
136+
<!-- Change sort back to price to test different sorting option -->
137+
<selectOption selector="{{StorefrontSearchTopToolbarSection.sortByDropdown}}" userInput="price" stepKey="selectSortByPriceAfterBack"/>
138+
<waitForPageLoad stepKey="waitForPriceSortingAfterBack"/>
139+
140+
<!-- Verify Product B is first (lowest price $10.00) -->
141+
<see userInput="StorefrontSearchToolbarTestProduct B" selector="{{StorefrontCategoryMainSection.productNameByPosition('1')}}" stepKey="verifyProductBFirstByPriceAfterBack"/>
125142
</test>
126143
</tests>

0 commit comments

Comments
 (0)