|
| 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 | +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| 10 | + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> |
| 11 | + <test name="AdminMoveProductBetweenCategoriesTest"> |
| 12 | + <annotations> |
| 13 | + <stories value="Move Product"/> |
| 14 | + <title value="Move Product between Categories (Cron is ON, 'Update by Schedule' Mode)"/> |
| 15 | + <description value="Verifies correctness of showing data (products, categories) on Storefront after moving an anchored category in terms of products/categories association"/> |
| 16 | + <severity value="CRITICAL"/> |
| 17 | + <testCaseId value="MC-11296"/> |
| 18 | + <group value="catalog"/> |
| 19 | + </annotations> |
| 20 | + |
| 21 | + <before> |
| 22 | + <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> |
| 23 | + <createData entity="defaultSimpleProduct" stepKey="simpleProduct"/> |
| 24 | + <createData entity="_defaultCategory" stepKey="createAnchoredCategory1"/> |
| 25 | + <createData entity="_defaultCategory" stepKey="createSecondCategory"/> |
| 26 | + |
| 27 | + <!-- Switch "Category Product" and "Product Category" indexers to "Update by Schedule" mode --> |
| 28 | + <amOnPage url="{{AdminIndexManagementPage.url}}" stepKey="onIndexManagement"/> |
| 29 | + <waitForPageLoad stepKey="waitForManagementPage"/> |
| 30 | + |
| 31 | + <actionGroup ref="AdminSwitchIndexerToActionModeActionGroup" stepKey="switchCategoryProduct"> |
| 32 | + <argument name="indexerValue" value="catalog_category_product"/> |
| 33 | + </actionGroup> |
| 34 | + <actionGroup ref="AdminSwitchIndexerToActionModeActionGroup" stepKey="switchProductCategory"> |
| 35 | + <argument name="indexerValue" value="catalog_product_category"/> |
| 36 | + </actionGroup> |
| 37 | + </before> |
| 38 | + |
| 39 | + <after> |
| 40 | + <!-- Switch "Category Product" and "Product Category" indexers to "Update by Save" mode --> |
| 41 | + <amOnPage url="{{AdminIndexManagementPage.url}}" stepKey="onIndexManagement"/> |
| 42 | + <waitForPageLoad stepKey="waitForManagementPage"/> |
| 43 | + |
| 44 | + <actionGroup ref="AdminSwitchIndexerToActionModeActionGroup" stepKey="switchCategoryProduct"> |
| 45 | + <argument name="indexerValue" value="catalog_category_product"/> |
| 46 | + <argument name="action" value="Update on Save"/> |
| 47 | + </actionGroup> |
| 48 | + <actionGroup ref="AdminSwitchIndexerToActionModeActionGroup" stepKey="switchProductCategory"> |
| 49 | + <argument name="indexerValue" value="catalog_product_category"/> |
| 50 | + <argument name="action" value="Update on Save"/> |
| 51 | + </actionGroup> |
| 52 | + |
| 53 | + <deleteData createDataKey="simpleProduct" stepKey="deleteProduct"/> |
| 54 | + <deleteData createDataKey="createSecondCategory" stepKey="deleteSecondCategory"/> |
| 55 | + <deleteData createDataKey="createAnchoredCategory1" stepKey="deleteAnchoredCategory1"/> |
| 56 | + <actionGroup ref="logout" stepKey="logout"/> |
| 57 | + </after> |
| 58 | + <!-- Create the anchored category <Cat1_anchored> --> |
| 59 | + <actionGroup ref="AdminAnchorCategoryActionGroup" stepKey="anchorCategory"> |
| 60 | + <argument name="categoryName" value="$$createAnchoredCategory1.name$$"/> |
| 61 | + </actionGroup> |
| 62 | + |
| 63 | + <!-- Create subcategory <Sub1> of the anchored category --> |
| 64 | + <click selector="{{AdminCategorySidebarActionSection.AddSubcategoryButton}}" stepKey="clickOnAddSubCategoryButton"/> |
| 65 | + <fillField selector="{{AdminCategoryBasicFieldSection.CategoryNameInput}}" userInput="{{SimpleSubCategory.name}}" stepKey="addSubCategoryName"/> |
| 66 | + <click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="saveSubCategory1"/> |
| 67 | + <waitForPageLoad stepKey="waitForSecondCategoryToSave"/> |
| 68 | + <seeElement selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="seeSaveSuccessMessage"/> |
| 69 | + |
| 70 | + <!-- Assign <product1> to the <Sub1> --> |
| 71 | + <amOnPage url="{{AdminProductEditPage.url($$simpleProduct.id$$)}}" stepKey="goToProduct"/> |
| 72 | + <waitForPageLoad stepKey="waitForProductPageLoad"/> |
| 73 | + <click selector="{{AdminProductFormSection.categoriesDropdown}}" stepKey="activateDropDownCategory"/> |
| 74 | + <fillField userInput="{{SimpleSubCategory.name}}" selector="{{AdminProductFormSection.searchCategory}}" stepKey="fillSearch"/> |
| 75 | + <waitForPageLoad stepKey="waitForSubCategory"/> |
| 76 | + <click selector="{{AdminProductFormSection.selectCategory(SimpleSubCategory.name)}}" stepKey="selectSub1Category"/> |
| 77 | + <click selector="{{AdminProductFormSection.done}}" stepKey="clickDone"/> |
| 78 | + <waitForPageLoad stepKey="waitForApplyCategory"/> |
| 79 | + <click selector="{{AdminProductFormSection.save}}" stepKey="clickSave"/> |
| 80 | + <waitForPageLoad stepKey="waitForSavingChanges"/> |
| 81 | + |
| 82 | + <!-- Enable `Use Categories Path for Product URLs` on Stores -> Configuration -> Catalog -> Catalog -> Search Engine Optimization --> |
| 83 | + <amOnPage url="{{AdminCatalogSearchConfigurationPage.url}}" stepKey="onConfigPage"/> |
| 84 | + <waitForPageLoad stepKey="waitForLoading"/> |
| 85 | + <conditionalClick selector="{{AdminCatalogSearchEngineConfigurationSection.searchEngineOptimization}}" dependentSelector="{{AdminCatalogSearchEngineConfigurationSection.openedEngineOptimization}}" visible="false" stepKey="clickEngineOptimization"/> |
| 86 | + <uncheckOption selector="{{AdminCatalogSearchEngineConfigurationSection.systemValueUseCategoriesPath}}" stepKey="uncheckDefault"/> |
| 87 | + <selectOption userInput="Yes" selector="{{AdminCatalogSearchEngineConfigurationSection.selectUseCategoriesPatForProductUrls}}" stepKey="selectYes"/> |
| 88 | + <click selector="{{AdminConfigSection.saveButton}}" stepKey="saveConfig"/> |
| 89 | + <waitForPageLoad stepKey="waitForSaving"/> |
| 90 | + <see selector="{{AdminIndexManagementSection.successMessage}}" userInput="You saved the configuration." stepKey="seeMessage"/> |
| 91 | + |
| 92 | + <!-- Navigate to the Catalog > Products --> |
| 93 | + <amOnPage url="{{AdminCatalogProductPage.url}}" stepKey="onCatalogProductPage"/> |
| 94 | + <waitForPageLoad stepKey="waitForProductPage"/> |
| 95 | + |
| 96 | + <!-- Click on <product1>: Product page opens--> |
| 97 | + <actionGroup ref="filterProductGridByName" stepKey="filterProduct"> |
| 98 | + <argument name="product" value="$$simpleProduct$$"/> |
| 99 | + </actionGroup> |
| 100 | + <click selector="{{AdminProductGridSection.productGridNameProduct($$simpleProduct.name$$)}}" stepKey="clickProduct1"/> |
| 101 | + <waitForPageLoad stepKey="waitForProductLoad"/> |
| 102 | + |
| 103 | + <!-- Clear "Categories" field and assign the product to <Cat2> and save the product --> |
| 104 | + <grabTextFrom selector="{{AdminProductFormSection.currentCategory}}" stepKey="grabNameSubCategory"/> |
| 105 | + <click selector="{{AdminProductFormSection.unselectCategories(SimpleSubCategory.name)}}" stepKey="removeCategory"/> |
| 106 | + <click selector="{{AdminProductFormSection.categoriesDropdown}}" stepKey="openDropDown"/> |
| 107 | + <checkOption selector="{{AdminProductFormSection.selectCategory($$createSecondCategory.name$$)}}" stepKey="selectCategory"/> |
| 108 | + <click selector="{{AdminProductFormSection.done}}" stepKey="pressButtonDone"/> |
| 109 | + <waitForPageLoad stepKey="waitForApplyCategory2"/> |
| 110 | + <click selector="{{AdminProductFormSection.save}}" stepKey="pushButtonSave"/> |
| 111 | + <waitForPageLoad stepKey="waitForSavingProduct"/> |
| 112 | + |
| 113 | + <!--Product is saved --> |
| 114 | + <see userInput="You saved the product." selector="{{CatalogProductsSection.messageSuccessSavedProduct}}" stepKey="seeSuccessMessage"/> |
| 115 | + |
| 116 | + <!-- Run cron --> |
| 117 | + <magentoCLI command="cron:run" stepKey="runCron"/> |
| 118 | + |
| 119 | + <!-- Clear invalidated cache on System>Tools>Cache Management page --> |
| 120 | + <amOnPage url="{{AdminCacheManagementPage.url}}" stepKey="onCachePage"/> |
| 121 | + <waitForPageLoad stepKey="waitForCacheManagementPage"/> |
| 122 | + |
| 123 | + <checkOption selector="{{AdminCacheManagementSection.configurationCheckbox}}" stepKey="checkConfigCache"/> |
| 124 | + <checkOption selector="{{AdminCacheManagementSection.pageCacheCheckbox}}" stepKey="checkPageCache"/> |
| 125 | + |
| 126 | + <selectOption userInput="Refresh" selector="{{AdminCacheManagementSection.massActionSelect}}" stepKey="selectRefresh"/> |
| 127 | + <waitForElementVisible selector="{{AdminCacheManagementSection.massActionSubmit}}" stepKey="waitSubmitButton"/> |
| 128 | + <click selector="{{AdminCacheManagementSection.massActionSubmit}}" stepKey="clickSubmit"/> |
| 129 | + <waitForPageLoad stepKey="waitForRefresh"/> |
| 130 | + |
| 131 | + <see userInput="2 cache type(s) refreshed." stepKey="seeCacheRefreshedMessage"/> |
| 132 | + <actionGroup ref="logout" stepKey="logout"/> |
| 133 | + |
| 134 | + <!-- Open frontend --> |
| 135 | + <amOnPage url="{{StorefrontHomePage.url}}" stepKey="onFrontend"/> |
| 136 | + <waitForPageLoad stepKey="waitForStorefrontPageLoad"/> |
| 137 | + |
| 138 | + <!-- Open <Cat2> from navigation menu --> |
| 139 | + <click selector="{{StorefrontHeaderSection.NavigationCategoryByName($$createSecondCategory.name$$)}}" stepKey="openCat2"/> |
| 140 | + <waitForPageLoad stepKey="waitForCategory2Page"/> |
| 141 | + |
| 142 | + <!-- # <Cat 2> should open # <product1> should be present on the page --> |
| 143 | + <see userInput="$$createSecondCategory.name$$" selector="{{StorefrontCategoryMainSection.CategoryTitle}}" stepKey="seeCategoryName"/> |
| 144 | + <see userInput="$$simpleProduct.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="seeProduct"/> |
| 145 | + |
| 146 | + <!-- Open <product1> --> |
| 147 | + <click selector="{{StorefrontCategoryMainSection.productLinkByHref($$simpleProduct.urlKey$$)}}" stepKey="openProduct"/> |
| 148 | + <waitForPageLoad stepKey="waitForProductPageLoading"/> |
| 149 | + |
| 150 | + <!-- # Product page should open successfully # Breadcrumb for product should be like <Cat 2> --> |
| 151 | + <see selector="{{StorefrontProductInfoMainSection.productName}}" userInput="$$simpleProduct.name$$" stepKey="seeProductName"/> |
| 152 | + <see userInput="$$createSecondCategory.name$$" selector="{{StorefrontNavigationSection.categoryBreadcrumbs}}" stepKey="seeCategoryInBreadcrumbs"/> |
| 153 | + |
| 154 | + <!-- Open <Cat1_anchored> category --> |
| 155 | + <click selector="{{StorefrontNavigationSection.topCategory($$createAnchoredCategory1.name$$)}}" stepKey="clickCat1"/> |
| 156 | + <waitForPageLoad stepKey="waitForCategory1PageLoad"/> |
| 157 | + |
| 158 | + <!-- # Category should open successfully # <product1> should be absent on the page --> |
| 159 | + <see userInput="$$createAnchoredCategory1.name$$" selector="{{StorefrontCategoryMainSection.CategoryTitle}}" stepKey="seeCategory1Name"/> |
| 160 | + <see userInput="We can't find products matching the selection." stepKey="seeEmptyNotice"/> |
| 161 | + <dontSee userInput="$$simpleProduct.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="dontseeProduct"/> |
| 162 | + |
| 163 | + <!-- Log in to the backend: Admin user is logged in--> |
| 164 | + <actionGroup ref="LoginAsAdmin" stepKey="LoginAdmin"/> |
| 165 | + |
| 166 | + <!-- Navigate to the Catalog > Products: Navigate to the Catalog>Products --> |
| 167 | + <amOnPage url="{{AdminCatalogProductPage.url}}" stepKey="amOnProductPage"/> |
| 168 | + <waitForPageLoad stepKey="waitForProductsPage"/> |
| 169 | + |
| 170 | + <!-- Click on <product1> --> |
| 171 | + <actionGroup ref="filterAndSelectProduct" stepKey="openSimpleProduct"> |
| 172 | + <argument name="productSku" value="$$simpleProduct.sku$$"/> |
| 173 | + </actionGroup> |
| 174 | + |
| 175 | + <!-- Clear "Categories" field and assign the product to <Sub1> and save the product --> |
| 176 | + <click selector="{{AdminProductFormSection.unselectCategories($$createSecondCategory.name$$)}}" stepKey="clearCategory"/> |
| 177 | + <click selector="{{AdminProductFormSection.categoriesDropdown}}" stepKey="activateDropDown"/> |
| 178 | + <fillField userInput="{$grabNameSubCategory}" selector="{{AdminProductFormSection.searchCategory}}" stepKey="fillSearchField"/> |
| 179 | + <waitForPageLoad stepKey="waitForSearchSubCategory"/> |
| 180 | + <click selector="{{AdminProductFormSection.selectCategory({$grabNameSubCategory})}}" stepKey="selectSubCategory"/> |
| 181 | + <click selector="{{AdminProductFormSection.done}}" stepKey="clickButtonDone"/> |
| 182 | + <waitForPageLoad stepKey="waitForCategoryApply"/> |
| 183 | + <click selector="{{AdminProductFormSection.save}}" stepKey="clickButtonSave"/> |
| 184 | + <waitForPageLoad stepKey="waitForSaveChanges"/> |
| 185 | + |
| 186 | + <!-- Product is saved successfully --> |
| 187 | + <see userInput="You saved the product." selector="{{CatalogProductsSection.messageSuccessSavedProduct}}" stepKey="seeSaveMessage"/> |
| 188 | + |
| 189 | + <!-- Run cron --> |
| 190 | + <magentoCLI command="cron:run" stepKey="runCron2"/> |
| 191 | + |
| 192 | + <!-- Open frontend --> |
| 193 | + <amOnPage url="{{StorefrontHomePage.url}}" stepKey="onFrontendPage"/> |
| 194 | + <waitForPageLoad stepKey="waitForFrontPageLoad"/> |
| 195 | + |
| 196 | + <!-- Open <Cat2> from navigation menu --> |
| 197 | + <click selector="{{StorefrontHeaderSection.NavigationCategoryByName($$createSecondCategory.name$$)}}" stepKey="openSecondCategory"/> |
| 198 | + <waitForPageLoad stepKey="waitForSecondCategoryPage"/> |
| 199 | + |
| 200 | + <!-- # <Cat 2> should open # <product1> should be absent on the page --> |
| 201 | + <see userInput="$$createSecondCategory.name$$" selector="{{StorefrontCategoryMainSection.CategoryTitle}}" stepKey="seeSecondCategory1Name"/> |
| 202 | + <dontSee userInput="$$simpleProduct.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="dontseeSimpleProduct"/> |
| 203 | + |
| 204 | + <!-- Click on <Cat1_anchored> category --> |
| 205 | + <click selector="{{StorefrontHeaderSection.NavigationCategoryByName($$createAnchoredCategory1.name$$)}}" stepKey="clickAnchoredCategory"/> |
| 206 | + <waitForPageLoad stepKey="waitForAnchoredCategoryPage"/> |
| 207 | + |
| 208 | + <!-- # Category should open successfully # <product1> should be present on the page --> |
| 209 | + <see userInput="$$createAnchoredCategory1.name$$" selector="{{StorefrontCategoryMainSection.CategoryTitle}}" stepKey="see1CategoryName"/> |
| 210 | + <see selector="{{StorefrontCategoryMainSection.productName}}" userInput="$$simpleProduct.name$$" stepKey="seeProductNameOnCategory1Page"/> |
| 211 | + |
| 212 | + <!-- Breadcrumb for product should be like <Cat1_anchored>/<product> (if you clicks from anchor category) --> |
| 213 | + <see userInput="$$createAnchoredCategory1.name$$" selector="{{StorefrontNavigationSection.categoryBreadcrumbs}}" stepKey="seeCat1inBreadcrumbs"/> |
| 214 | + <dontSee userInput="{$grabNameSubCategory}" selector="{{StorefrontNavigationSection.categoryBreadcrumbs}}" stepKey="dontSeeSubCategoryInBreadCrumbs"/> |
| 215 | + |
| 216 | + <!-- <Cat1_anchored>/<Sub1>/<product> (if you clicks from Sub1 category) --> |
| 217 | + <moveMouseOver selector="{{StorefrontHeaderSection.NavigationCategoryByName($$createAnchoredCategory1.name$$)}}" stepKey="hoverCategory1"/> |
| 218 | + <click selector="{{StorefrontHeaderSection.NavigationCategoryByName({$grabNameSubCategory})}}" stepKey="clickSubCat"/> |
| 219 | + <waitForPageLoad stepKey="waitForSubCategoryPageLoad"/> |
| 220 | + |
| 221 | + <see userInput="{$grabNameSubCategory}" selector="{{StorefrontCategoryMainSection.CategoryTitle}}" stepKey="seeSubCategoryName"/> |
| 222 | + <see selector="{{StorefrontCategoryMainSection.productName}}" userInput="$$simpleProduct.name$$" stepKey="seeProductNameOnSubCategoryPage"/> |
| 223 | + |
| 224 | + <see userInput="{$grabNameSubCategory}" selector="{{StorefrontNavigationSection.categoryBreadcrumbs}}" stepKey="seeSubCategoryInBreadcrumbs"/> |
| 225 | + <see userInput="$$createAnchoredCategory1.name$$" selector="{{StorefrontNavigationSection.categoryBreadcrumbs}}" stepKey="seeCat1InBreadcrumbs"/> |
| 226 | + </test> |
| 227 | +</tests> |
0 commit comments