|
| 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" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> |
| 10 | + <test name="AdminGenerateUrlRewritesForProductInCategoriesSwitchOffTest"> |
| 11 | + <annotations> |
| 12 | + <features value="Url Rewrite"/> |
| 13 | + <stories value="Url Rewrites cleared in case of switching configuration off"/> |
| 14 | + <title value="Clear Url Rewrites after configuration turned off"/> |
| 15 | + <description value="Check Url Rewrites for product in categories is correctly cleared after configuration turned off"/> |
| 16 | + <severity value="CRITICAL"/> |
| 17 | + <testCaseId value="MC-16330"/> |
| 18 | + <group value="urlRewrite"/> |
| 19 | + </annotations> |
| 20 | + |
| 21 | + <!-- Preconditions--> |
| 22 | + <before> |
| 23 | + <!-- Set the configuration to generate URL rewrie for Products on Category Save--> |
| 24 | + <comment userInput="Enable config to generate URL Rewrite on Category save " stepKey="commentEnableConfig" /> |
| 25 | + <magentoCLI command="config:set catalog/seo/generate_rewrites_on_save 1" stepKey="enableGenerateUrlRewrite"/> |
| 26 | + <!--Flush cache--> |
| 27 | + <magentoCLI command="cache:flush" stepKey="cleanCache1"/> |
| 28 | + <!-- Create 4 categories --> |
| 29 | + <createData entity="SimpleSubCategory" stepKey="simpleSubCategory0"/> |
| 30 | + <createData entity="SimpleSubCategory" stepKey="simpleSubCategory1"/> |
| 31 | + <createData entity="SubCategoryWithParent" stepKey="simpleSubCategory2"> |
| 32 | + <requiredEntity createDataKey="simpleSubCategory1"/> |
| 33 | + </createData> |
| 34 | + <createData entity="SubCategoryWithParent" stepKey="simpleSubCategory3"> |
| 35 | + <requiredEntity createDataKey="simpleSubCategory2"/> |
| 36 | + </createData> |
| 37 | + <!-- Create Simple product 1 and assign it to Category 3 and 0 --> |
| 38 | + <createData entity="ApiSimpleProduct" stepKey="createSimpleProduct"> |
| 39 | + <requiredEntity createDataKey="simpleSubCategory3"/> |
| 40 | + <requiredEntity createDataKey="simpleSubCategory0"/> |
| 41 | + </createData> |
| 42 | + </before> |
| 43 | + <after> |
| 44 | + <deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/> |
| 45 | + <deleteData createDataKey="simpleSubCategory1" stepKey="deletesimpleSubCategory1"/> |
| 46 | + <deleteData createDataKey="simpleSubCategory0" stepKey="deletesimpleSubCategory0"/> |
| 47 | + <amOnPage url="{{AdminLogoutPage.url}}" stepKey="amOnLogoutPage"/> |
| 48 | + </after> |
| 49 | + <!-- Steps --> |
| 50 | + <!-- 1. Log in to Admin --> |
| 51 | + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> |
| 52 | + <!-- 2. Open Marketing - SEO & Search - URL Rewrites --> |
| 53 | + <amOnPage url="{{AdminUrlRewriteIndexPage.url}}" stepKey="amOnUrlRewriteIndexPage"/> |
| 54 | + <fillField selector="{{AdminUrlRewriteIndexSection.requestPathFilter}}" userInput="$createSimpleProduct.custom_attributes[url_key]$.html" stepKey="inputProductName"/> |
| 55 | + <click selector="{{AdminDataGridHeaderSection.applyFilters}}" stepKey="clickSearchButton"/> |
| 56 | + <seeElement selector="{{AdminUrlRewriteIndexSection.requestPathColumnValue($createSimpleProduct.custom_attributes[url_key]$.html)}}" stepKey="seeValue1"/> |
| 57 | + <seeElement selector="{{AdminUrlRewriteIndexSection.requestPathColumnValue($simpleSubCategory0.custom_attributes[url_key]$/$createSimpleProduct.custom_attributes[url_key]$.html)}}" stepKey="seeValue2"/> |
| 58 | + <seeElement selector="{{AdminUrlRewriteIndexSection.requestPathColumnValue($simpleSubCategory1.custom_attributes[url_key]$/$createSimpleProduct.custom_attributes[url_key]$.html)}}" stepKey="seeValue3"/> |
| 59 | + <seeElement selector="{{AdminUrlRewriteIndexSection.requestPathColumnValue($simpleSubCategory1.custom_attributes[url_key]$/$simpleSubCategory2.custom_attributes[url_key]$/$createSimpleProduct.custom_attributes[url_key]$.html)}}" stepKey="seeValue4"/> |
| 60 | + <seeElement selector="{{AdminUrlRewriteIndexSection.requestPathColumnValue($simpleSubCategory1.custom_attributes[url_key]$/$simpleSubCategory2.custom_attributes[url_key]$/$simpleSubCategory3.custom_attributes[url_key]$/$createSimpleProduct.custom_attributes[url_key]$.html)}}" stepKey="seeValue5"/> |
| 61 | + |
| 62 | + <!-- 3. Edit Category 2 for Default Store View: --> |
| 63 | + <actionGroup ref="switchCategoryStoreView" stepKey="switchStoreView"> |
| 64 | + <argument name="Store" value="_defaultStore.name"/> |
| 65 | + <argument name="CatName" value="$$simpleSubCategory0.name$$"/> |
| 66 | + </actionGroup> |
| 67 | + <click selector="{{AdminCategorySEOSection.SectionHeader}}" stepKey="openSeoSection2"/> |
| 68 | + <uncheckOption selector="{{AdminCategorySEOSection.UrlKeyDefaultValueCheckbox}}" stepKey="uncheckRedirect2"/> |
| 69 | + <fillField selector="{{AdminCategorySEOSection.UrlKeyInput}}" userInput="$simpleSubCategory0.custom_attributes[url_key]$-new" stepKey="changeURLKey"/> |
| 70 | + <checkOption selector="{{AdminCategorySEOSection.UrlKeyRedirectCheckbox}}" stepKey="checkUrlKeyRedirect"/> |
| 71 | + |
| 72 | + <!-- 4. Save Category 2 --> |
| 73 | + <click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="saveCategory"/> |
| 74 | + <seeElement selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="assertSuccessMessageAfterSaved"/> |
| 75 | + |
| 76 | + <!-- 5. Set the configuration to generate URL rewrie for Products on Category Save to No--> |
| 77 | + <amOnPage url="{{CatalogConfigPage.url}}" stepKey="amOnCatalogConfigPage"/> |
| 78 | + <conditionalClick selector="{{CatalogSection.seo}}" dependentSelector="{{CatalogSection.CheckIfSeoTabExpand}}" visible="true" stepKey="expandSeoTab" /> |
| 79 | + <waitForElementVisible selector="{{CatalogSection.GenerateUrlRewrites}}" stepKey="GenerateUrlRewritesSelect"/> |
| 80 | + <selectOption userInput="0" selector="{{CatalogSection.GenerateUrlRewrites}}" stepKey="selectUrlGenerationNo" /> |
| 81 | + <waitForElementVisible selector="{{GenerateUrlRewritesConfirm.title}}" stepKey="waitForConfirmModal"/> |
| 82 | + <click selector="{{GenerateUrlRewritesConfirm.ok}}" stepKey="confirmSwitchingGenerationOff"/> |
| 83 | + <click selector="{{CatalogSection.save}}" stepKey="saveConfig" /> |
| 84 | + <waitForPageLoad stepKey="waitForSavingSystemConfiguration"/> |
| 85 | + |
| 86 | + <!-- 6. Flush cache--> |
| 87 | + <magentoCLI command="cache:flush" stepKey="cleanCache"/> |
| 88 | + |
| 89 | + <!-- 7. Open Marketing - SEO & Search - URL Rewrites --> |
| 90 | + <amOnPage url="{{AdminUrlRewriteIndexPage.url}}" stepKey="amOnUrlRewriteIndexPage2"/> |
| 91 | + <fillField selector="{{AdminUrlRewriteIndexSection.requestPathFilter}}" userInput="$createSimpleProduct.custom_attributes[url_key]$.html" stepKey="inputProductName2"/> |
| 92 | + <click selector="{{AdminDataGridHeaderSection.applyFilters}}" stepKey="clickSearchButton2"/> |
| 93 | + <seeElement selector="{{AdminUrlRewriteIndexSection.requestPathColumnValue($createSimpleProduct.custom_attributes[url_key]$.html)}}" stepKey="seeInListValue1"/> |
| 94 | + <dontSeeElement selector="{{AdminUrlRewriteIndexSection.requestPathColumnValue($simpleSubCategory1.custom_attributes[url_key]$/$createSimpleProduct.custom_attributes[url_key]$.html)}}" stepKey="dontSeeValue2"/> |
| 95 | + <dontSeeElement selector="{{AdminUrlRewriteIndexSection.requestPathColumnValue($simpleSubCategory1.custom_attributes[url_key]$/$simpleSubCategory2.custom_attributes[url_key]$/$createSimpleProduct.custom_attributes[url_key]$.html)}}" stepKey="dontSeeValue3"/> |
| 96 | + <dontSeeElement selector="{{AdminUrlRewriteIndexSection.requestPathColumnValue($simpleSubCategory1.custom_attributes[url_key]$/$simpleSubCategory2.custom_attributes[url_key]$/$simpleSubCategory3.custom_attributes[url_key]$/$createSimpleProduct.custom_attributes[url_key]$.html)}}" stepKey="dontSeeValue4"/> |
| 97 | + <seeElement selector="{{AdminUrlRewriteIndexSection.requestPathColumnValue($simpleSubCategory0.custom_attributes[url_key]$-new/$createSimpleProduct.custom_attributes[url_key]$.html)}}" stepKey="seeRedirect2"/> |
| 98 | + </test> |
| 99 | +</tests> |
0 commit comments