|
| 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="StorefrontCheckPriceForDynamicBundleProductWithMixedDiscountsTest"> |
| 12 | + <annotations> |
| 13 | + <features value="Bundle"/> |
| 14 | + <stories value="View bundle product"/> |
| 15 | + <title value="Check mixed discount prices for bundle product"/> |
| 16 | + <description value="The testcase purpose to verify mixed discount prices for bundle product on storefront"/> |
| 17 | + <testCaseId value="AC-4571"/> |
| 18 | + <severity value="MAJOR"/> |
| 19 | + </annotations> |
| 20 | + <before> |
| 21 | + <!-- create three categories--> |
| 22 | + <createData entity="_defaultCategory" stepKey="category1"/> |
| 23 | + <createData entity="_defaultCategory" stepKey="category2"/> |
| 24 | + <createData entity="_defaultCategory" stepKey="category3"/> |
| 25 | + <!-- login to backend --> |
| 26 | + <actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/> |
| 27 | + <actionGroup ref="AdminCatalogPriceRuleDeleteAllActionGroup" stepKey="clearExistingCatalogPriceRules"/> |
| 28 | + <!-- create two catalog rules for categories --> |
| 29 | + <!-- first catalog rule --> |
| 30 | + <actionGroup ref="AdminOpenNewCatalogPriceRuleFormPageActionGroup" stepKey="openNewCatalogPriceRulePage"/> |
| 31 | + <actionGroup ref="AdminCatalogPriceRuleFillMainInfoActionGroup" stepKey="fillMainInfoForCatalogPriceRule"/> |
| 32 | + <actionGroup ref="AdminFillCatalogRuleConditionActionGroup" stepKey="fillConditionsForCatalogPriceRule"> |
| 33 | + <argument name="conditionValue" value="$category2.id$"/> |
| 34 | + </actionGroup> |
| 35 | + <actionGroup ref="AdminCatalogPriceRuleFillActionsActionGroup" stepKey="fillActionsForCatalogPriceRule"> |
| 36 | + <argument name="apply" value="by_percent"/> |
| 37 | + <argument name="discountAmount" value="100"/> |
| 38 | + </actionGroup> |
| 39 | + <actionGroup ref="AdminCatalogPriceRuleSaveAndApplyActionGroup" stepKey="saveAndApplyFirstPriceRule"/> |
| 40 | + <!-- second catalog rule --> |
| 41 | + <actionGroup ref="AdminOpenNewCatalogPriceRuleFormPageActionGroup" stepKey="openAgainNewCatalogPriceRulePage"/> |
| 42 | + <actionGroup ref="AdminCatalogPriceRuleFillMainInfoActionGroup" stepKey="fillMainInfoForSecondCatalogPriceRule"/> |
| 43 | + <actionGroup ref="AdminFillCatalogRuleConditionActionGroup" stepKey="fillConditionsForSecondCatalogPriceRule"> |
| 44 | + <argument name="conditionValue" value="$category3.id$"/> |
| 45 | + </actionGroup> |
| 46 | + <actionGroup ref="AdminCatalogPriceRuleFillActionsActionGroup" stepKey="fillActionsForSecondCatalogPriceRule"> |
| 47 | + <argument name="apply" value="by_percent"/> |
| 48 | + <argument name="discountAmount" value="70"/> |
| 49 | + </actionGroup> |
| 50 | + <actionGroup ref="AdminCatalogPriceRuleSaveAndApplyActionGroup" stepKey="saveAndApplySecondPriceRule"/> |
| 51 | + <!-- create 6 simple products --> |
| 52 | + <!-- create first product --> |
| 53 | + <createData entity="_defaultProduct" stepKey="firstProduct"> |
| 54 | + <field key="price">10.5</field> |
| 55 | + <field key="quantity">1000</field> |
| 56 | + <requiredEntity createDataKey="category1"/> |
| 57 | + </createData> |
| 58 | + <createData entity="tierPriceForSimpleProduct" stepKey="addTierPrice"> |
| 59 | + <requiredEntity createDataKey="firstProduct"/> |
| 60 | + </createData> |
| 61 | + <!-- create second product --> |
| 62 | + <createData entity="SimpleProduct4" stepKey="secondProduct"> |
| 63 | + <field key="price">15</field> |
| 64 | + <requiredEntity createDataKey="category2"/> |
| 65 | + </createData> |
| 66 | + <!-- create third product --> |
| 67 | + <createData entity="_defaultProduct" stepKey="thirdProduct"> |
| 68 | + <field key="price">23.40</field> |
| 69 | + <field key="quantity">1000</field> |
| 70 | + <requiredEntity createDataKey="category1"/> |
| 71 | + </createData> |
| 72 | + <createData entity="specialProductPriceForProduct" stepKey="addSpecialPrice"> |
| 73 | + <requiredEntity createDataKey="thirdProduct"/> |
| 74 | + </createData> |
| 75 | + <!-- create fourth product --> |
| 76 | + <createData entity="_defaultProduct" stepKey="fourthProduct"> |
| 77 | + <field key="price">30</field> |
| 78 | + <field key="quantity">1000</field> |
| 79 | + <requiredEntity createDataKey="category3"/> |
| 80 | + </createData> |
| 81 | + <!-- create fifth product --> |
| 82 | + <createData entity="_defaultProduct" stepKey="fifthProduct"> |
| 83 | + <field key="price">25</field> |
| 84 | + <field key="status">0</field> |
| 85 | + <field key="quantity">1000</field> |
| 86 | + <requiredEntity createDataKey="category1"/> |
| 87 | + </createData> |
| 88 | + <!-- create sixth product --> |
| 89 | + <createData entity="_defaultProduct" stepKey="sixthProduct"> |
| 90 | + <field key="price">25</field> |
| 91 | + <field key="quantity">1000</field> |
| 92 | + <requiredEntity createDataKey="category1"/> |
| 93 | + </createData> |
| 94 | + <createData entity="specialProductPriceForSimpleProduct" stepKey="addSpecialPriceForSixthProduct"> |
| 95 | + <requiredEntity createDataKey="sixthProduct"/> |
| 96 | + </createData> |
| 97 | + <!--Create Bundle product --> |
| 98 | + <createData entity="ApiBundleProductPriceViewRange" stepKey="createBundleProduct"> |
| 99 | + <requiredEntity createDataKey="category1"/> |
| 100 | + </createData> |
| 101 | + <!-- Add options to the product --> |
| 102 | + <createData entity="MultipleSelectOption" stepKey="createBundleOption1_1"> |
| 103 | + <requiredEntity createDataKey="createBundleProduct"/> |
| 104 | + <field key="required">false</field> |
| 105 | + </createData> |
| 106 | + <createData entity="DropDownBundleOption" stepKey="createBundleOption1_2"> |
| 107 | + <requiredEntity createDataKey="createBundleProduct"/> |
| 108 | + <field key="required">false</field> |
| 109 | + </createData> |
| 110 | + <!-- add products to checkbox option --> |
| 111 | + <createData entity="ApiBundleLink" stepKey="linkOptionToFifthProduct"> |
| 112 | + <requiredEntity createDataKey="createBundleProduct"/> |
| 113 | + <requiredEntity createDataKey="createBundleOption1_2"/> |
| 114 | + <requiredEntity createDataKey="fifthProduct"/> |
| 115 | + <field key="qty">1</field> |
| 116 | + </createData> |
| 117 | + <createData entity="ApiBundleLink" stepKey="linkOptionToFourthProduct"> |
| 118 | + <requiredEntity createDataKey="createBundleProduct"/> |
| 119 | + <requiredEntity createDataKey="createBundleOption1_2"/> |
| 120 | + <requiredEntity createDataKey="fourthProduct"/> |
| 121 | + <field key="qty">3</field> |
| 122 | + </createData> |
| 123 | + <createData entity="ApiBundleLink" stepKey="linkOptionToSixthProduct"> |
| 124 | + <requiredEntity createDataKey="createBundleProduct"/> |
| 125 | + <requiredEntity createDataKey="createBundleOption1_2"/> |
| 126 | + <requiredEntity createDataKey="sixthProduct"/> |
| 127 | + <field key="qty">1</field> |
| 128 | + </createData> |
| 129 | + <!-- add products to multiselect option --> |
| 130 | + <createData entity="ApiBundleLink" stepKey="linkOptionToSecondProduct"> |
| 131 | + <requiredEntity createDataKey="createBundleProduct"/> |
| 132 | + <requiredEntity createDataKey="createBundleOption1_1"/> |
| 133 | + <requiredEntity createDataKey="secondProduct"/> |
| 134 | + <field key="qty">3</field> |
| 135 | + </createData> |
| 136 | + <createData entity="ApiBundleLink" stepKey="linkOptionToFirstProduct"> |
| 137 | + <requiredEntity createDataKey="createBundleProduct"/> |
| 138 | + <requiredEntity createDataKey="createBundleOption1_1"/> |
| 139 | + <requiredEntity createDataKey="firstProduct"/> |
| 140 | + <field key="qty">2</field> |
| 141 | + </createData> |
| 142 | + <createData entity="ApiBundleLink" stepKey="linkOptionToThirdProduct"> |
| 143 | + <requiredEntity createDataKey="createBundleProduct"/> |
| 144 | + <requiredEntity createDataKey="createBundleOption1_1"/> |
| 145 | + <requiredEntity createDataKey="thirdProduct"/> |
| 146 | + <field key="qty">1</field> |
| 147 | + </createData> |
| 148 | + <!-- Add advanced pricing to bundle product --> |
| 149 | + <actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="openProductForEdit"> |
| 150 | + <argument name="productId" value="$createBundleProduct.id$"/> |
| 151 | + </actionGroup> |
| 152 | + <actionGroup ref="AdminBundleProductSetAdvancedPricingActionGroup" stepKey="addProductTierPrice"> |
| 153 | + <argument name="quantity" value="1"/> |
| 154 | + <argument name="price" value="Discount"/> |
| 155 | + <argument name="amount" value="75"/> |
| 156 | + <argument name="priceView" value="Price Range"/> |
| 157 | + </actionGroup> |
| 158 | + <!-- Reindex invalidated indices after product attribute has been created/deleted --> |
| 159 | + <actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindexInvalidatedIndices"> |
| 160 | + <argument name="indices" value="catalogsearch_fulltext catalog_category_product catalog_product_price catalogrule_rule"/> |
| 161 | + </actionGroup> |
| 162 | + <actionGroup ref="CliCacheCleanActionGroup" stepKey="cleanCache"> |
| 163 | + <argument name="tags" value="full_page"/> |
| 164 | + </actionGroup> |
| 165 | + </before> |
| 166 | + <after> |
| 167 | + <!-- delete created data --> |
| 168 | + <deleteData createDataKey="firstProduct" stepKey="deleteFirstProduct"/> |
| 169 | + <deleteData createDataKey="secondProduct" stepKey="deleteSecondProduct"/> |
| 170 | + <deleteData createDataKey="thirdProduct" stepKey="deleteThirdProduct"/> |
| 171 | + <deleteData createDataKey="fourthProduct" stepKey="deleteFourthProduct"/> |
| 172 | + <deleteData createDataKey="fifthProduct" stepKey="deleteFifthProduct"/> |
| 173 | + <deleteData createDataKey="sixthProduct" stepKey="deleteSixthProduct"/> |
| 174 | + <deleteData createDataKey="createBundleProduct" stepKey="deleteBundleProduct"/> |
| 175 | + <actionGroup ref="AdminCatalogPriceRuleDeleteAllActionGroup" stepKey="deleteCatalogPriceRules"/> |
| 176 | + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> |
| 177 | + </after> |
| 178 | + <!-- Go to storefront category page --> |
| 179 | + <!-- check product prices on category and product page --> |
| 180 | + <actionGroup ref="StorefrontNavigateCategoryPageActionGroup" stepKey="amOnCategoryPage"> |
| 181 | + <argument name="category" value="$$category1$$"/> |
| 182 | + </actionGroup> |
| 183 | + <waitForText userInput="From $4.69 Regular Price $21.00" selector="{{StorefrontCategoryProductSection.priceFromByProductId($$createBundleProduct.id$$)}}" stepKey="seePriceFromInCategoryBundle"/> |
| 184 | + <waitForText userInput="To $16.44 Regular Price $134.40" selector="{{StorefrontCategoryProductSection.priceToByProductId($$createBundleProduct.id$$)}}" stepKey="seePriceToInCategoryBundle"/> |
| 185 | + <actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openBundleProductPage"> |
| 186 | + <argument name="productUrl" value="$$createBundleProduct.custom_attributes[url_key]$$"/> |
| 187 | + </actionGroup> |
| 188 | + <waitForElement selector="{{StorefrontProductInfoMainSection.priceFrom('From $4.69 Regular Price $21.00')}}" stepKey="seePriceFromBundle"/> |
| 189 | + <waitForElement selector="{{StorefrontProductInfoMainSection.priceTo('To $16.44 Regular Price $134.40')}}" stepKey="seePriceToBundle"/> |
| 190 | + </test> |
| 191 | +</tests> |
0 commit comments