Skip to content

Commit 6fbe420

Browse files
committed
ACQE-7288: Applying Catalog Rule Price with Bundle Fixed Product and Custom options with fixed price
- Test automation for bundle production with custom options.
1 parent 7accebf commit 6fbe420

File tree

3 files changed

+117
-0
lines changed

3 files changed

+117
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright 2025 Adobe
5+
* All Rights Reserved.
6+
*/
7+
-->
8+
9+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AdminCustomizableOptionWithFixedPriceActionGroup" extends="AdminCustomizableOptionWithOneOptionActionGroup">
12+
<remove keyForRemoval="clickPriceType"/>
13+
<remove keyForRemoval="selectPercent"/>
14+
</actionGroup>
15+
</actionGroups>

app/code/Magento/Bundle/Test/Mftf/Section/StorefrontCategoryProductSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@
1111
<section name="StorefrontCategoryProductSection">
1212
<element name="priceToByProductId" type="text" selector="div[data-product-id='{{id}}'] .price-to" parameterized="true"/>
1313
<element name="priceFromByProductId" type="text" selector="div[data-product-id='{{id}}'] .price-from" parameterized="true"/>
14+
<element name="priceToByProductSku" type="text" selector="//li[.//form[@data-product-sku='{{sku}}']]//p[contains(@class,'price-to')]" parameterized="true"/>
1415
</section>
1516
</sections>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<!--
4+
/**
5+
* Copyright 2025 Adobe
6+
* All Rights Reserved.
7+
*/
8+
-->
9+
10+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
11+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
12+
<test name="StorefrontVerifyCatalogRuleOnFixedBundleProductWithCustomOptionsTest">
13+
<annotations>
14+
<features value="Bundle"/>
15+
<stories value="Catalog Price Rules on Bundle Products"/>
16+
<title value="Apply Catalog Rule to Fixed Bundle Product with Custom Options"/>
17+
<description value="Verify that a catalog price rule is correctly applied to a fixed-price bundle product that includes custom options and tier pricing"/>
18+
<severity value="MAJOR"/>
19+
<testCaseId value="AC-4474"/>
20+
</annotations>
21+
<before>
22+
<!-- Precondition Step: Create Category and Simple Product -->
23+
<createData entity="_defaultCategory" stepKey="createCategory"/>
24+
<createData entity="_defaultProduct" stepKey="simpleProduct">
25+
<requiredEntity createDataKey="createCategory"/>
26+
</createData>
27+
<!-- Login as Admin -->
28+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
29+
<!-- Create Bundle product via Admin -->
30+
<actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="navigateToProductIndex"/>
31+
<actionGroup ref="ResetProductGridToDefaultViewActionGroup" stepKey="resetProductGridColumnsInitial"/>
32+
<actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateProduct">
33+
<argument name="product" value="BundleProduct"/>
34+
</actionGroup>
35+
<actionGroup ref="AdminToggleSwitchDynamicPriceOnProductEditPageActionGroup" stepKey="clickDynamicPriceSwitcher"/>
36+
<fillField selector="{{AdminProductFormBundleSection.priceField}}" userInput="110" stepKey="fillBundlePrice"/>
37+
<searchAndMultiSelectOption selector="{{AdminProductFormSection.categoriesDropdown}}" parameterArray="[$$createCategory.name$$]" stepKey="fillCategory"/>
38+
<actionGroup ref="FillMainBundleProductFormActionGroup" stepKey="fillMainFieldsForBundle"/>
39+
<actionGroup ref="AddBundleOptionWithOneProductActionGroup" stepKey="addBundleOption1">
40+
<argument name="x" value="0"/>
41+
<argument name="n" value="1"/>
42+
<argument name="prodOneSku" value="$simpleProduct.sku$"/>
43+
<argument name="prodTwoSku" value=""/>
44+
<argument name="optionTitle" value="Option1"/>
45+
<argument name="inputType" value="radio"/>
46+
</actionGroup>
47+
<fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYPrice('0', '0')}}" userInput="5" stepKey="fillBundleOption1Price"/>
48+
<selectOption selector="{{AdminProductFormBundleSection.bundlePriceType}}" userInput="Fixed" stepKey="selectPercentPrice"/>
49+
<click selector="{{AdminProductFormBundleSection.isDefault('$$simpleProduct.name$$')}}" stepKey="clickIsDefault"/>
50+
<!-- fill customizable options -->
51+
<actionGroup ref="AdminCustomizableOptionWithFixedPriceActionGroup" stepKey="addCustomOption"/>
52+
<!--Save the product-->
53+
<actionGroup ref="AdminProductFormSaveActionGroup" stepKey="clickSaveButton"/>
54+
<actionGroup ref="AssertMessageInAdminPanelActionGroup" stepKey="messageYouSavedTheProductIsShown">
55+
<argument name="message" value="You saved the product."/>
56+
</actionGroup>
57+
<!-- Begin creating a new catalog price rule -->
58+
<actionGroup ref="AdminOpenNewCatalogPriceRuleFormPageActionGroup" stepKey="openNewCatalogPriceRulePage"/>
59+
<actionGroup ref="AdminCatalogPriceRuleFillMainInfoActionGroup" stepKey="fillMainInfoForCatalogPriceRule">
60+
<argument name="groups" value="'NOT LOGGED IN'"/>
61+
</actionGroup>
62+
<actionGroup ref="AdminFillCatalogRuleConditionActionGroup" stepKey="fillConditionsForCatalogPriceRule">
63+
<argument name="conditionValue" value="$createCategory.id$"/>
64+
</actionGroup>
65+
<actionGroup ref="AdminCatalogPriceRuleFillActionsActionGroup" stepKey="fillActionsForCatalogPriceRule">
66+
<argument name="apply" value="by_percent"/>
67+
<argument name="discountAmount" value="10"/>
68+
</actionGroup>
69+
<!-- Save Catalog rule -->
70+
<actionGroup ref="AdminCatalogPriceRuleSaveAndApplyActionGroup" stepKey="saveAndApplyCatalogPriceRule"/>
71+
</before>
72+
<after>
73+
<!-- Delete bundle product -->
74+
<actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteProduct">
75+
<argument name="product" value="BundleProduct"/>
76+
</actionGroup>
77+
<!-- Delete the catalog price rule -->
78+
<actionGroup ref="AdminCatalogPriceRuleDeleteAllActionGroup" stepKey="deleteAllCatalogRulesAfterTest"/>
79+
<!-- Delete category, simple products -->
80+
<deleteData createDataKey="simpleProduct" stepKey="deleteSimpleProduct"/>
81+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
82+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/>
83+
</after>
84+
<!-- Step 1: Navigate to the category page and verify the bundle product price -->
85+
<actionGroup ref="StorefrontNavigateCategoryPageActionGroup" stepKey="goToStorefrontCategoryPage">
86+
<argument name="category" value="$createCategory$"/>
87+
</actionGroup>
88+
<waitForText selector="{{StorefrontCategoryProductSection.priceToByProductSku(BundleProduct.sku)}}" userInput="$134.00" stepKey="seePriceOnCategoryPage"/>
89+
<!-- Step 2: Navigate to the product page and verify the bundle product price -->
90+
<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="GoToProductPage">
91+
<argument name="productUrl" value="{{BundleProduct.urlKey}}"/>
92+
</actionGroup>
93+
<waitForText selector="{{StorefrontProductInfoMainSection.productPrice}}" userInput="$134.00" stepKey="seePriceOnProductPage"/>
94+
<!-- Step 3: Click the "Customize and Add to Cart" button -->
95+
<click selector="{{StorefrontBundledSection.addToCart}}" stepKey="clickCustomizeAndAddToCart"/>
96+
<!-- Step 4: Enter the word "ok" in the option field, click the "Add to Cart" button, and verify the bundle product price -->
97+
<fillField selector="{{StorefrontBundleProductActionSection.customOptionField}}" userInput="ok" stepKey="fillCustomOption"/>
98+
<click selector="{{StorefrontBundleProductActionSection.addToCartButton}}" stepKey="clickAddToCartButton"/>
99+
<waitForText selector="{{StorefrontProductInfoMainSection.productPrice}}" userInput="$134.00" stepKey="verifyConfiguredPrice"/>
100+
</test>
101+
</tests>

0 commit comments

Comments
 (0)