|
| 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="VerifyCategoryProductAndProductCategoryPartialReindexTest"> |
| 12 | + <annotations> |
| 13 | + <features value="Catalog"/> |
| 14 | + <stories value="Product Categories Indexer"/> |
| 15 | + <title value="Verify Category Product and Product Category partial reindex"/> |
| 16 | + <description value="Verify that Merchant Developer can use console commands to perform partial reindex for Category Products, Product Categories, and Catalog Search"/> |
| 17 | + <severity value="CRITICAL"/> |
| 18 | + <testCaseId value="MC-11386"/> |
| 19 | + <group value="catalog"/> |
| 20 | + <group value="indexer"/> |
| 21 | + </annotations> |
| 22 | + <before> |
| 23 | + <!-- Change "Category Products" and "Product Categories" indexers to "Update by Schedule" mode --> |
| 24 | + <magentoCLI command="indexer:set-mode" arguments="schedule catalog_category_product catalog_product_category" stepKey="setIndexerMode"/> |
| 25 | + |
| 26 | + <!-- Create categories K, L, M, N with different nesting in the tree and Anchor = Yes/No--> |
| 27 | + <!-- Category K is an anchor category --> |
| 28 | + <createData entity="_defaultCategory" stepKey="categoryK"/> |
| 29 | + <!-- Category L is a non-anchor subcategory of category K --> |
| 30 | + <createData entity="SubCategoryNonAnchor" stepKey="categoryL"> |
| 31 | + <requiredEntity createDataKey="categoryK"/> |
| 32 | + </createData> |
| 33 | + <!-- Category M is a subcategory of category L --> |
| 34 | + <createData entity="SubCategoryWithParent" stepKey="categoryM"> |
| 35 | + <requiredEntity createDataKey="categoryL"/> |
| 36 | + </createData> |
| 37 | + <!-- Category N is a subcategory of category K --> |
| 38 | + <createData entity="SubCategoryWithParent" stepKey="categoryN"> |
| 39 | + <requiredEntity createDataKey="categoryK"/> |
| 40 | + </createData> |
| 41 | + |
| 42 | + <!-- Create different Products with different settings, assign to categories: --> |
| 43 | + <!-- Product A in 0 categories, i.e. not assigned to any category --> |
| 44 | + <createData entity="SimpleProduct2" stepKey="productA"/> |
| 45 | + <!-- Product B in 1 category M --> |
| 46 | + <createData entity="SimpleProduct3" stepKey="productB"> |
| 47 | + <requiredEntity createDataKey="categoryM"/> |
| 48 | + </createData> |
| 49 | + <!-- Product C in 2 categories M and N --> |
| 50 | + <createData entity="SimpleProduct2" stepKey="productC"/> |
| 51 | + |
| 52 | + <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> |
| 53 | + <actionGroup ref="AdminAssignProductToCategory" stepKey="assignCategoryNAndMToProductC"> |
| 54 | + <argument name="productId" value="$$productC.id$$"/> |
| 55 | + <argument name="categoryName" value="$$categoryN.name$$, $$categoryM.name$$"/> |
| 56 | + </actionGroup> |
| 57 | + |
| 58 | + <magentoCLI command="indexer:reindex" stepKey="reindex"/> |
| 59 | + </before> |
| 60 | + <after> |
| 61 | + <!-- Change "Category Products" and "Product Categories" indexers to "Update on Save" mode --> |
| 62 | + <magentoCLI command="indexer:set-mode" arguments="realtime" stepKey="setRealtimeMode"/> |
| 63 | + <magentoCLI command="indexer:reindex" stepKey="reindex"/> |
| 64 | + |
| 65 | + <!-- Delete data --> |
| 66 | + <deleteData createDataKey="productA" stepKey="deleteProductA"/> |
| 67 | + <deleteData createDataKey="productB" stepKey="deleteProductB"/> |
| 68 | + <deleteData createDataKey="productC" stepKey="deleteProductC"/> |
| 69 | + <deleteData createDataKey="categoryN" stepKey="deleteCategoryN"/> |
| 70 | + <deleteData createDataKey="categoryM" stepKey="deleteCategoryM"/> |
| 71 | + <deleteData createDataKey="categoryL" stepKey="deleteCategoryL"/> |
| 72 | + <deleteData createDataKey="categoryK" stepKey="deleteCategoryK"/> |
| 73 | + |
| 74 | + <actionGroup ref="logout" stepKey="logout"/> |
| 75 | + </after> |
| 76 | + |
| 77 | + <!-- Open categories K, L, M, N on Storefront --> |
| 78 | + <!-- Category K contains only Products B & C --> |
| 79 | + <amOnPage url="{{StorefrontCategoryPage.url($$categoryK.custom_attributes[url_key]$$)}}" stepKey="onCategoryK"/> |
| 80 | + <see userInput="$$productB.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="seeProductBOnCategoryK"/> |
| 81 | + <see userInput="$$productC.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="seeProductCOnCategoryK"/> |
| 82 | + |
| 83 | + <!-- Category L contains no Products --> |
| 84 | + <amOnPage url="{{StorefrontCategoryPage.url($$categoryK.custom_attributes[url_key]$$/$$categoryL.custom_attributes[url_key]$$)}}" stepKey="onCategoryL"/> |
| 85 | + <see userInput="We can't find products matching the selection." selector="{{StorefrontCategoryMainSection.emptyProductMessage}}" stepKey="seeMessage"/> |
| 86 | + <dontSeeElement selector="{{StorefrontCategoryMainSection.productName}}" stepKey="dontseeProducts"/> |
| 87 | + |
| 88 | + <!-- Category M contains only Products B & C --> |
| 89 | + <amOnPage url="{{StorefrontCategoryPage.url($$categoryK.custom_attributes[url_key]$$/$$categoryL.custom_attributes[url_key]$$/$$categoryM.custom_attributes[url_key]$$)}}" stepKey="onCategoryM"/> |
| 90 | + <see userInput="$$productB.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="seeProductBOnCategoryM"/> |
| 91 | + <see userInput="$$productC.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="seeProductCOnCategoryM"/> |
| 92 | + |
| 93 | + <!-- Category N contains only Product C --> |
| 94 | + <amOnPage url="{{StorefrontCategoryPage.url($$categoryK.custom_attributes[url_key]$$/$$categoryN.custom_attributes[url_key]$$)}}" stepKey="onCategoryN"/> |
| 95 | + <see userInput="$$productC.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="seeProductCOnCategoryN"/> |
| 96 | + |
| 97 | + <!-- Open Products A, B, C to edit. Assign/unassign categories to/from them. Save changes --> |
| 98 | + <!-- Assign category K to Product A --> |
| 99 | + <actionGroup ref="AdminAssignProductToCategory" stepKey="assignCategoryK"> |
| 100 | + <argument name="productId" value="$$productA.id$$"/> |
| 101 | + <argument name="categoryName" value="$$categoryK.name$$"/> |
| 102 | + </actionGroup> |
| 103 | + |
| 104 | + <!-- Unassign category M from Product B --> |
| 105 | + <amOnPage url="{{AdminProductEditPage.url($$productB.id$$)}}" stepKey="amOnEditCategoryPageB"/> |
| 106 | + <actionGroup ref="AdminUnassignCategoryOnProductAndSaveActionGroup" stepKey="unassignCategoryM"> |
| 107 | + <argument name="categoryName" value="$$categoryM.name$$"/> |
| 108 | + </actionGroup> |
| 109 | + |
| 110 | + <!-- Assign category L to Product C --> |
| 111 | + <actionGroup ref="AdminAssignProductToCategory" stepKey="assignCategoryNAndM"> |
| 112 | + <argument name="productId" value="$$productC.id$$"/> |
| 113 | + <argument name="categoryName" value="$$categoryL.name$$"/> |
| 114 | + </actionGroup> |
| 115 | + |
| 116 | + <!-- "One or more indexers are invalid. Make sure your Magento cron job is running." global warning message appears --> |
| 117 | + <click selector="{{AdminSystemMessagesSection.systemMessagesDropdown}}" stepKey="openMessageSection"/> |
| 118 | + <see userInput="One or more indexers are invalid. Make sure your Magento cron job is running." selector="{{AdminMessagesSection.warningMessage}}" stepKey="seeWarningMessage"/> |
| 119 | + |
| 120 | + <!-- Open categories K, L, M, N on Storefront in order to make sure that new assigments are not applied yet --> |
| 121 | + <!-- Category K contains only Products B & C --> |
| 122 | + <amOnPage url="{{StorefrontCategoryPage.url($$categoryK.custom_attributes[url_key]$$)}}" stepKey="amOnCategoryK"/> |
| 123 | + <see userInput="$$productB.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="seeProductBCategoryK"/> |
| 124 | + <see userInput="$$productC.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="seeProductCCategoryK"/> |
| 125 | + |
| 126 | + <!-- Category L contains no Products --> |
| 127 | + <amOnPage url="{{StorefrontCategoryPage.url($$categoryK.custom_attributes[url_key]$$/$$categoryL.custom_attributes[url_key]$$)}}" stepKey="amOnCategoryL"/> |
| 128 | + <see userInput="We can't find products matching the selection." selector="{{StorefrontCategoryMainSection.emptyProductMessage}}" stepKey="seeEmptyMessage"/> |
| 129 | + <dontSeeElement selector="{{StorefrontCategoryMainSection.productName}}" stepKey="dontseeProduct"/> |
| 130 | + |
| 131 | + <!-- Category M contains only Products B & C --> |
| 132 | + <amOnPage url="{{StorefrontCategoryPage.url($$categoryK.custom_attributes[url_key]$$/$$categoryL.custom_attributes[url_key]$$/$$categoryM.custom_attributes[url_key]$$)}}" stepKey="amOnCategoryM"/> |
| 133 | + <see userInput="$$productB.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="seeProductBCategoryM"/> |
| 134 | + <see userInput="$$productC.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="seeProductCCategoryM"/> |
| 135 | + |
| 136 | + <!-- Category N contains only Product C --> |
| 137 | + <amOnPage url="{{StorefrontCategoryPage.url($$categoryK.custom_attributes[url_key]$$/$$categoryN.custom_attributes[url_key]$$)}}" stepKey="amOnCategoryN"/> |
| 138 | + <see userInput="$$productC.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="seeProductInCategoryN"/> |
| 139 | + |
| 140 | + <!-- Run cron twice --> |
| 141 | + <magentoCLI command="cron:run" stepKey="runCron"/> |
| 142 | + <magentoCLI command="cron:run" stepKey="runCronAgain"/> |
| 143 | + |
| 144 | + <!-- Open categories K, L, M, N on Storefront in order to make sure that new assigments are applied --> |
| 145 | + <!-- Category K contains only Products A, C --> |
| 146 | + <amOnPage url="{{StorefrontCategoryPage.url($$categoryK.custom_attributes[url_key]$$)}}" stepKey="storefrontCategoryK"/> |
| 147 | + <see userInput="$$productA.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="seeProductAOnCategoryK"/> |
| 148 | + <see userInput="$$productC.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="seeCategoryKWithProductC"/> |
| 149 | + |
| 150 | + <!-- Category L contains only Product C --> |
| 151 | + <amOnPage url="{{StorefrontCategoryPage.url($$categoryK.custom_attributes[url_key]$$/$$categoryL.custom_attributes[url_key]$$)}}" stepKey="storefrontCategoryL"/> |
| 152 | + <see userInput="$$productC.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="seeCategoryLWithProductC"/> |
| 153 | + |
| 154 | + <!-- Category M contains only Product C --> |
| 155 | + <amOnPage url="{{StorefrontCategoryPage.url($$categoryK.custom_attributes[url_key]$$/$$categoryL.custom_attributes[url_key]$$/$$categoryM.custom_attributes[url_key]$$)}}" stepKey="storefrontCategoryM"/> |
| 156 | + <waitForPageLoad stepKey="waitForStorefrontCategoryM"/> |
| 157 | + <see userInput="$$productC.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="seeCategoryMAndProductC"/> |
| 158 | + |
| 159 | + <!-- Category N contains only Product C --> |
| 160 | + <amOnPage url="{{StorefrontCategoryPage.url($$categoryK.custom_attributes[url_key]$$/$$categoryN.custom_attributes[url_key]$$)}}" stepKey="storefrontCategoryN"/> |
| 161 | + <see userInput="$$productC.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="seeProductCAndCategoryN"/> |
| 162 | + |
| 163 | + <!-- Open categories K, L, N to edit. Assign/unassign Products to/from them. Save changes --> |
| 164 | + |
| 165 | + <!-- Remove Product A assignment for category K --> |
| 166 | + <amOnPage url="{{AdminProductEditPage.url($$productA.id$$)}}" stepKey="amOnEditProductPageA"/> |
| 167 | + <actionGroup ref="AdminUnassignCategoryOnProductAndSaveActionGroup" stepKey="unassignCategoryK"> |
| 168 | + <argument name="categoryName" value="$$categoryK.name$$"/> |
| 169 | + </actionGroup> |
| 170 | + |
| 171 | + <!-- Remove Product C assignment for category L --> |
| 172 | + <amOnPage url="{{AdminProductEditPage.url($$productC.id$$)}}" stepKey="amOnEditProductPageC"/> |
| 173 | + <actionGroup ref="AdminUnassignCategoryOnProductAndSaveActionGroup" stepKey="unassignCategoryL"> |
| 174 | + <argument name="categoryName" value="$$categoryL.name$$"/> |
| 175 | + </actionGroup> |
| 176 | + |
| 177 | + <!-- Add Product B assignment for category N --> |
| 178 | + <actionGroup ref="AdminAssignProductToCategory" stepKey="assignCategoryN"> |
| 179 | + <argument name="productId" value="$$productB.id$$"/> |
| 180 | + <argument name="categoryName" value="$$categoryN.name$$"/> |
| 181 | + </actionGroup> |
| 182 | + |
| 183 | + <!-- Open categories K, L, M, N on Storefront in order to make sure that new assigments are not applied yet --> |
| 184 | + <!-- Category K contains only Products A, C --> |
| 185 | + <amOnPage url="{{StorefrontCategoryPage.url($$categoryK.custom_attributes[url_key]$$)}}" stepKey="onStorefrontCategoryK"/> |
| 186 | + <see userInput="$$productA.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="seeProductAWithCategoryK"/> |
| 187 | + <see userInput="$$productC.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="seeProductC"/> |
| 188 | + |
| 189 | + <!-- Category L contains only Product C --> |
| 190 | + <amOnPage url="{{StorefrontCategoryPage.url($$categoryK.custom_attributes[url_key]$$/$$categoryL.custom_attributes[url_key]$$)}}" stepKey="onStorefrontCategoryL"/> |
| 191 | + <see userInput="$$productC.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="seeCategoryLAndProductC"/> |
| 192 | + |
| 193 | + <!-- Category M contains only Product C --> |
| 194 | + <amOnPage url="{{StorefrontCategoryPage.url($$categoryK.custom_attributes[url_key]$$/$$categoryL.custom_attributes[url_key]$$/$$categoryM.custom_attributes[url_key]$$)}}" stepKey="onStorefrontCategoryM"/> |
| 195 | + <see userInput="$$productC.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="seeCategoryMWithProductC"/> |
| 196 | + |
| 197 | + <!-- Category N contains only Product C --> |
| 198 | + <amOnPage url="{{StorefrontCategoryPage.url($$categoryK.custom_attributes[url_key]$$/$$categoryN.custom_attributes[url_key]$$)}}" stepKey="onStorefrontCategoryN"/> |
| 199 | + <see userInput="$$productC.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="productCOnCategoryN"/> |
| 200 | + |
| 201 | + <!-- Run cron twice --> |
| 202 | + <magentoCLI command="cron:run" stepKey="firstCronRun"/> |
| 203 | + <magentoCLI command="cron:run" stepKey="secondCronRun"/> |
| 204 | + |
| 205 | + <!-- Open categories K, L, M, N on Storefront in order to make sure that new assigments are applied --> |
| 206 | + |
| 207 | + <!-- Category K contains only Products B & C --> |
| 208 | + <amOnPage url="{{StorefrontCategoryPage.url($$categoryK.custom_attributes[url_key]$$)}}" stepKey="onFrontendCategoryK"/> |
| 209 | + <see userInput="$$productB.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="productBOnCategoryK"/> |
| 210 | + <see userInput="$$productC.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="productCOnCategoryK"/> |
| 211 | + |
| 212 | + <!-- Category L contains no Products --> |
| 213 | + <amOnPage url="{{StorefrontCategoryPage.url($$categoryK.custom_attributes[url_key]$$/$$categoryL.custom_attributes[url_key]$$)}}" stepKey="onFrontendCategoryL"/> |
| 214 | + <see userInput="We can't find products matching the selection." selector="{{StorefrontCategoryMainSection.emptyProductMessage}}" stepKey="noProductsMessage"/> |
| 215 | + <dontSeeElement selector="{{StorefrontCategoryMainSection.productName}}" stepKey="dontSeeProductsOnCategoryL"/> |
| 216 | + |
| 217 | + <!-- Category M contains only Product C --> |
| 218 | + <amOnPage url="{{StorefrontCategoryPage.url($$categoryK.custom_attributes[url_key]$$/$$categoryL.custom_attributes[url_key]$$/$$categoryM.custom_attributes[url_key]$$)}}" stepKey="onFrontendCategoryM"/> |
| 219 | + <see userInput="$$productC.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="seeCategoryMPageAndProductC"/> |
| 220 | + |
| 221 | + <!-- Category N contains only Products B and C --> |
| 222 | + <amOnPage url="{{StorefrontCategoryPage.url($$categoryK.custom_attributes[url_key]$$/$$categoryN.custom_attributes[url_key]$$)}}" stepKey="onFrontendCategoryN"/> |
| 223 | + <see userInput="$$productB.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="seeProductBAndCategoryN"/> |
| 224 | + <see userInput="$$productC.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="seeProductCCategoryN"/> |
| 225 | + </test> |
| 226 | +</tests> |
0 commit comments