|
| 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="AdminCheckConfigurableProductPriceWhenChildProductPriceUpdatedTest"> |
| 11 | + <annotations> |
| 12 | + <stories value="Configurable Product"/> |
| 13 | + <title value="Check price of configurable product when one child product price is updated"/> |
| 14 | + <description value="Login as admin and check the configurable product price when one child product child product price is updated"/> |
| 15 | + <severity value="CRITICAL"/> |
| 16 | + <group value="product"/> |
| 17 | + </annotations> |
| 18 | + <before> |
| 19 | + <!-- Login as Admin --> |
| 20 | + <actionGroup ref="AdminLoginActionGroup" stepKey="loginToAdminPanel"/> |
| 21 | + |
| 22 | + <!-- Create Default Category --> |
| 23 | + <createData entity="_defaultCategory" stepKey="createCategory"/> |
| 24 | + |
| 25 | + <!-- Create an attribute with two options to be used in the child product --> |
| 26 | + <createData entity="productAttributeWithTwoOptions" stepKey="createConfigProductAttribute"/> |
| 27 | + <createData entity="productAttributeOption1" stepKey="createConfigProductAttributeOption1"> |
| 28 | + <requiredEntity createDataKey="createConfigProductAttribute"/> |
| 29 | + </createData> |
| 30 | + <createData entity="productAttributeOption2" stepKey="createConfigProductAttributeOption2"> |
| 31 | + <requiredEntity createDataKey="createConfigProductAttribute"/> |
| 32 | + </createData> |
| 33 | + |
| 34 | + <!-- Add the attribute just created to default attribute set --> |
| 35 | + <createData entity="AddToDefaultSet" stepKey="createConfigAddToAttributeSet"> |
| 36 | + <requiredEntity createDataKey="createConfigProductAttribute"/> |
| 37 | + </createData> |
| 38 | + |
| 39 | + <!-- Get the first option of the attribute created --> |
| 40 | + <getData entity="ProductAttributeOptionGetter" index="1" stepKey="getConfigAttributeOption1"> |
| 41 | + <requiredEntity createDataKey="createConfigProductAttribute"/> |
| 42 | + </getData> |
| 43 | + |
| 44 | + <!-- Get the second option of the attribute created --> |
| 45 | + <getData entity="ProductAttributeOptionGetter" index="2" stepKey="getConfigAttributeOption2"> |
| 46 | + <requiredEntity createDataKey="createConfigProductAttribute"/> |
| 47 | + </getData> |
| 48 | + |
| 49 | + <!-- Create Configurable product --> |
| 50 | + <createData entity="BaseConfigurableProduct" stepKey="createConfigProduct"> |
| 51 | + <requiredEntity createDataKey="createCategory"/> |
| 52 | + </createData> |
| 53 | + |
| 54 | + <!-- Create a simple product and give it the attribute with the first option --> |
| 55 | + <createData entity="ApiSimpleOne" stepKey="createConfigChildProduct1"> |
| 56 | + <requiredEntity createDataKey="createConfigProductAttribute"/> |
| 57 | + <requiredEntity createDataKey="getConfigAttributeOption1"/> |
| 58 | + <field key="price">10.00</field> |
| 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 | + <field key="price">20.00</field> |
| 66 | + </createData> |
| 67 | + |
| 68 | + <!-- Create the configurable product --> |
| 69 | + <createData entity="ConfigurableProductTwoOptions" stepKey="createConfigProductOption"> |
| 70 | + <requiredEntity createDataKey="createConfigProduct"/> |
| 71 | + <requiredEntity createDataKey="createConfigProductAttribute"/> |
| 72 | + <requiredEntity createDataKey="getConfigAttributeOption1"/> |
| 73 | + <requiredEntity createDataKey="getConfigAttributeOption2"/> |
| 74 | + </createData> |
| 75 | + |
| 76 | + <!-- Add the first simple product to the configurable product --> |
| 77 | + <createData entity="ConfigurableProductAddChild" stepKey="createConfigProductAddChild1"> |
| 78 | + <requiredEntity createDataKey="createConfigProduct"/> |
| 79 | + <requiredEntity createDataKey="createConfigChildProduct1"/> |
| 80 | + </createData> |
| 81 | + |
| 82 | + <!-- Add the second simple product to the configurable product --> |
| 83 | + <createData entity="ConfigurableProductAddChild" stepKey="createConfigProductAddChild2"> |
| 84 | + <requiredEntity createDataKey="createConfigProduct"/> |
| 85 | + <requiredEntity createDataKey="createConfigChildProduct2"/> |
| 86 | + </createData> |
| 87 | + |
| 88 | + <!--Open Index Management Page and Select Index mode "Update by Schedule" --> |
| 89 | + <magentoCLI stepKey="setIndexerMode" command="indexer:set-mode" arguments="schedule" /> |
| 90 | + |
| 91 | + <!-- Run cron --> |
| 92 | + <magentoCron stepKey="runIndexCronJobs" groups="index"/> |
| 93 | + <comment userInput="Adding the comment to replace CliCacheFlushActionGroup action group ('cache:flush' command) for preserving Backward Compatibility" stepKey="flushCache"/> |
| 94 | + |
| 95 | + <!-- Wait till cron job runs for schedule updates --> |
| 96 | + <wait time="60" stepKey="waitForUpdateStarts"/> |
| 97 | + </before> |
| 98 | + <after> |
| 99 | + <magentoCLI stepKey="setIndexerMode" command="indexer:set-mode" arguments="realtime" /> |
| 100 | + <comment userInput="Adding the comment to replace CliIndexerReindexActionGroup action group ('indexer:reindex' commands) for preserving Backward Compatibility" stepKey="indexerReindex"/> |
| 101 | + |
| 102 | + <!-- Delete Created Data --> |
| 103 | + <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> |
| 104 | + <deleteData createDataKey="createConfigProduct" stepKey="deleteConfigProduct"/> |
| 105 | + <deleteData createDataKey="createConfigChildProduct1" stepKey="deleteConfigChildProduct1"/> |
| 106 | + <deleteData createDataKey="createConfigChildProduct2" stepKey="deleteConfigChildProduct2"/> |
| 107 | + <deleteData createDataKey="createConfigProductAttribute" stepKey="deleteAttribute"/> |
| 108 | + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> |
| 109 | + |
| 110 | + <!-- Reindex invalidated indices after product attribute has been created/deleted --> |
| 111 | + <magentoCron groups="index" stepKey="reindexInvalidatedIndices"/> |
| 112 | + </after> |
| 113 | + |
| 114 | + <!-- Open Product in Store Front Page --> |
| 115 | + <actionGroup ref="StorefrontOpenProductEntityPageActionGroup" stepKey="openProductInStoreFront"> |
| 116 | + <argument name="product" value="$createConfigProduct$"/> |
| 117 | + </actionGroup> |
| 118 | + <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForProductToLoad"/> |
| 119 | + |
| 120 | + <!-- Verify category,Configurable product and initial price --> |
| 121 | + <actionGroup ref="StorefrontAssertCategoryNameIsShownInMenuActionGroup" stepKey="seeCategoryInFrontPage"> |
| 122 | + <argument name="categoryName" value="$$createCategory.name$$"/> |
| 123 | + </actionGroup> |
| 124 | + <actionGroup ref="StorefrontAssertProductNameOnProductPageActionGroup" stepKey="seeProductNameInStoreFront"> |
| 125 | + <argument name="productName" value="$$createConfigProduct.name$$"/> |
| 126 | + </actionGroup> |
| 127 | + <actionGroup ref="StorefrontAssertProductPriceOnProductPageActionGroup" stepKey="seeInitialPriceInStoreFront"> |
| 128 | + <argument name="productPrice" value="$$createConfigChildProduct1.price$$"/> |
| 129 | + </actionGroup> |
| 130 | + <actionGroup ref="StorefrontAssertProductSkuOnProductPageActionGroup" stepKey="seeProductSkuInStoreFront"> |
| 131 | + <argument name="productSku" value="$$createConfigProduct.sku$$"/> |
| 132 | + </actionGroup> |
| 133 | + <actionGroup ref="AssertStorefrontProductStockStatusOnProductPageActionGroup" stepKey="seeProductStatusInStoreFront"> |
| 134 | + <argument name="productStockStatus" value="In Stock"/> |
| 135 | + </actionGroup> |
| 136 | + |
| 137 | + <!-- Verify First Child Product attribute option is displayed --> |
| 138 | + <see selector="{{StorefrontProductInfoMainSection.productOptionSelect($$createConfigProductAttribute.default_value$$)}}" userInput="$$getConfigAttributeOption1.label$$" stepKey="seeOption1"/> |
| 139 | + |
| 140 | + <!-- Select product Attribute option1, option2 and option3 and verify changes in the price --> |
| 141 | + <actionGroup ref="StorefrontProductPageSelectDropDownOptionValueActionGroup" stepKey="selectOption1"> |
| 142 | + <argument name="attributeLabel" value="$$createConfigProductAttribute.default_value$$"/> |
| 143 | + <argument name="optionLabel" value="$$getConfigAttributeOption1.label$$"/> |
| 144 | + </actionGroup> |
| 145 | + <actionGroup ref="StorefrontAssertProductPriceOnProductPageActionGroup" stepKey="seeChildProduct1PriceInStoreFront"> |
| 146 | + <argument name="productPrice" value="$$createConfigChildProduct1.price$$"/> |
| 147 | + </actionGroup> |
| 148 | + <actionGroup ref="StorefrontProductPageSelectDropDownOptionValueActionGroup" stepKey="selectOption2"> |
| 149 | + <argument name="attributeLabel" value="$$createConfigProductAttribute.default_value$$"/> |
| 150 | + <argument name="optionLabel" value="$$getConfigAttributeOption2.label$$"/> |
| 151 | + </actionGroup> |
| 152 | + <actionGroup ref="StorefrontAssertProductPriceOnProductPageActionGroup" stepKey="seeChildProduct2PriceInStoreFront"> |
| 153 | + <argument name="productPrice" value="$$createConfigChildProduct2.price$$"/> |
| 154 | + </actionGroup> |
| 155 | + <!-- Open Product Index Page and Filter First Child product --> |
| 156 | + <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="navigateToProductIndex"/> |
| 157 | + <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="filterProduct"/> |
| 158 | + <actionGroup ref="CliCacheCleanActionGroup" stepKey="cleanFullPageCache"> |
| 159 | + <argument name="tags" value="full_page"/> |
| 160 | + </actionGroup> |
| 161 | + <actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="selectFirstRow"> |
| 162 | + <argument name="productId" value="$$createConfigChildProduct1.id$$"/> |
| 163 | + </actionGroup> |
| 164 | + <waitForPageLoad stepKey="waitForProductPageToLoad"/> |
| 165 | + |
| 166 | + <updateData entity="SimpleProductUpdatePrice90" createDataKey="createConfigChildProduct1" stepKey="updateSimpleProductOne"/> |
| 167 | + |
| 168 | + <!-- Run cron --> |
| 169 | + <magentoCron stepKey="runIndexCronJobs" groups="index"/> |
| 170 | + <comment userInput="Adding the comment to replace CliCacheFlushActionGroup action group ('cache:flush' command) for preserving Backward Compatibility" stepKey="flushCache"/> |
| 171 | + |
| 172 | + <!-- Wait till cron job runs for schedule updates --> |
| 173 | + <wait time="60" stepKey="waitForUpdateStarts"/> |
| 174 | + |
| 175 | + <!-- Open Product Store Front Page --> |
| 176 | + <actionGroup ref="StorefrontOpenProductEntityPageActionGroup" stepKey="openProductInStoreFront1"> |
| 177 | + <argument name="product" value="$createConfigProduct$"/> |
| 178 | + </actionGroup> |
| 179 | + <comment userInput="CommentConfigurableProductTwoOptions is added to preserve the step key for backward compatibility" stepKey="waitForProductToLoad1"/> |
| 180 | + |
| 181 | + <!-- Verify category,configurable product and updated price --> |
| 182 | + <actionGroup ref="StorefrontAssertCategoryNameIsShownInMenuActionGroup" stepKey="seeCategoryInFrontPage1"> |
| 183 | + <argument name="categoryName" value="$$createCategory.name$$"/> |
| 184 | + </actionGroup> |
| 185 | + <actionGroup ref="StorefrontAssertProductNameOnProductPageActionGroup" stepKey="seeProductNameInStoreFront1"> |
| 186 | + <argument name="productName" value="$$createConfigProduct.name$$"/> |
| 187 | + </actionGroup> |
| 188 | + <actionGroup ref="StorefrontAssertProductPriceOnProductPageActionGroup" stepKey="seeUpdatedProductPriceInStoreFront"> |
| 189 | + <argument name="productPrice" value="$$createConfigChildProduct2.price$$"/> |
| 190 | + </actionGroup> |
| 191 | + <actionGroup ref="StorefrontAssertProductSkuOnProductPageActionGroup" stepKey="seeProductSkuInStoreFront1"> |
| 192 | + <argument name="productSku" value="$$createConfigProduct.sku$$"/> |
| 193 | + </actionGroup> |
| 194 | + <actionGroup ref="AssertStorefrontProductStockStatusOnProductPageActionGroup" stepKey="seeProductStatusInStoreFront1"> |
| 195 | + <argument name="productStockStatus" value="In Stock"/> |
| 196 | + </actionGroup> |
| 197 | + |
| 198 | + <!-- Verify product Attribute Option1 is displayed --> |
| 199 | + <see selector="{{StorefrontProductInfoMainSection.productOptionSelect($$createConfigProductAttribute.default_value$$)}}" userInput="$$getConfigAttributeOption1.label$$" stepKey="seeOption1AfterUpdate"/> |
| 200 | + |
| 201 | + <!--Select product Attribute option1 and verify changes in the price --> |
| 202 | + <actionGroup ref="StorefrontProductPageSelectDropDownOptionValueActionGroup" stepKey="selectOption1AfterUpdate"> |
| 203 | + <argument name="attributeLabel" value="$$createConfigProductAttribute.default_value$$"/> |
| 204 | + <argument name="optionLabel" value="$$getConfigAttributeOption1.label$$"/> |
| 205 | + </actionGroup> |
| 206 | + <actionGroup ref="StorefrontAssertProductPriceOnProductPageActionGroup" stepKey="seeChildProduct1PriceInStoreFrontAfterUpdate"> |
| 207 | + <argument name="productPrice" value="$$createConfigChildProduct1.price$$"/> |
| 208 | + </actionGroup> |
| 209 | + </test> |
| 210 | +</tests> |
0 commit comments