|
| 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="StorefrontConfigurableProductCategoryViewChildOnlyTest"> |
| 12 | + <annotations> |
| 13 | + <features value="ConfigurableProduct"/> |
| 14 | + <stories value="View configurable product child in storefront"/> |
| 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="ConfigurableProduct"/> |
| 20 | + </annotations> |
| 21 | + <before> |
| 22 | + <!-- Create the category --> |
| 23 | + <createData entity="ApiCategory" stepKey="createCategory"/> |
| 24 | + <createData entity="ApiCategory" 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 | + </before> |
| 86 | + |
| 87 | + <after> |
| 88 | + <amOnPage url="admin/admin/auth/logout/" stepKey="logout"/> |
| 89 | + <deleteData createDataKey="createConfigProduct" stepKey="deleteConfigProduct"/> |
| 90 | + <deleteData createDataKey="createConfigChildProduct1" stepKey="deleteConfigChildProduct1"/> |
| 91 | + <deleteData createDataKey="createConfigChildProduct2" stepKey="deleteConfigChildProduct2"/> |
| 92 | + <deleteData createDataKey="createConfigProductAttribute" stepKey="deleteConfigProductAttribute"/> |
| 93 | + <deleteData createDataKey="createCategory" stepKey="deleteApiCategory"/> |
| 94 | + <deleteData createDataKey="secondCategory" stepKey="deleteSecondCategory"/> |
| 95 | + </after> |
| 96 | + |
| 97 | + <actionGroup ref="LoginAsAdmin" stepKey="login"/> |
| 98 | + |
| 99 | + <!-- Go to the product page for the first product --> |
| 100 | + <amOnPage stepKey="goToProductGrid" url="{{ProductCatalogPage.url}}"/> |
| 101 | + <waitForPageLoad stepKey="waitForProductGridLoad"/> |
| 102 | + <actionGroup stepKey="searchForSimpleProduct" ref="filterProductGridBySku2"> |
| 103 | + <argument name="sku" value="$$createConfigChildProduct1.sku$$"/> |
| 104 | + </actionGroup> |
| 105 | + <actionGroup stepKey="openProductEditPage" ref="openProducForEditByClickingRowXColumnYInProductGrid"/> |
| 106 | + <!-- Edit the visibility the first simple product --> |
| 107 | + <selectOption selector="{{AdminProductFormSection.visibility}}" userInput="Catalog, Search" stepKey="selectVisibilityCatalogSearch"/> |
| 108 | + <!--Add to category--> |
| 109 | + <searchAndMultiSelectOption selector="{{AdminProductFormSection.categoriesDropdown}}" parameterArray="[$$secondCategory.name$$]" stepKey="addProductToCategory"/> |
| 110 | + <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="saveProduct"/> |
| 111 | + <seeElement selector="{{AdminProductMessagesSection.successMessage}}" stepKey="assertSaveMessageSuccess"/> |
| 112 | + |
| 113 | + <!-- Go to storefront to view child product --> |
| 114 | + <amOnPage stepKey="goToStoreFront" url="{{StorefrontHomePage.url}}"/> |
| 115 | + <waitForPageLoad stepKey="waitForStorefront"/> |
| 116 | + <click selector="{{StorefrontHeaderSection.NavigationCategoryByName($$secondCategory.name$$)}}" stepKey="goToCategoryStorefront"/> |
| 117 | + <waitForPageLoad stepKey="waitForStorefrontCategory"/> |
| 118 | + <seeElement selector="{{StorefrontCategoryProductSection.ProductTitleByName($$createConfigChildProduct1.name$$)}}" stepKey="seeChildProductInCategory"/> |
| 119 | + <dontSeeElement selector="{{StorefrontCategoryProductSection.ProductTitleByName($$createConfigChildProduct2.name$$)}}" stepKey="dontSeeOtherChildProduct"/> |
| 120 | + <dontSeeElement selector="{{StorefrontCategoryProductSection.ProductTitleByName($$createConfigProduct.name$$)}}" stepKey="dontSeeParentProduct"/> |
| 121 | + <click selector="{{StorefrontCategoryProductSection.ProductTitleByName($$createConfigChildProduct1.name$$)}}" stepKey="clickProductName"/> |
| 122 | + <waitForPageLoad stepKey="waitForProductPageLoad"/> |
| 123 | + <seeInCurrentUrl url="$$createConfigChildProduct1.custom_attributes[url_key]$$" stepKey="seeProductPageIsAccessible"/> |
| 124 | + <seeElement selector="{{StorefrontProductInfoMainSection.productName($$createConfigChildProduct1.name$$)}}" stepKey="seeProductNameOnProductPage"/> |
| 125 | + </test> |
| 126 | +</tests> |
0 commit comments