|
| 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="AdminProductCustomURLKeyPreservedWhenAssignedToCategoryWithoutCustomURLKey"> |
| 12 | + <annotations> |
| 13 | + <stories value="Product"/> |
| 14 | + <title value="Product custom URL Key is preserved when assigned to a Category (without custom URL Key) alongside with another Product without custom URL Key"/> |
| 15 | + <description value="The test verifies that product custom URL Key is preserved when assigned to a Category (without custom URL Key) alongside with another Product without custom URL Key."/> |
| 16 | + <severity value="MAJOR"/> |
| 17 | + <testCaseId value="MC-6443"/> |
| 18 | + <group value="catalog"/> |
| 19 | + </annotations> |
| 20 | + <before> |
| 21 | + <!-- Create category --> |
| 22 | + <createData entity="SimpleSubCategory" stepKey="createCategory"/> |
| 23 | + |
| 24 | + <!-- Create Simple Products --> |
| 25 | + <createData entity="SimpleProduct2" stepKey="createSimpleProductFirst"/> |
| 26 | + <createData entity="SimpleProduct2" stepKey="createSimpleProductSecond"/> |
| 27 | + |
| 28 | + <!--Login as admin --> |
| 29 | + <actionGroup ref="LoginAsAdmin" stepKey="loginToAdminPanel"/> |
| 30 | + |
| 31 | + <actionGroup ref="AdminCreateStoreViewActionGroup" stepKey="createStoreView"> |
| 32 | + <argument name="customStore" value="storeViewData"/> |
| 33 | + </actionGroup> |
| 34 | + |
| 35 | + <!--Run full reindex and clear caches --> |
| 36 | + <magentoCLI command="indexer:reindex" stepKey="reindex"/> |
| 37 | + <magentoCLI command="cache:flush" arguments="full_page" stepKey="flushCache"/> |
| 38 | + </before> |
| 39 | + <after> |
| 40 | + <deleteData createDataKey="createSimpleProductFirst" stepKey="deleteFirstSimpleProduct"/> |
| 41 | + <deleteData createDataKey="createSimpleProductSecond" stepKey="deleteSecondSimpleProduct"/> |
| 42 | + <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> |
| 43 | + |
| 44 | + <actionGroup ref="AdminDeleteStoreViewActionGroup" stepKey="deleteStoreView"> |
| 45 | + <argument name="customStore" value="storeViewData"/> |
| 46 | + </actionGroup> |
| 47 | + |
| 48 | + <actionGroup ref="logout" stepKey="logout"/> |
| 49 | + </after> |
| 50 | + |
| 51 | + <!-- Open product --> |
| 52 | + <amOnPage url="{{AdminProductEditPage.url($createSimpleProductSecond.id$)}}" stepKey="openProductSecondEditPage"/> |
| 53 | + <!-- switch store view --> |
| 54 | + <actionGroup ref="AdminSwitchStoreViewActionGroup" stepKey="switchToStoreView"> |
| 55 | + <argument name="storeView" value="storeViewData.name"/> |
| 56 | + </actionGroup> |
| 57 | + |
| 58 | + <!-- set url key --> |
| 59 | + <conditionalClick selector="{{AdminProductSEOSection.sectionHeader}}" dependentSelector="{{AdminProductSEOSection.urlKeyInput}}" visible="false" stepKey="openSeoSection"/> |
| 60 | + <uncheckOption selector="{{AdminProductSEOSection.useDefaultUrl}}" stepKey="uncheckUseDefaultUrlKey"/> |
| 61 | + <fillField userInput="U2" selector="{{AdminProductSEOSection.urlKeyInput}}" stepKey="fillUrlKey"/> |
| 62 | + <actionGroup ref="saveProductForm" stepKey="saveProduct"/> |
| 63 | + |
| 64 | + <actionGroup ref="goToAdminCategoryPageById" stepKey="openCategory"> |
| 65 | + <argument name="id" value="$createCategory.id$"/> |
| 66 | + </actionGroup> |
| 67 | + |
| 68 | + <actionGroup ref="AdminCategoryAssignProduct" stepKey="assignSimpleProductFirst"> |
| 69 | + <argument name="productSku" value="$createSimpleProductFirst.sku$"/> |
| 70 | + </actionGroup> |
| 71 | + <actionGroup ref="AdminCategoryAssignProduct" stepKey="assignSimpleProductSecond"> |
| 72 | + <argument name="productSku" value="$createSimpleProductSecond.sku$"/> |
| 73 | + </actionGroup> |
| 74 | + |
| 75 | + <actionGroup ref="saveCategoryForm" stepKey="saveCategory"/> |
| 76 | + |
| 77 | + <executeJS function="var s = '$createCategory.name$'; var res=s.toLowerCase(); return res;" stepKey="categoryNameLower" /> |
| 78 | + <executeJS function="var s = '$createSimpleProductFirst.name$'; var res=s.toLowerCase(); return res;" stepKey="simpleProductFirstNameLower" /> |
| 79 | + <executeJS function="var s = '$createSimpleProductSecond.name$';var res=s.toLowerCase(); return res;" stepKey="simpleProductSecondNameLower" /> |
| 80 | + |
| 81 | + <!-- Make assertions on frontend --> |
| 82 | + <amOnPage url="{{StorefrontHomePage.url}}" stepKey="goToStorefrontPage"/> |
| 83 | + <click selector="{{StorefrontHeaderSection.NavigationCategoryByName($createCategory.name$)}}" stepKey="onCategoryPage"/> |
| 84 | + <seeInCurrentUrl url="{$categoryNameLower}.html" stepKey="checkCategryUrlKey"/> |
| 85 | + |
| 86 | + <!-- Open first product --> |
| 87 | + <click selector="{{StorefrontCategoryProductSection.ProductTitleByName($createSimpleProductFirst.name$)}}" stepKey="openFirstProduct"/> |
| 88 | + <seeInCurrentUrl url="{$simpleProductFirstNameLower}.html" stepKey="checkFirstSimpleProductUrlKey"/> |
| 89 | + |
| 90 | + <amOnPage url="{{StorefrontCategoryPage.url($$createCategory.name$$)}}" stepKey="onCategoryView"/> |
| 91 | + <!-- Open second product --> |
| 92 | + <click selector="{{StorefrontCategoryProductSection.ProductTitleByName($createSimpleProductSecond.name$)}}" stepKey="openSecondProduct"/> |
| 93 | + <seeInCurrentUrl url="{$simpleProductSecondNameLower}.html" stepKey="checkSecondSimpleProductUrlKey"/> |
| 94 | + |
| 95 | + <actionGroup ref="StorefrontSwitchStoreViewActionGroup" stepKey="switchToCustomStoreView"> |
| 96 | + <argument name="storeView" value="storeViewData"/> |
| 97 | + </actionGroup> |
| 98 | + |
| 99 | + <click selector="{{StorefrontHeaderSection.NavigationCategoryByName($createCategory.name$)}}" stepKey="openCategoryPage"/> |
| 100 | + <seeInCurrentUrl url="{$categoryNameLower}.html" stepKey="seeCategoryUrlKey"/> |
| 101 | + |
| 102 | + <!-- Open product first --> |
| 103 | + <click selector="{{StorefrontCategoryProductSection.ProductTitleByName($$createSimpleProductFirst.name$$)}}" stepKey="openFirstSimpleProduct"/> |
| 104 | + <seeInCurrentUrl url="{$simpleProductFirstNameLower}.html" stepKey="assertFirstSimpleProductUrlKey"/> |
| 105 | + |
| 106 | + <click selector="{{StorefrontHeaderSection.NavigationCategoryByName($createCategory.name$)}}" stepKey="openCategoryView"/> |
| 107 | + <!-- Open product2 --> |
| 108 | + <click selector="{{StorefrontCategoryProductSection.ProductTitleByName($createSimpleProductSecond.name$)}}" stepKey="openSecondSimpleProduct"/> |
| 109 | + <seeInCurrentUrl url="u2.html" stepKey="assertSecondSimpleProductUrlKey"/> |
| 110 | + </test> |
| 111 | +</tests> |
0 commit comments