|
| 1 | +<?xml version="1.0" encoding="UTF-8"?> |
| 2 | +<!-- |
| 3 | +/** |
| 4 | + * Copyright 2025 Adobe |
| 5 | + * All Rights Reserved. |
| 6 | + */ |
| 7 | +--> |
| 8 | + |
| 9 | +<tests |
| 10 | + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| 11 | + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> |
| 12 | + <test name="StorefrontApplyTierPriceForFixedBundleProductWithPercentCustomOptionTest"> |
| 13 | + <annotations> |
| 14 | + <features value="Bundle"/> |
| 15 | + <stories value="Apply tier price on fixed bundle with percent custom option"/> |
| 16 | + <title value="Apply tier customer group price for Bundle Fixed Product if custom options with percent price"/> |
| 17 | + <description value="This test case verifies apply tier price for Bundle fixed product if Custom options with percent price."/> |
| 18 | + <severity value="CRITICAL"/> |
| 19 | + <testCaseId value="AC-3885"/> |
| 20 | + <group value="bundle"/> |
| 21 | + </annotations> |
| 22 | + <before> |
| 23 | + <!-- Create category and 2 simple products to use as bundle selections --> |
| 24 | + <createData entity="_defaultCategory" stepKey="createCategory"/> |
| 25 | + <createData entity="_defaultProduct" stepKey="simple1"> |
| 26 | + <requiredEntity createDataKey="createCategory"/> |
| 27 | + </createData> |
| 28 | + <createData entity="_defaultProduct" stepKey="simple2"> |
| 29 | + <requiredEntity createDataKey="createCategory"/> |
| 30 | + </createData> |
| 31 | + <!-- Pre Condition 1: Create fixed bundle product and link items --> |
| 32 | + <createData entity="FixedBundleProduct" stepKey="createBundleProduct"> |
| 33 | + <field key="price">110</field> |
| 34 | + <requiredEntity createDataKey="createCategory"/> |
| 35 | + </createData> |
| 36 | + <!-- Pre Condition 2: Associated product price with two options: +5% and +10% with price type percent --> |
| 37 | + <createData entity="DropDownBundleOption" stepKey="dropDownBundleOption1"> |
| 38 | + <requiredEntity createDataKey="createBundleProduct"/> |
| 39 | + </createData> |
| 40 | + <createData entity="ApiBundleLink" stepKey="linkOptionToFirstProduct"> |
| 41 | + <requiredEntity createDataKey="createBundleProduct"/> |
| 42 | + <requiredEntity createDataKey="dropDownBundleOption1"/> |
| 43 | + <requiredEntity createDataKey="simple1"/> |
| 44 | + <field key="price">5</field> |
| 45 | + <field key="price_type">1</field> |
| 46 | + </createData> |
| 47 | + <createData entity="ApiBundleLink" stepKey="linkOptionToSecondProduct"> |
| 48 | + <requiredEntity createDataKey="createBundleProduct"/> |
| 49 | + <requiredEntity createDataKey="dropDownBundleOption1"/> |
| 50 | + <requiredEntity createDataKey="simple2"/> |
| 51 | + <field key="price">10</field> |
| 52 | + <field key="price_type">1</field> |
| 53 | + </createData> |
| 54 | + <!-- Pre Condition 3: Login and edit bundle product to add tier price 20% for 2 products with price view and custom option --> |
| 55 | + <actionGroup ref="AdminLoginActionGroup" stepKey="adminLogin"/> |
| 56 | + <actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="openProductGrid"/> |
| 57 | + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterByBundleSku"> |
| 58 | + <argument name="product" value="$$createBundleProduct$$"/> |
| 59 | + </actionGroup> |
| 60 | + <actionGroup ref="OpenProductForEditByClickingRowXColumnYInProductGridActionGroup" stepKey="openBundleForEdit"/> |
| 61 | + <actionGroup ref="AdminBundleProductSetAdvancedPricingActionGroup" stepKey="addProductTierPrice"> |
| 62 | + <argument name="quantity" value="2"/> |
| 63 | + <argument name="price" value="Discount"/> |
| 64 | + <argument name="amount" value="20"/> |
| 65 | + <argument name="priceView" value="Price Range"/> |
| 66 | + </actionGroup> |
| 67 | + <!-- Pre Condition 4: Add custom option text field named '30 bucks', type is percent, price is 30 --> |
| 68 | + <actionGroup ref="AdminCustomizableOptionWithOneOptionActionGroup" stepKey="addCustomOptionField"/> |
| 69 | + <waitForElementVisible selector="{{AdminProductFormBundleSection.customOptionXTitle}}" stepKey="waitToSetCustomOptionTitle"/> |
| 70 | + <fillField selector="{{AdminProductFormBundleSection.customOptionXTitle}}" userInput="30 bucks" stepKey="setCustomOptionTitle"/> |
| 71 | + <!-- Ensure Customizable Option is set required yes --> |
| 72 | + <waitForElementClickable selector="{{AdminProductFormBundleSection.uncheckRequired}}" stepKey="waitForToggleRequiredOn"/> |
| 73 | + <click selector="{{AdminProductFormBundleSection.uncheckRequired}}" stepKey="toggleRequiredOn"/> |
| 74 | + <!-- Save product --> |
| 75 | + <actionGroup ref="AdminProductFormSaveActionGroup" stepKey="saveBundleProduct"/> |
| 76 | + </before> |
| 77 | + <after> |
| 78 | + <!-- delete products,category and logout from admin --> |
| 79 | + <deleteData createDataKey="simple1" stepKey="deleteSimple1"/> |
| 80 | + <deleteData createDataKey="simple2" stepKey="deleteSimple2"/> |
| 81 | + <deleteData createDataKey="createBundleProduct" stepKey="deleteBundleProduct"/> |
| 82 | + <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> |
| 83 | + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> |
| 84 | + </after> |
| 85 | + <!-- Step 1: Navigate to category page and verify price range from/to --> |
| 86 | + <actionGroup ref="StorefrontNavigateCategoryPageActionGroup" stepKey="goToCategory"> |
| 87 | + <argument name="category" value="$createCategory$"/> |
| 88 | + </actionGroup> |
| 89 | + <waitForText userInput="From $148.50" selector="{{StorefrontCategoryProductSection.priceFromByProductId($$createBundleProduct.id$$)}}" stepKey="seePriceFromInCategoryBundle1"/> |
| 90 | + <waitForText userInput="To $154.00" selector="{{StorefrontCategoryProductSection.priceToByProductId($$createBundleProduct.id$$)}}" stepKey="seePriceToInCategoryBundle1"/> |
| 91 | + <!-- Step 2: Navigate to product page and verify price range from/to --> |
| 92 | + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openProductPageAndVerifyProduct"> |
| 93 | + <argument name="product" value="$$createBundleProduct$$"/> |
| 94 | + </actionGroup> |
| 95 | + <actionGroup ref="AssertStorefrontElementVisibleActionGroup" stepKey="seePriceRangeIsVisible"> |
| 96 | + <argument name="selector" value="{{StorefrontProductInfoMainSection.priceFrom}}"/> |
| 97 | + <argument name="userInput" value="$148.50"/> |
| 98 | + </actionGroup> |
| 99 | + <actionGroup ref="AssertStorefrontElementVisibleActionGroup" stepKey="seePriceRangeIsVisible1"> |
| 100 | + <argument name="selector" value="{{StorefrontProductInfoMainSection.priceTo}}"/> |
| 101 | + <argument name="userInput" value="To $154.00"/> |
| 102 | + </actionGroup> |
| 103 | + <!-- Step 3: Click 'customize and add to cart' and verify configuration price $110 and tier message --> |
| 104 | + <actionGroup ref="StorefrontSelectCustomizeAndAddToTheCartButtonActionGroup" stepKey="openCustomization"/> |
| 105 | + <waitForText userInput="$110.00" selector="{{StorefrontBundledSection.bundleProductsPrice}}" stepKey="seeConfiguredPrice110"/> |
| 106 | + <waitForText userInput="Buy 2 with 20% discount each" selector="{{StorefrontProductInfoMainSection.tierPriceWithIndex('1')}}" stepKey="seeTierMessage"/> |
| 107 | + <!-- Step 4: Select first dropdown bundle option (+5%), fill custom option 'ok', set qty=2 and add to cart and verify price is configured $237.60--> |
| 108 | + <waitForElementClickable selector="{{StorefrontBundledSection.dropDownOptionOneProducts($$dropDownBundleOption1.title$$)}}" stepKey="waitForDropdown"/> |
| 109 | + <click selector="{{StorefrontBundledSection.dropDownOptionOneProducts($$dropDownBundleOption1.title$$)}}" stepKey="openDropdown"/> |
| 110 | + <selectOption selector="{{StorefrontBundledSection.dropDownOptionOneProducts($$dropDownBundleOption1.title$$)}}" userInput="$$simple1.name$$" stepKey="chooseSimple1Option"/> |
| 111 | + <waitForElementVisible selector="{{StorefrontBundleProductActionSection.customOptionField}}" stepKey="waitToFillCustomOptionValue"/> |
| 112 | + <fillField selector="{{StorefrontBundleProductActionSection.customOptionField}}" userInput="ok" stepKey="fillCustomOptionValue"/> |
| 113 | + <actionGroup ref="StorefrontEnterProductQuantityAndAddToTheCartActionGroup" stepKey="setQtyAndAddToCart"> |
| 114 | + <argument name="quantity" value="2"/> |
| 115 | + </actionGroup> |
| 116 | + <actionGroup ref="StorefrontCartPageOpenActionGroup" stepKey="openCart"/> |
| 117 | + <waitForText selector="{{CheckoutCartSummarySection.subtotal}}" userInput="$237.60" stepKey="assertCartSubtotal"/> |
| 118 | + </test> |
| 119 | +</tests> |
0 commit comments