|
| 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 | +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> |
| 9 | + <test name="AdminDeleteCreateProductUrlRewriteTest"> |
| 10 | + <annotations> |
| 11 | + <stories value="Delete Product and product-category URL rewrites and then create a new one"/> |
| 12 | + <title value="Delete Product and product-category URL rewrites and then create a new one"/> |
| 13 | + <description value="Delete automated URL rewrites and then create one"/> |
| 14 | + <testCaseId value="AC-8380"/> |
| 15 | + <severity value="MAJOR"/> |
| 16 | + <group value="url_rewrite"/> |
| 17 | + </annotations> |
| 18 | + <before> |
| 19 | + <magentoCLI command="config:set catalog/seo/generate_category_product_rewrites 1" stepKey="enableCategoryProductRewrites"/> |
| 20 | + <actionGroup ref="AdminLoginActionGroup" stepKey="login"/> |
| 21 | + <!-- Create the category to put the product in --> |
| 22 | + <createData entity="SimpleSubCategory" stepKey="createCategory"/> |
| 23 | + <createData entity="SimpleProduct" stepKey="createSimpleProduct"> |
| 24 | + <requiredEntity createDataKey="createCategory"/> |
| 25 | + </createData> |
| 26 | + <magentoCLI command="indexer:reindex" stepKey="performReindex"/> |
| 27 | + <magentoCLI command="cache:flush" stepKey="cleanCache"/> |
| 28 | + </before> |
| 29 | + <after> |
| 30 | + <!-- Clear filters: URL re-write, product --> |
| 31 | + <amOnPage url="{{AdminUrlRewriteIndexPage.url}}" stepKey="openUrlRewriteEditPage"/> |
| 32 | + <conditionalClick selector="{{AdminUrlRewriteIndexSection.clearFiltersButton}}" dependentSelector="{{AdminUrlRewriteIndexSection.clearFiltersButton}}" visible="true" stepKey="cleanFiltersIfTheySet"/> |
| 33 | + <actionGroup ref="ClearProductsFilterActionGroup" stepKey="clearProductsFilter"/> |
| 34 | + <!-- Delete the category and product --> |
| 35 | + <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> |
| 36 | + <deleteData createDataKey="createSimpleProduct" stepKey="deleteProduct"/> |
| 37 | + <magentoCLI command="config:set catalog/seo/generate_category_product_rewrites 0" stepKey="disableGenerateUrlRewrite"/> |
| 38 | + <magentoCLI command="indexer:reindex" stepKey="performExitReindex"/> |
| 39 | + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> |
| 40 | + </after> |
| 41 | + |
| 42 | + <!--Delete created product url rewrite and verify AssertUrlRewriteDeletedMessage--> |
| 43 | + <actionGroup ref="AdminDeleteUrlRewriteActionGroup" stepKey="deleteProductUrlRewrite"> |
| 44 | + <argument name="requestPath" value="$$createSimpleProduct.custom_attributes[url_key]$$.html"/> |
| 45 | + </actionGroup> |
| 46 | + <actionGroup ref="AdminDeleteUrlRewriteActionGroup" stepKey="deleteProductCategoryUrlRewrite"> |
| 47 | + <argument name="requestPath" value="$$createSimpleProduct.custom_attributes[url_key]$$.html"/> |
| 48 | + </actionGroup> |
| 49 | + |
| 50 | + <!--Search and verify AssertUrlRewriteNotInGrid--> |
| 51 | + <actionGroup ref="AdminSearchDeletedUrlRewriteActionGroup" stepKey="searchDeletedUrlRewriteInGrid"> |
| 52 | + <argument name="requestPath" value="$$createSimpleProduct.custom_attributes[url_key]$$.html"/> |
| 53 | + </actionGroup> |
| 54 | + |
| 55 | + <!--Filter Product in product page and get the Product ID --> |
| 56 | + <actionGroup ref="FilterAndSelectProductActionGroup" stepKey="filterProduct"> |
| 57 | + <argument name="productSku" value="$$createSimpleProduct.sku$$"/> |
| 58 | + </actionGroup> |
| 59 | + <grabFromCurrentUrl stepKey="productId" regex="#\/([0-9]*)?\/$#"/> |
| 60 | + |
| 61 | + <!-- Open Category Page and Get Category ID --> |
| 62 | + <actionGroup ref="OpenCategoryFromCategoryTreeActionGroup" stepKey="getCategoryId"> |
| 63 | + <argument name="category" value="$$createCategory.name$$"/> |
| 64 | + </actionGroup> |
| 65 | + <grabFromCurrentUrl stepKey="categoryId" regex="#\/([0-9]*)?\/$#"/> |
| 66 | + |
| 67 | + <!-- Create product redirect --> |
| 68 | + <amOnPage url="{{AdminUrlRewriteProductCategoryPage.url({$productId}, {$categoryId})}}" stepKey="openProductRedirectWithCategory"/> |
| 69 | + <click selector="{{AdminUrlRewriteEditSection.redirectTypeValue('Temporary (302)')}}" stepKey="clickOnRedirectTypeValue"/> |
| 70 | + <click selector="{{AdminUrlRewriteEditSection.saveButton}}" stepKey="clickOnSaveButton"/> |
| 71 | + |
| 72 | + <!-- Assert Url Rewrite Save Message --> |
| 73 | + <actionGroup ref="AssertMessageInAdminPanelActionGroup" stepKey="assertSuccessMessage"> |
| 74 | + <argument name="message" value="The URL Rewrite has been saved."/> |
| 75 | + </actionGroup> |
| 76 | + </test> |
| 77 | +</tests> |
0 commit comments