|
| 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="AdminApplyCatalogRuleForConfigurableProductWithSpecialPricesTest"> |
| 11 | + <annotations> |
| 12 | + <features value="CatalogRule"/> |
| 13 | + <stories value="Apply catalog price rule"/> |
| 14 | + <title value="Admin should be able to apply the catalog price rule for configurable product with special prices"/> |
| 15 | + <description value="Admin should be able to apply the catalog price rule for configurable product with special prices"/> |
| 16 | + <severity value="CRITICAL"/> |
| 17 | + <testCaseId value="MC-149"/> |
| 18 | + <group value="Catalog"/> |
| 19 | + </annotations> |
| 20 | + <before> |
| 21 | + <!-- Login as Admin --> |
| 22 | + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> |
| 23 | + |
| 24 | + <!-- Create category --> |
| 25 | + <createData entity="ApiCategory" stepKey="createCategory"/> |
| 26 | + |
| 27 | + <!-- Create the configurable product --> |
| 28 | + <createData entity="ApiConfigurableProduct" stepKey="createConfigProduct"> |
| 29 | + <requiredEntity createDataKey="createCategory"/> |
| 30 | + </createData> |
| 31 | + |
| 32 | + <!-- Add two options to the configurable product --> |
| 33 | + <createData entity="productAttributeWithTwoOptions" stepKey="createConfigProductAttribute"/> |
| 34 | + <createData entity="productAttributeOption1" stepKey="createConfigProductAttributeFirstOption"> |
| 35 | + <requiredEntity createDataKey="createConfigProductAttribute"/> |
| 36 | + </createData> |
| 37 | + <createData entity="productAttributeOption2" stepKey="createConfigProductAttributeSecondOption"> |
| 38 | + <requiredEntity createDataKey="createConfigProductAttribute"/> |
| 39 | + </createData> |
| 40 | + |
| 41 | + <!-- Add created options to the default attribute set --> |
| 42 | + <createData entity="AddToDefaultSet" stepKey="createConfigAddToAttributeSet"> |
| 43 | + <requiredEntity createDataKey="createConfigProductAttribute"/> |
| 44 | + </createData> |
| 45 | + <getData entity="ProductAttributeOptionGetter" index="1" stepKey="getConfigAttributeFirstOption"> |
| 46 | + <requiredEntity createDataKey="createConfigProductAttribute"/> |
| 47 | + </getData> |
| 48 | + <getData entity="ProductAttributeOptionGetter" index="2" stepKey="getConfigAttributeSecondOption"> |
| 49 | + <requiredEntity createDataKey="createConfigProductAttribute"/> |
| 50 | + </getData> |
| 51 | + |
| 52 | + <!-- Create two children products that will be a part of the configurable product --> |
| 53 | + <createData entity="ApiSimpleOne" stepKey="createFirstConfigChildProduct"> |
| 54 | + <requiredEntity createDataKey="createConfigProductAttribute"/> |
| 55 | + <requiredEntity createDataKey="getConfigAttributeFirstOption"/> |
| 56 | + </createData> |
| 57 | + <createData entity="ApiSimpleTwo" stepKey="createSecondConfigChildProduct"> |
| 58 | + <requiredEntity createDataKey="createConfigProductAttribute"/> |
| 59 | + <requiredEntity createDataKey="getConfigAttributeSecondOption"/> |
| 60 | + </createData> |
| 61 | + |
| 62 | + <!-- Assign two products to the configurable product --> |
| 63 | + <createData entity="ConfigurableProductThreeOptions" stepKey="createConfigProductOption"> |
| 64 | + <requiredEntity createDataKey="createConfigProduct"/> |
| 65 | + <requiredEntity createDataKey="createConfigProductAttribute"/> |
| 66 | + <requiredEntity createDataKey="getConfigAttributeFirstOption"/> |
| 67 | + <requiredEntity createDataKey="getConfigAttributeSecondOption"/> |
| 68 | + </createData> |
| 69 | + <createData entity="ConfigurableProductAddChild" stepKey="createConfigProductAddFirstChild"> |
| 70 | + <requiredEntity createDataKey="createConfigProduct"/> |
| 71 | + <requiredEntity createDataKey="createFirstConfigChildProduct"/> |
| 72 | + </createData> |
| 73 | + <createData entity="ConfigurableProductAddChild" stepKey="createConfigProductAddSecondChild"> |
| 74 | + <requiredEntity createDataKey="createConfigProduct"/> |
| 75 | + <requiredEntity createDataKey="createSecondConfigChildProduct"/> |
| 76 | + </createData> |
| 77 | + </before> |
| 78 | + <after> |
| 79 | + <!-- Delete the catalog price rule --> |
| 80 | + <actionGroup ref="AdminOpenCatalogPriceRulePageActionGroup" stepKey="openCatalogPriceRulePage"/> |
| 81 | + <actionGroup stepKey="deletePriceRule" ref="deleteEntitySecondaryGrid"> |
| 82 | + <argument name="name" value="{{_defaultCatalogRule.name}}"/> |
| 83 | + <argument name="searchInput" value="{{AdminSecondaryGridSection.catalogRuleIdentifierSearch}}"/> |
| 84 | + </actionGroup> |
| 85 | + |
| 86 | + <!-- Admin logout --> |
| 87 | + <actionGroup ref="logout" stepKey="adminLogout"/> |
| 88 | + |
| 89 | + <!-- Delete all created data --> |
| 90 | + <deleteData createDataKey="createConfigProduct" stepKey="deleteConfigProduct"/> |
| 91 | + <deleteData createDataKey="createFirstConfigChildProduct" stepKey="deleteConfigChildProduct1"/> |
| 92 | + <deleteData createDataKey="createSecondConfigChildProduct" stepKey="deleteConfigChildProduct2"/> |
| 93 | + <deleteData createDataKey="createConfigProductAttribute" stepKey="deleteConfigProductAttribute"/> |
| 94 | + <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> |
| 95 | + </after> |
| 96 | + |
| 97 | + <!-- Add special prices for products --> |
| 98 | + <actionGroup ref="goToProductPageViaID" stepKey="goToFirstChildProduct"> |
| 99 | + <argument name="productId" value="$$createFirstConfigChildProduct.id$$"/> |
| 100 | + </actionGroup> |
| 101 | + <actionGroup ref="AddSpecialPriceToProductActionGroup" stepKey="addSpecialPriceForFirstProduct"> |
| 102 | + <argument name="price" value="{{specialProductPrice.price}}"/> |
| 103 | + </actionGroup> |
| 104 | + <actionGroup ref="saveProductForm" stepKey="saveFirstProduct"/> |
| 105 | + |
| 106 | + <actionGroup ref="goToProductPageViaID" stepKey="goToSecondChildProduct"> |
| 107 | + <argument name="productId" value="$$createSecondConfigChildProduct.id$$"/> |
| 108 | + </actionGroup> |
| 109 | + <actionGroup ref="AddSpecialPriceToProductActionGroup" stepKey="addSpecialPriceForSecondProduct"> |
| 110 | + <argument name="price" value="{{specialProductPrice.price}}"/> |
| 111 | + </actionGroup> |
| 112 | + <actionGroup ref="saveProductForm" stepKey="saveSecondProduct"/> |
| 113 | + |
| 114 | + <!-- Create a new catalog price rule --> |
| 115 | + <actionGroup ref="newCatalogPriceRuleByUIWithConditionIsCategory" stepKey="newCatalogPriceRuleByUIWithConditionIsCategory"> |
| 116 | + <argument name="categoryId" value="$createCategory.id$"/> |
| 117 | + </actionGroup> |
| 118 | + |
| 119 | + <!-- Select not logged in customer group --> |
| 120 | + <actionGroup ref="selectNotLoggedInCustomerGroupActionGroup" stepKey="selectNotLoggedInCustomerGroup"/> |
| 121 | + |
| 122 | + <!-- Save and apply the new catalog price rule --> |
| 123 | + <actionGroup ref="SaveAndApplyCatalogPriceRuleActionGroup" stepKey="saveAndApplyCatalogPriceRule"/> |
| 124 | + |
| 125 | + <!-- Reindex and flash cache --> |
| 126 | + <magentoCLI command="indexer:reindex" stepKey="reindex"/> |
| 127 | + <magentoCLI command="cache:flush" stepKey="flushCache"/> |
| 128 | + |
| 129 | + <!-- Open Storefront product page and assert created configurable product --> |
| 130 | + <actionGroup ref="OpenStoreFrontProductPageActionGroup" stepKey="openProductPage"> |
| 131 | + <argument name="productUrlKey" value="$$createConfigProduct.custom_attributes[url_key]$$"/> |
| 132 | + </actionGroup> |
| 133 | + |
| 134 | + <!-- Select first configurable product option --> |
| 135 | + <selectOption selector="{{StorefrontProductInfoMainSection.productOptionSelect('$$createConfigProductAttribute.attribute[frontend_labels][0][label]$$')}}" userInput="$$createConfigProductAttributeFirstOption.option[store_labels][0][label]$$" stepKey="selectOptionOne"/> |
| 136 | + |
| 137 | + <!-- Assert regular and special price after selecting the first option --> |
| 138 | + <actionGroup ref="AssertStorefrontProductPricesActionGroup" stepKey="assertStorefrontProductPricesForFirstOption"> |
| 139 | + <argument name="productPrice" value="$createFirstConfigChildProduct.price$"/> |
| 140 | + <argument name="productFinalPrice" value="{{specialProductPrice.price}}"/> |
| 141 | + </actionGroup> |
| 142 | + |
| 143 | + <!-- Select second configurable product option --> |
| 144 | + <selectOption selector="{{StorefrontProductInfoMainSection.productOptionSelect('$$createConfigProductAttribute.attribute[frontend_labels][0][label]$$')}}" userInput="$$createConfigProductAttributeSecondOption.option[store_labels][0][label]$$" stepKey="selectOptionTwo"/> |
| 145 | + |
| 146 | + <!-- Assert regular and special price after selecting the second option --> |
| 147 | + <actionGroup ref="AssertStorefrontProductPricesActionGroup" stepKey="assertStorefrontProductPricesForSecondOption"> |
| 148 | + <argument name="productPrice" value="$createSecondConfigChildProduct.price$"/> |
| 149 | + <argument name="productFinalPrice" value="{{specialProductPrice.price}}"/> |
| 150 | + </actionGroup> |
| 151 | + </test> |
| 152 | +</tests> |
0 commit comments