|
| 1 | +<?xml version="1.0" encoding="UTF-8"?> |
| 2 | +<!-- |
| 3 | + /** |
| 4 | + * Copyright 2025 Adobe |
| 5 | + * All Rights Reserved. |
| 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="StorefrontCheckPriceForFixedBundleProductWithCatalogRuleTest"> |
| 12 | + <annotations> |
| 13 | + <features value="Bundle"/> |
| 14 | + <stories value="View bundle product price"/> |
| 15 | + <title value="Check prices for bundle product with catalog rule"/> |
| 16 | + <description value="To Verify Catalog Rules Prices for Fixed Bundle Product on Storefront"/> |
| 17 | + <testCaseId value="AC-3973"/> |
| 18 | + <severity value="MAJOR"/> |
| 19 | + </annotations> |
| 20 | + <before> |
| 21 | + <!-- Precondition step1,2: create category, catalog rule price with data and apply to products --> |
| 22 | + <createData entity="_defaultCategory" stepKey="category1"/> |
| 23 | + <!-- login to backend --> |
| 24 | + <actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/> |
| 25 | + <actionGroup ref="AdminCatalogPriceRuleDeleteAllActionGroup" stepKey="clearExistingCatalogPriceRules"/> |
| 26 | + <actionGroup ref="AdminOpenNewCatalogPriceRuleFormPageActionGroup" stepKey="openNewCatalogPriceRulePage"/> |
| 27 | + <actionGroup ref="AdminCatalogPriceRuleFillMainInfoActionGroup" stepKey="fillMainInfoForCatalogPriceRule"/> |
| 28 | + <actionGroup ref="AdminFillCatalogRuleConditionActionGroup" stepKey="fillConditionsForCatalogPriceRule"> |
| 29 | + <argument name="conditionValue" value="$category1.id$"/> |
| 30 | + </actionGroup> |
| 31 | + <actionGroup ref="AdminCatalogPriceRuleFillActionsActionGroup" stepKey="fillActionsForCatalogPriceRule"> |
| 32 | + <argument name="apply" value="by_percent"/> |
| 33 | + <argument name="discountAmount" value="10"/> |
| 34 | + </actionGroup> |
| 35 | + <actionGroup ref="AdminCatalogPriceRuleSaveAndApplyActionGroup" stepKey="saveAndApplyFirstPriceRule"/> |
| 36 | + <!-- Precondition step3: create 6 simple products --> |
| 37 | + <!-- Precondition step3.1: create first product --> |
| 38 | + <createData entity="_defaultProduct" stepKey="firstProduct"> |
| 39 | + <field key="price">10.25</field> |
| 40 | + <field key="quantity">100</field> |
| 41 | + <requiredEntity createDataKey="category1"/> |
| 42 | + </createData> |
| 43 | + <!-- Precondition step3.2: create second product --> |
| 44 | + <createData entity="_defaultProduct" stepKey="secondProduct"> |
| 45 | + <field key="price">15.50</field> |
| 46 | + <field key="status">0</field> |
| 47 | + <field key="quantity">100</field> |
| 48 | + <requiredEntity createDataKey="category1"/> |
| 49 | + </createData> |
| 50 | + <!-- Precondition step3.3: create third product --> |
| 51 | + <createData entity="_defaultProduct" stepKey="thirdProduct"> |
| 52 | + <field key="price">20.75</field> |
| 53 | + <field key="quantity">100</field> |
| 54 | + <requiredEntity createDataKey="category1"/> |
| 55 | + </createData> |
| 56 | + <!-- Precondition step3.4: create fourth product --> |
| 57 | + <createData entity="_defaultProduct" stepKey="fourthProduct"> |
| 58 | + <field key="price">25.15</field> |
| 59 | + <field key="quantity">100</field> |
| 60 | + <requiredEntity createDataKey="category1"/> |
| 61 | + </createData> |
| 62 | + <!-- Precondition step3.5: create fifth product --> |
| 63 | + <createData entity="_defaultProduct" stepKey="fifthProduct"> |
| 64 | + <field key="price">30.45</field> |
| 65 | + <field key="status">0</field> |
| 66 | + <field key="quantity">100</field> |
| 67 | + <requiredEntity createDataKey="category1"/> |
| 68 | + </createData> |
| 69 | + <!-- Precondition step3.6: create sixth product --> |
| 70 | + <createData entity="_defaultProduct" stepKey="sixthProduct"> |
| 71 | + <field key="price">35.65</field> |
| 72 | + <field key="quantity">100</field> |
| 73 | + <requiredEntity createDataKey="category1"/> |
| 74 | + </createData> |
| 75 | + <!-- Precondition step4: Create Bundle product --> |
| 76 | + <createData entity="FixedBundleProduct" stepKey="createFixedBundleProduct"> |
| 77 | + <requiredEntity createDataKey="category1"/> |
| 78 | + <field key="price">110.25</field> |
| 79 | + </createData> |
| 80 | + <!-- Precondition step4.6: Add options to the product --> |
| 81 | + <createData entity="MultipleSelectOption" stepKey="createBundleOption1_1"> |
| 82 | + <requiredEntity createDataKey="createFixedBundleProduct"/> |
| 83 | + <field key="required">true</field> |
| 84 | + </createData> |
| 85 | + <createData entity="DropDownBundleOption" stepKey="createBundleOption1_2"> |
| 86 | + <requiredEntity createDataKey="createFixedBundleProduct"/> |
| 87 | + <field key="required">false</field> |
| 88 | + </createData> |
| 89 | + <!-- Precondition step4.6.1: add products to multiselect option --> |
| 90 | + <createData entity="ApiBundleLinkFixed" stepKey="linkOptionToFirstProduct"> |
| 91 | + <requiredEntity createDataKey="createFixedBundleProduct"/> |
| 92 | + <requiredEntity createDataKey="createBundleOption1_1"/> |
| 93 | + <requiredEntity createDataKey="firstProduct"/> |
| 94 | + <field key="qty">2</field> |
| 95 | + <field key="price">25.15</field> |
| 96 | + </createData> |
| 97 | + <createData entity="ApiBundleLinkFixed" stepKey="linkOptionToSecondProduct"> |
| 98 | + <requiredEntity createDataKey="createFixedBundleProduct"/> |
| 99 | + <requiredEntity createDataKey="createBundleOption1_1"/> |
| 100 | + <requiredEntity createDataKey="secondProduct"/> |
| 101 | + <field key="qty">5</field> |
| 102 | + <field key="price">5</field> |
| 103 | + <field key="price_type">1</field> |
| 104 | + </createData> |
| 105 | + <createData entity="ApiBundleLinkFixed" stepKey="linkOptionToThirdProduct"> |
| 106 | + <requiredEntity createDataKey="createFixedBundleProduct"/> |
| 107 | + <requiredEntity createDataKey="createBundleOption1_1"/> |
| 108 | + <requiredEntity createDataKey="thirdProduct"/> |
| 109 | + <field key="qty">2</field> |
| 110 | + <field key="price">30</field> |
| 111 | + <field key="price_type">1</field> |
| 112 | + </createData> |
| 113 | + <!-- Precondition step4.6.2: add products to single select option --> |
| 114 | + <createData entity="ApiBundleLinkFixed" stepKey="linkOptionToFourthProduct"> |
| 115 | + <requiredEntity createDataKey="createFixedBundleProduct"/> |
| 116 | + <requiredEntity createDataKey="createBundleOption1_2"/> |
| 117 | + <requiredEntity createDataKey="fourthProduct"/> |
| 118 | + <field key="qty">2</field> |
| 119 | + <field key="price">10</field> |
| 120 | + <field key="price_type">1</field> |
| 121 | + </createData> |
| 122 | + <createData entity="ApiBundleLinkFixed" stepKey="linkOptionToFifthProduct"> |
| 123 | + <requiredEntity createDataKey="createFixedBundleProduct"/> |
| 124 | + <requiredEntity createDataKey="createBundleOption1_2"/> |
| 125 | + <requiredEntity createDataKey="fifthProduct"/> |
| 126 | + <field key="qty">5</field> |
| 127 | + <field key="price">20.55</field> |
| 128 | + </createData> |
| 129 | + <createData entity="ApiBundleLinkFixed" stepKey="linkOptionToSixthProduct"> |
| 130 | + <requiredEntity createDataKey="createFixedBundleProduct"/> |
| 131 | + <requiredEntity createDataKey="createBundleOption1_2"/> |
| 132 | + <requiredEntity createDataKey="sixthProduct"/> |
| 133 | + <field key="qty">1</field> |
| 134 | + <field key="price">45</field> |
| 135 | + <field key="price_type">1</field> |
| 136 | + </createData> |
| 137 | + </before> |
| 138 | + <after> |
| 139 | + <!-- delete created product data --> |
| 140 | + <deleteData createDataKey="firstProduct" stepKey="deleteFirstProduct"/> |
| 141 | + <deleteData createDataKey="secondProduct" stepKey="deleteSecondProduct"/> |
| 142 | + <deleteData createDataKey="thirdProduct" stepKey="deleteThirdProduct"/> |
| 143 | + <deleteData createDataKey="fourthProduct" stepKey="deleteFourthProduct"/> |
| 144 | + <deleteData createDataKey="fifthProduct" stepKey="deleteFifthProduct"/> |
| 145 | + <deleteData createDataKey="sixthProduct" stepKey="deleteSixthProduct"/> |
| 146 | + <!-- delete created bundle product and catalog rule --> |
| 147 | + <deleteData createDataKey="createFixedBundleProduct" stepKey="deleteBundleProduct"/> |
| 148 | + <actionGroup ref="AdminCatalogPriceRuleDeleteAllActionGroup" stepKey="deleteCatalogPriceRules"/> |
| 149 | + <!-- logout admin --> |
| 150 | + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> |
| 151 | + </after> |
| 152 | + <!-- check product prices on category and product page --> |
| 153 | + <!-- step1: Go to storefront category page --> |
| 154 | + <actionGroup ref="StorefrontNavigateCategoryPageActionGroup" stepKey="amOnCategoryPage"> |
| 155 | + <argument name="category" value="$$category1$$"/> |
| 156 | + </actionGroup> |
| 157 | + <!-- step2: check price for fixed bundled on category page --> |
| 158 | + <grabTextFrom selector="{{StorefrontCategoryProductSection.priceAsLowAsFinalPriceByProductId($$createFixedBundleProduct.id$$)}}" stepKey="grabProductFinalPriceOnCategory"/> |
| 159 | + <assertEquals message="ExpectedFinalPriceOnCategory" stepKey="assertBundleProductFinalPriceOnCategory"> |
| 160 | + <actualResult type="variable">grabProductFinalPriceOnCategory</actualResult> |
| 161 | + <expectedResult type="string">$149.53</expectedResult> |
| 162 | + </assertEquals> |
| 163 | + <grabTextFrom selector="{{StorefrontCategoryProductSection.oldPriceByProductId($$createFixedBundleProduct.id$$)}}" stepKey="grabProductOldPriceOnCategory"/> |
| 164 | + <assertEquals message="ExpectedOldPriceOnCategory" stepKey="assertBundleProductOldPriceOnCategory"> |
| 165 | + <actualResult type="variable">grabProductOldPriceOnCategory</actualResult> |
| 166 | + <expectedResult type="string">Regular Price $160.55</expectedResult> |
| 167 | + </assertEquals> |
| 168 | + <grabTextFrom selector="{{StorefrontCategoryProductSection.priceAsLowAsLabelByProductId($$createFixedBundleProduct.id$$)}}" stepKey="grabProductFinalPriceLabelOnCategory"/> |
| 169 | + <assertEquals message="ExpectedFinalPriceLabelOnCategory" stepKey="assertBundleProductFinalPriceLabelOnCategory"> |
| 170 | + <actualResult type="variable">grabProductFinalPriceLabelOnCategory</actualResult> |
| 171 | + <expectedResult type="string">As low as</expectedResult> |
| 172 | + </assertEquals> |
| 173 | + <!-- step3: Go to fixed bundled product page --> |
| 174 | + <actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openBundleProductPage"> |
| 175 | + <argument name="productUrl" value="$$createFixedBundleProduct.custom_attributes[url_key]$$"/> |
| 176 | + </actionGroup> |
| 177 | + <!-- step4: check price for fixed Bundle on product page --> |
| 178 | + <grabTextFrom selector="{{StorefrontProductInfoMainSection.oldPrice}}" stepKey="grabProductOldPrice"/> |
| 179 | + <assertEquals message="ExpectedOldPrice" stepKey="assertBundleProductOldPrice"> |
| 180 | + <actualResult type="variable">grabProductOldPrice</actualResult> |
| 181 | + <expectedResult type="string">Regular Price $160.55</expectedResult> |
| 182 | + </assertEquals> |
| 183 | + <grabTextFrom selector="{{StorefrontProductInfoMainSection.asLowAsFinalPrice}}" stepKey="grabProductFinalPrice"/> |
| 184 | + <assertEquals message="ExpectedFinalPrice" stepKey="assertBundleProductPrice"> |
| 185 | + <actualResult type="variable">grabProductFinalPrice</actualResult> |
| 186 | + <expectedResult type="string">$149.53</expectedResult> |
| 187 | + </assertEquals> |
| 188 | + <grabTextFrom selector="{{StorefrontProductInfoMainSection.asLowAsFinalPriceLabel}}" stepKey="grabProductPriceLabel"/> |
| 189 | + <assertEquals message="ExpectedPriceLabel" stepKey="assertProductPriceLabel"> |
| 190 | + <actualResult type="variable">grabProductPriceLabel</actualResult> |
| 191 | + <expectedResult type="string">As low as</expectedResult> |
| 192 | + </assertEquals> |
| 193 | + </test> |
| 194 | +</tests> |
0 commit comments