|
| 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="StorefrontShouldSeeOnlyConfigurableProductChildAssignedToSeparateCategoryTest"> |
| 12 | + <annotations> |
| 13 | + <features value="ConfigurableProduct"/> |
| 14 | + <stories value="View products"/> |
| 15 | + <title value="It should be possible to only view the child product of a configurable product"/> |
| 16 | + <description value="Create configurable product, add to category such that only child variation is visible in category"/> |
| 17 | + <severity value="CRITICAL"/> |
| 18 | + <testCaseId value="MC-5832"/> |
| 19 | + <group value="configurable_product"/> |
| 20 | + </annotations> |
| 21 | + <before> |
| 22 | + <!-- Create the category --> |
| 23 | + <createData entity="ApiCategory" stepKey="createCategory"/> |
| 24 | + <createData entity="_defaultCategory" stepKey="secondCategory"/> |
| 25 | + |
| 26 | + <!-- Create an attribute with two options to be used in the first child product --> |
| 27 | + <createData entity="productAttributeWithTwoOptions" stepKey="createConfigProductAttribute"/> |
| 28 | + <createData entity="productAttributeOption1" stepKey="createConfigProductAttributeOption1"> |
| 29 | + <requiredEntity createDataKey="createConfigProductAttribute"/> |
| 30 | + </createData> |
| 31 | + <createData entity="productAttributeOption2" stepKey="createConfigProductAttributeOption2"> |
| 32 | + <requiredEntity createDataKey="createConfigProductAttribute"/> |
| 33 | + </createData> |
| 34 | + |
| 35 | + <!-- Add the attribute we just created to default attribute set --> |
| 36 | + <createData entity="AddToDefaultSet" stepKey="createConfigAddToAttributeSet"> |
| 37 | + <requiredEntity createDataKey="createConfigProductAttribute"/> |
| 38 | + </createData> |
| 39 | + |
| 40 | + <!-- Get the first option of the attribute we created --> |
| 41 | + <getData entity="ProductAttributeOptionGetter" index="1" stepKey="getConfigAttributeOption1"> |
| 42 | + <requiredEntity createDataKey="createConfigProductAttribute"/> |
| 43 | + </getData> |
| 44 | + |
| 45 | + <!-- Get the second option of the attribute we created --> |
| 46 | + <getData entity="ProductAttributeOptionGetter" index="2" stepKey="getConfigAttributeOption2"> |
| 47 | + <requiredEntity createDataKey="createConfigProductAttribute"/> |
| 48 | + </getData> |
| 49 | + |
| 50 | + <!-- Create the configurable product and add it to the category --> |
| 51 | + <createData entity="ApiConfigurableProduct" stepKey="createConfigProduct"> |
| 52 | + <requiredEntity createDataKey="createCategory"/> |
| 53 | + </createData> |
| 54 | + |
| 55 | + <!-- Create a simple product and give it the attribute with the first option --> |
| 56 | + <createData entity="ApiSimpleOne" stepKey="createConfigChildProduct1"> |
| 57 | + <requiredEntity createDataKey="createConfigProductAttribute"/> |
| 58 | + <requiredEntity createDataKey="getConfigAttributeOption1"/> |
| 59 | + </createData> |
| 60 | + |
| 61 | + <!-- Create a simple product and give it the attribute with the second option --> |
| 62 | + <createData entity="ApiSimpleTwo" stepKey="createConfigChildProduct2"> |
| 63 | + <requiredEntity createDataKey="createConfigProductAttribute"/> |
| 64 | + <requiredEntity createDataKey="getConfigAttributeOption2"/> |
| 65 | + </createData> |
| 66 | + |
| 67 | + <createData entity="ConfigurableProductTwoOptions" stepKey="createConfigProductOption"> |
| 68 | + <requiredEntity createDataKey="createConfigProduct"/> |
| 69 | + <requiredEntity createDataKey="createConfigProductAttribute"/> |
| 70 | + <requiredEntity createDataKey="getConfigAttributeOption1"/> |
| 71 | + <requiredEntity createDataKey="getConfigAttributeOption2"/> |
| 72 | + </createData> |
| 73 | + |
| 74 | + <!-- Add the first simple product to the configurable product --> |
| 75 | + <createData entity="ConfigurableProductAddChild" stepKey="createConfigProductAddChild1"> |
| 76 | + <requiredEntity createDataKey="createConfigProduct"/> |
| 77 | + <requiredEntity createDataKey="createConfigChildProduct1"/> |
| 78 | + </createData> |
| 79 | + |
| 80 | + <!-- Add the second simple product to the configurable product --> |
| 81 | + <createData entity="ConfigurableProductAddChild" stepKey="createConfigProductAddChild2"> |
| 82 | + <requiredEntity createDataKey="createConfigProduct"/> |
| 83 | + <requiredEntity createDataKey="createConfigChildProduct2"/> |
| 84 | + </createData> |
| 85 | + |
| 86 | + <actionGroup ref="LoginAsAdmin" stepKey="loginToAdmin"/> |
| 87 | + </before> |
| 88 | + |
| 89 | + <after> |
| 90 | + <deleteData createDataKey="createConfigProduct" stepKey="deleteConfigProduct"/> |
| 91 | + <deleteData createDataKey="createConfigChildProduct1" stepKey="deleteConfigChildProduct1"/> |
| 92 | + <deleteData createDataKey="createConfigChildProduct2" stepKey="deleteConfigChildProduct2"/> |
| 93 | + <deleteData createDataKey="createConfigProductAttribute" stepKey="deleteConfigProductAttribute"/> |
| 94 | + <deleteData createDataKey="createCategory" stepKey="deleteApiCategory"/> |
| 95 | + <deleteData createDataKey="secondCategory" stepKey="deleteSecondCategory"/> |
| 96 | + <actionGroup ref="logout" stepKey="logoutFromAdmin"/> |
| 97 | + </after> |
| 98 | + |
| 99 | + <!-- Go to the product page for the first product --> |
| 100 | + <actionGroup ref="goToProductPageViaID" stepKey="openConfigChildProduct1Page"> |
| 101 | + <argument name="productId" value="$$createConfigChildProduct1.id$$"/> |
| 102 | + </actionGroup> |
| 103 | + |
| 104 | + <!-- Edit the visibility the first simple product --> |
| 105 | + <selectOption selector="{{AdminProductFormSection.visibility}}" userInput="Catalog, Search" stepKey="selectVisibilityCatalogSearch"/> |
| 106 | + <!--Add to category--> |
| 107 | + <actionGroup ref="AdminAssignCategoryToProductAndSaveActionGroup" stepKey="addProductToCategoryAndSaveProduct"> |
| 108 | + <argument name="categoryName" value="$$secondCategory.name$$"/> |
| 109 | + </actionGroup> |
| 110 | + |
| 111 | + <magentoCLI command="indexer:reindex" arguments="catalogsearch_fulltext" stepKey="reindexSearchIndex"/> |
| 112 | + |
| 113 | + <!-- Go to storefront to view child product --> |
| 114 | + <actionGroup ref="StorefrontNavigateCategoryPageActionGroup" stepKey="goToSecondCategoryStorefront"> |
| 115 | + <argument name="category" value="$$secondCategory$$"/> |
| 116 | + </actionGroup> |
| 117 | + <actionGroup ref="AssertStorefrontCategorySimpleProductShownActionGroup" stepKey="seeChildProductInCategory"> |
| 118 | + <argument name="productName" value="$$createConfigChildProduct1.name$$"/> |
| 119 | + <argument name="productPrice" value="$$createConfigChildProduct1.price$$"/> |
| 120 | + </actionGroup> |
| 121 | + <actionGroup ref="StorefrontCheckProductIsMissingInCategoryProductsPageActionGroup" stepKey="dontSeeOtherChildProduct"> |
| 122 | + <argument name="productName" value="$$createConfigChildProduct2.name$$"/> |
| 123 | + </actionGroup> |
| 124 | + <actionGroup ref="StorefrontCheckProductIsMissingInCategoryProductsPageActionGroup" stepKey="dontSeeParentProduct"> |
| 125 | + <argument name="productName" value="$$createConfigProduct.name$$"/> |
| 126 | + </actionGroup> |
| 127 | + <actionGroup ref="StorefrontCategoryPageOpenProductActionGroup" stepKey="openConfigChildProductFromCategoryPage"> |
| 128 | + <argument name="productName" value="$$createConfigChildProduct1.name$$"/> |
| 129 | + </actionGroup> |
| 130 | + <actionGroup ref="AssertStorefrontProductDetailPageNameAndUrlActionGroup" stepKey="checkStorefrontConfigChildProductPage"> |
| 131 | + <argument name="productName" value="$$createConfigChildProduct1.name$$"/> |
| 132 | + <argument name="productUrl" value="$$createConfigChildProduct1.custom_attributes[url_key]$$"/> |
| 133 | + </actionGroup> |
| 134 | + </test> |
| 135 | +</tests> |
0 commit comments