|
| 1 | +<?xml version="1.0" encoding="UTF-8"?> |
| 2 | +<!-- |
| 3 | +/** |
| 4 | + * Copyright 2025 Adobe |
| 5 | + * All Rights Reserved. |
| 6 | + */ |
| 7 | +--> |
| 8 | + |
| 9 | +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| 10 | + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> |
| 11 | + <test name="StorefrontAssertProductCountInListAndGridViewTest"> |
| 12 | + <annotations> |
| 13 | + <features value="Catalog"/> |
| 14 | + <stories value="Apply catalog storefront configuration settings"/> |
| 15 | + <title value="Verify Product Count Display in List and Grid Views After Storefront Catalog Configuration Changes"/> |
| 16 | + <description value="Admin should apply catalog storefront configuration settings and verify the products in storefront based on configuration"/> |
| 17 | + <severity value="BLOCKER"/> |
| 18 | + <testCaseId value="AC-5027"/> |
| 19 | + <group value="Catalog"/> |
| 20 | + </annotations> |
| 21 | + <before> |
| 22 | + <createData entity="SimpleSubCategory" stepKey="createCategory"/> |
| 23 | + |
| 24 | + <helper class="\Magento\Catalog\Test\Mftf\Helper\ProductApiHelper" method="createProduct" stepKey="createProducts"> |
| 25 | + <argument name="categoryStepKey">createCategory</argument> |
| 26 | + <argument name="count">12</argument> |
| 27 | + </helper> |
| 28 | + <!-- Login as admin --> |
| 29 | + <actionGroup ref="AdminLoginActionGroup" stepKey="login"/> |
| 30 | + </before> |
| 31 | + <after> |
| 32 | + <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> |
| 33 | + <!-- Set Default Values in Configuration --> |
| 34 | + <magentoCLI command="config:set {{DefaultListMode.path}} {{DefaultListMode.value}}" stepKey="setListMode1"/> |
| 35 | + <magentoCLI command="config:set {{DefaultGridPerPageValuesConfigData.path}} {{DefaultGridPerPageValuesConfigData.value}}" stepKey="setDefaultGridPerPageValues"/> |
| 36 | + <magentoCLI command="config:set {{DefaultGridPerPageDefaultConfigData.path}} {{DefaultGridPerPageDefaultConfigData.value}}" stepKey="setDefaultGridPerPage"/> |
| 37 | + <magentoCLI command="config:set {{DefaultStoreFrontListPerPageValuesConfigData.path}} {{DefaultStoreFrontListPerPageValuesConfigData.value}}" stepKey="setDefaultListPerPageValues"/> |
| 38 | + <magentoCLI command="config:set {{DefaultStoreFrontListPerPageConfigData.path}} {{DefaultStoreFrontListPerPageConfigData.value}}" stepKey="setDefaultListPerPage"/> |
| 39 | + <magentoCLI command="config:set {{DefaultStoreFrontProductsSortBy.path}} {{DefaultStoreFrontProductsSortBy.value}}" stepKey="setDefaultProductSortBy"/> |
| 40 | + <magentoCLI command="config:set {{DefaultStoreFrontAllProductsPerPage.path}} {{DefaultStoreFrontAllProductsPerPage.value}}" stepKey="setDefaultAllProductsPerPage"/> |
| 41 | + <!-- Delete simple product created via API --> |
| 42 | + <helper class="Magento\Catalog\Test\Mftf\Helper\ProductApiHelper" method="deleteAllProductsApi" stepKey="deleteAllProductsViaApi"/> |
| 43 | + <!-- Log out --> |
| 44 | + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> |
| 45 | + </after> |
| 46 | + <!-- Step 1&2: Open Admin > Stores > Configuration > Catalog > Catalog > Storefront & Save the following settings --> |
| 47 | + <magentoCLI command="config:set {{CustomListMode.path}} {{CustomListMode.value}}" stepKey="setListMode"/> |
| 48 | + <magentoCLI command="config:set {{CustomStoreFrontGridPerPageValuesConfigData.path}} {{CustomStoreFrontGridPerPageValuesConfigData.value}}" stepKey="setCustomGridPerPageValues"/> |
| 49 | + <magentoCLI command="config:set {{CustomStoreFrontGridPerPageConfigData.path}} {{CustomStoreFrontGridPerPageConfigData.value}}" stepKey="setCustomGridPerPage"/> |
| 50 | + <magentoCLI command="config:set {{CustomStoreFrontListPerPageValuesConfigData.path}} {{CustomStoreFrontListPerPageValuesConfigData.value}}" stepKey="setCustomListPerPageValues"/> |
| 51 | + <magentoCLI command="config:set {{CustomStoreFrontListPerPageConfigData.path}} {{CustomStoreFrontListPerPageConfigData.value}}" stepKey="setCustomListPerPage"/> |
| 52 | + <magentoCLI command="config:set {{CustomStoreFrontProductsSortBy.path}} {{CustomStoreFrontProductsSortBy.value}}" stepKey="setProductSortBy"/> |
| 53 | + <magentoCLI command="config:set {{CustomStoreFrontAllProductsPerPage.path}} {{CustomStoreFrontAllProductsPerPage.value}}" stepKey="setAllProductsPerPage"/> |
| 54 | + <!-- Step 3: Open a category page on Storefront that has more than 10 products --> |
| 55 | + <actionGroup ref="StorefrontNavigateCategoryPageActionGroup" stepKey="navigateToCategoryPage1"> |
| 56 | + <argument name="category" value="$$createCategory$$"/> |
| 57 | + </actionGroup> |
| 58 | + <!-- Step 4&5: Select All products & Switch to Grid view --> |
| 59 | + <waitForElementVisible selector="{{AdminChecksListAndGridModeSection.listView}}" stepKey="seePageInListView"/> |
| 60 | + <scrollTo selector="{{AdminChecksListAndGridModeSection.gridMode}}" stepKey="scrollToGridMode"/> |
| 61 | + <waitForElementClickable selector="{{AdminChecksListAndGridModeSection.gridMode}}" stepKey="waitToClickGridMode"/> |
| 62 | + <click selector="{{AdminChecksListAndGridModeSection.gridMode}}" stepKey="clickGridMode"/> |
| 63 | + <waitForPageLoad stepKey="waitForGridMode"/> |
| 64 | + <waitForElementVisible selector="{{AdminChecksListAndGridModeSection.listView}}" stepKey="seePageInGridView"/> |
| 65 | + <waitForElementClickable selector="{{AdminChecksListAndGridModeSection.listView}}" stepKey="waitToClickListMode"/> |
| 66 | + <click selector="{{AdminChecksListAndGridModeSection.listView}}" stepKey="clickListMode"/> |
| 67 | + <waitForPageLoad stepKey="waitForListMode"/> |
| 68 | + <waitForElementVisible selector="{{StorefrontCategoryMainSection.productLink}}" stepKey="seeAnyProductOnPage"/> |
| 69 | + <seeOptionIsSelected userInput="{{CustomStoreFrontProductsSortBy.value}}" selector="{{StorefrontCategoryTopToolbarSection.sortByDropdown}}" after="seeAnyProductOnPage" stepKey="selectSortBy"/> |
| 70 | + <waitForElementClickable selector="{{AdminChecksListAndGridModeSection.productsPerPage}}" stepKey="waitToClickProductsPerPageButtonInListMode"/> |
| 71 | + <click selector="{{AdminChecksListAndGridModeSection.productsPerPage}}" stepKey="clickProductsPerPageButtonInListMode"/> |
| 72 | + <waitForPageLoad stepKey="waitForProductsPerPage"/> |
| 73 | + <waitForElementVisible selector="{{AdminChecksListAndGridModeSection.pageOptions('1')}}" stepKey="seeLimiterOption1"/> |
| 74 | + <waitForElementVisible selector="{{AdminChecksListAndGridModeSection.pageOptions('2')}}" stepKey="seeLimiterOption2"/> |
| 75 | + <waitForElementVisible selector="{{AdminChecksListAndGridModeSection.pageOptions('3')}}" stepKey="seeLimiterOption3"/> |
| 76 | + <waitForElementVisible selector="{{AdminChecksListAndGridModeSection.allButton}}" stepKey="seeAllButton"/> |
| 77 | + <click selector="{{AdminChecksListAndGridModeSection.allButton}}" stepKey="selectAllButton"/> |
| 78 | + <waitForPageLoad stepKey="waitForSelectAll"/> |
| 79 | + <waitForElementVisible selector="{{AdminChecksListAndGridModeSection.allProducts}}" stepKey="seeAllProducts"/> |
| 80 | + <waitForElementClickable selector="{{AdminChecksListAndGridModeSection.gridMode}}" stepKey="waitToSwitchToGridMode"/> |
| 81 | + <click selector="{{AdminChecksListAndGridModeSection.gridMode}}" stepKey="switchToGridMode"/> |
| 82 | + <waitForElementVisible selector="{{AdminChecksListAndGridModeSection.gridView}}" stepKey="seePageInGridView2"/> |
| 83 | + <waitForElementClickable selector="{{StorefrontCategoryProductSection.categoryListView}}" stepKey="waitToSwitchToListMode1"/> |
| 84 | + <click selector="{{StorefrontCategoryProductSection.categoryListView}}" stepKey="switchToListMode1"/> |
| 85 | + <waitForElementVisible selector="{{AdminChecksListAndGridModeSection.listView}}" stepKey="seePageInListView1"/> |
| 86 | + <waitForElementClickable selector="{{AdminChecksListAndGridModeSection.gridMode}}" stepKey="waitToSwitchToGridMode1"/> |
| 87 | + <click selector="{{AdminChecksListAndGridModeSection.gridMode}}" stepKey="switchToGridMode1"/> |
| 88 | + <seeOptionIsSelected userInput="{{CustomStoreFrontProductsSortBy.value}}" selector="{{StorefrontCategoryTopToolbarSection.sortByDropdown}}" after="switchToGridMode1" stepKey="selectSortByPrice"/> |
| 89 | + <waitForElementClickable selector="{{AdminChecksListAndGridModeSection.productsPerPage}}" stepKey="waitToClickProductsPerPageButtonInGridMode"/> |
| 90 | + <click selector="{{AdminChecksListAndGridModeSection.productsPerPage}}" stepKey="clickProductsPerPageButtonInGridMode"/> |
| 91 | + <waitForPageLoad stepKey="waitForProductsPerPageOpen"/> |
| 92 | + <waitForElementVisible selector="{{AdminChecksListAndGridModeSection.pageOptions('1')}}" stepKey="seeLimiterOption1Grid"/> |
| 93 | + <waitForElementVisible selector="{{AdminChecksListAndGridModeSection.pageOptions('2')}}" stepKey="seeLimiterOption2Grid"/> |
| 94 | + <waitForElementVisible selector="{{AdminChecksListAndGridModeSection.pageOptions('3')}}" stepKey="seeLimiterOption3Grid"/> |
| 95 | + <waitForElementVisible selector="{{AdminChecksListAndGridModeSection.allButton}}" stepKey="seeAllBtn"/> |
| 96 | + <!-- Step 6: Open the same category again from navigation menu. Switch to Grid mode. --> |
| 97 | + <actionGroup ref="StorefrontNavigateCategoryPageActionGroup" stepKey="navigateToCategoryPage2"> |
| 98 | + <argument name="category" value="$$createCategory$$"/> |
| 99 | + </actionGroup> |
| 100 | + <waitForElementClickable selector="{{AdminChecksListAndGridModeSection.gridMode}}" stepKey="waitToSwitchToGridMode4"/> |
| 101 | + <click selector="{{AdminChecksListAndGridModeSection.gridMode}}" stepKey="switchAgainToGridMode"/> |
| 102 | + <seeNumberOfElements selector="{{AdminChecksListAndGridModeSection.productCount}}" userInput="10" stepKey="seeNumberOfProductsDisplayed"/> |
| 103 | + </test> |
| 104 | +</tests> |
0 commit comments