Skip to content

Commit b672c8b

Browse files
Merge branch 'ACQE-8577' into ACQE-functional-deployment-version22
2 parents 6dbacf5 + 9425570 commit b672c8b

File tree

5 files changed

+304
-3
lines changed

5 files changed

+304
-3
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,218 @@
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="StorefrontValidatePriceChangesForConfigurableProductWithMultipleAttributesInWidgetTest">
12+
<annotations>
13+
<features value="Catalog"/>
14+
<stories value="Product Price Display"/>
15+
<title value="Validate price changes for configurable product with dropdown and text swatch attributes on storefront"/>
16+
<description value="Verify configurable product price updates correctly when selecting different attribute options including products displayed in widgets"/>
17+
<testCaseId value="AC-8423"/>
18+
<severity value="MAJOR"/>
19+
<group value="Catalog"/>
20+
</annotations>
21+
<before>
22+
<!-- Step-1: Login to admin -->
23+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
24+
<!-- Create category for products -->
25+
<createData entity="_defaultCategory" stepKey="createCategory"/>
26+
<!-- Step-2: Create a dropdown product attribute -->
27+
<createData entity="productDropDownAttribute" stepKey="createDropdownAttribute">
28+
<field key="attribute_code">my_size</field>
29+
<field key="default_frontend_label">my size</field>
30+
</createData>
31+
<createData entity="productAttributeOption" stepKey="createAttributeOptionSmall">
32+
<requiredEntity createDataKey="createDropdownAttribute"/>
33+
<field key="label">Small</field>
34+
</createData>
35+
<createData entity="productAttributeOption" stepKey="createAttributeOptionMedium">
36+
<requiredEntity createDataKey="createDropdownAttribute"/>
37+
<field key="label">Medium</field>
38+
</createData>
39+
<createData entity="productAttributeOption" stepKey="createAttributeOptionLarge">
40+
<requiredEntity createDataKey="createDropdownAttribute"/>
41+
<field key="label">Large</field>
42+
</createData>
43+
<!-- Step-3: Create a text swatch product attribute -->
44+
<createData entity="productDropDownAttribute" stepKey="createTextSwatchAttribute">
45+
<field key="attribute_code">color_swatch</field>
46+
<field key="default_frontend_label">color1</field>
47+
<field key="frontend_input">swatch_text</field>
48+
</createData>
49+
<createData entity="productAttributeOption" stepKey="createAttributeOptionBlack">
50+
<requiredEntity createDataKey="createTextSwatchAttribute"/>
51+
<field key="label">Black</field>
52+
</createData>
53+
<createData entity="productAttributeOption" stepKey="createAttributeOptionWhite">
54+
<requiredEntity createDataKey="createTextSwatchAttribute"/>
55+
<field key="label">White</field>
56+
</createData>
57+
<createData entity="productAttributeOption" stepKey="createAttributeOptionBlue">
58+
<requiredEntity createDataKey="createTextSwatchAttribute"/>
59+
<field key="label">Blue</field>
60+
</createData>
61+
<!-- Create configurable products -->
62+
<createData entity="ApiConfigurableProduct" stepKey="createConfigProduct1">
63+
<requiredEntity createDataKey="createCategory"/>
64+
<field key="name">Conf 1</field>
65+
<field key="sku">conf-1</field>
66+
<field key="price">100</field>
67+
</createData>
68+
<createData entity="ApiConfigurableProduct" stepKey="createConfigProduct2">
69+
<requiredEntity createDataKey="createCategory"/>
70+
<field key="name">Conf 2</field>
71+
<field key="sku">conf-2</field>
72+
<field key="price">200</field>
73+
</createData>
74+
</before>
75+
<after>
76+
<!-- Delete category -->
77+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
78+
<!-- Delete configurable product & its variants via API using ProductApiHelper -->
79+
<helper class="Magento\Catalog\Test\Mftf\Helper\ProductApiHelper" method="deleteAllProductsApi" stepKey="deleteAllProductsViaApi"/>
80+
<!-- Delete widget -->
81+
<actionGroup ref="AdminDeleteWidgetActionGroup" stepKey="deleteWidget">
82+
<argument name="widget" value="SampleCatalogProductsListWidget"/>
83+
</actionGroup>
84+
<!-- Delete dropdown attribute -->
85+
<deleteData createDataKey="createDropdownAttribute" stepKey="deleteDropdownAttribute"/>
86+
<!-- Delete text swatch attribute -->
87+
<deleteData createDataKey="createTextSwatchAttribute" stepKey="deleteSwatchAttribute"/>
88+
<!-- Logout -->
89+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
90+
</after>
91+
<!-- Step-4: Open Conf 1 and add configurations with my_size attribute -->
92+
<actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="openConfigProduct1">
93+
<argument name="productId" value="$createConfigProduct1.id$"/>
94+
</actionGroup>
95+
<waitForPageLoad stepKey="waitForConfigProduct1PageLoad"/>
96+
<!-- Create configurations for Conf 1 with my_size attribute -->
97+
<actionGroup ref="GenerateConfigurationsByAttributeCodeActionGroup" stepKey="createConfigurationsForConf1">
98+
<argument name="attributeCode" value="$createDropdownAttribute.attribute_code$"/>
99+
</actionGroup>
100+
<!-- Set custom prices for Small and Large variants -->
101+
<actionGroup ref="ChangeConfigurableProductChildProductPriceActionGroup" stepKey="changePriceForSmall">
102+
<argument name="productAttributes" value="my size: Small"/>
103+
<argument name="productPrice" value="110"/>
104+
</actionGroup>
105+
<actionGroup ref="ChangeConfigurableProductChildProductPriceActionGroup" stepKey="changePriceForLarge">
106+
<argument name="productAttributes" value="my size: Large"/>
107+
<argument name="productPrice" value="130"/>
108+
</actionGroup>
109+
<actionGroup ref="SaveConfigurableProductAddToCurrentAttributeSetActionGroup" stepKey="saveConfigProduct1"/>
110+
<!-- Step-5: Open Conf 2 and add configurations with both attributes (color_swatch and my_size) -->
111+
<actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="openConfigProduct2">
112+
<argument name="productId" value="$createConfigProduct2.id$"/>
113+
</actionGroup>
114+
<waitForPageLoad stepKey="waitForConfigProduct2PageLoad"/>
115+
<!-- Create configurations for Conf 2 with both attributes -->
116+
<waitForElementClickable selector="{{AdminProductFormConfigurationsSection.createConfigurations}}" stepKey="waitForCreateConfigurationsClickableForConf2"/>
117+
<click selector="{{AdminProductFormConfigurationsSection.createConfigurations}}" stepKey="clickCreateConfigurationsForConf2"/>
118+
<waitForElementVisible selector="{{AdminCreateProductConfigurationsPanel.createNewAttribute}}" stepKey="waitForConfigurationModalOpen"/>
119+
<!-- Select both my_size and color_swatch attributes -->
120+
<click selector="{{AdminCreateProductConfigurationsPanel.attributeCheckbox($createDropdownAttribute.attribute_code$)}}" stepKey="selectSizeAttribute"/>
121+
<click selector="{{AdminCreateProductConfigurationsPanel.attributeCheckbox($createTextSwatchAttribute.attribute_code$)}}" stepKey="selectColorAttribute"/>
122+
<click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton1ForConf2"/>
123+
<!-- Select only Small and Large for my_size, and Black and White for color_swatch -->
124+
<waitForElementVisible selector="{{AdminCreateProductConfigurationsPanel.attributeCheckboxByName('Small')}}" stepKey="waitForOptionsForConf2"/>
125+
<click selector="{{AdminCreateProductConfigurationsPanel.attributeCheckboxByName('Small')}}" stepKey="selectSmallOptionForConf2"/>
126+
<click selector="{{AdminCreateProductConfigurationsPanel.attributeCheckboxByName('Large')}}" stepKey="selectLargeOptionForConf2"/>
127+
<click selector="{{AdminCreateProductConfigurationsPanel.attributeCheckboxByName('Black')}}" stepKey="selectBlackOptionForConf2"/>
128+
<click selector="{{AdminCreateProductConfigurationsPanel.attributeCheckboxByName('White')}}" stepKey="selectWhiteOptionForConf2"/>
129+
<click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton2ForConf2"/>
130+
<!-- Apply single quantity to all SKUs -->
131+
<waitForElementVisible selector="{{AdminCreateProductConfigurationsPanel.applySingleQuantityToEachSkus}}" stepKey="waitForQuantitySection"/>
132+
<click selector="{{AdminCreateProductConfigurationsPanel.applySingleQuantityToEachSkus}}" stepKey="clickSingleQuantity"/>
133+
<fillField selector="{{AdminCreateProductConfigurationsPanel.quantity}}" userInput="100" stepKey="fillQuantity"/>
134+
<click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton3ForConf2"/>
135+
<!-- Generate products -->
136+
<click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton4ForConf2"/>
137+
<waitForElementVisible selector="{{AdminProductFormActionSection.saveButton}}" stepKey="waitForSaveButtonForConf2"/>
138+
<!-- Set custom prices for all variants -->
139+
<actionGroup ref="ChangeConfigurableProductChildProductPriceActionGroup" stepKey="changePriceForBlackSmall">
140+
<argument name="productAttributes" value="my size: Small, color1: Black"/>
141+
<argument name="productPrice" value="210"/>
142+
</actionGroup>
143+
<actionGroup ref="ChangeConfigurableProductChildProductPriceActionGroup" stepKey="changePriceForBlackLarge">
144+
<argument name="productAttributes" value="my size: Large, color1: Black"/>
145+
<argument name="productPrice" value="230"/>
146+
</actionGroup>
147+
<actionGroup ref="ChangeConfigurableProductChildProductPriceActionGroup" stepKey="changePriceForWhiteSmall">
148+
<argument name="productAttributes" value="my size: Small, color1: White"/>
149+
<argument name="productPrice" value="250"/>
150+
</actionGroup>
151+
<actionGroup ref="ChangeConfigurableProductChildProductPriceActionGroup" stepKey="changePriceForWhiteLarge">
152+
<argument name="productAttributes" value="my size: Large, color1: White"/>
153+
<argument name="productPrice" value="270"/>
154+
</actionGroup>
155+
<actionGroup ref="SaveConfigurableProductAddToCurrentAttributeSetActionGroup" stepKey="saveConfigProduct2"/>
156+
<!-- Step-6: Create Catalog Products List widget to display Conf 2 on configurable product pages -->
157+
<actionGroup ref="AdminConfigureWidgetWithSpecificProductsActionGroup" stepKey="configureWidget">
158+
<argument name="productId" value="$createConfigProduct1.id$"/>
159+
</actionGroup>
160+
<actionGroup ref="AdminSaveAndContinueWidgetActionGroup" stepKey="saveWidget"/>
161+
<!-- Step-7: Open Conf 1 product page on storefront and validate price changes -->
162+
<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openConf1ProductPage">
163+
<argument name="productUrl" value="conf-1"/>
164+
</actionGroup>
165+
<waitForElementVisible selector="{{StorefrontProductInfoMainSection.productName}}" stepKey="waitForProductName"/>
166+
<waitForText selector="{{StorefrontProductInfoMainSection.productName}}" userInput="Conf 1" stepKey="verifyProductName"/>
167+
<!-- Verify default price before selection -->
168+
<waitForElementVisible selector="{{StorefrontProductInfoMainSection.productPrice}}" stepKey="waitForDefaultPrice"/>
169+
<!-- Select Small option and verify price -->
170+
<waitForElementVisible selector="{{StorefrontProductInfoMainSection.productAttributeOptionsSelectButton}}" stepKey="waitForAttributeDropdown"/>
171+
<selectOption selector="{{StorefrontProductInfoMainSection.productAttributeOptionsSelectButton}}" userInput="Small" stepKey="selectSmallOption"/>
172+
<waitForElementVisible selector="{{StorefrontProductInfoMainSection.productPrice}}" stepKey="waitForPriceAfterSmallSelection"/>
173+
<waitForText selector="{{StorefrontProductInfoMainSection.productPrice}}" userInput="$110.00" stepKey="verifySmallPrice"/>
174+
<!-- Select Large option and verify price changes -->
175+
<selectOption selector="{{StorefrontProductInfoMainSection.productAttributeOptionsSelectButton}}" userInput="Large" stepKey="selectLargeOption"/>
176+
<waitForElementVisible selector="{{StorefrontProductInfoMainSection.productPrice}}" stepKey="waitForPriceAfterLargeSelection"/>
177+
<waitForText selector="{{StorefrontProductInfoMainSection.productPrice}}" userInput="$130.00" stepKey="verifyLargePrice"/>
178+
<!-- Select Small again and verify price changes back -->
179+
<selectOption selector="{{StorefrontProductInfoMainSection.productAttributeOptionsSelectButton}}" userInput="Small" stepKey="selectSmallOptionAgain"/>
180+
<waitForElementVisible selector="{{StorefrontProductInfoMainSection.productPrice}}" stepKey="waitForPriceAfterSmallSelectionAgain"/>
181+
<waitForText selector="{{StorefrontProductInfoMainSection.productPrice}}" userInput="$110.00" stepKey="verifySmallPriceAgain"/>
182+
<!-- Verify Conf 2 is displayed in widget on Conf 1 product page and validate price changes -->
183+
<scrollTo selector="{{StorefrontCategoryProductSection.widgetProduct('Conf 2')}}" stepKey="scrollToWidgetProduct"/>
184+
<waitForElementVisible selector="{{StorefrontCategoryProductSection.widgetProduct('Conf 2')}}" stepKey="verifyConf2DisplayedInWidget"/>
185+
<!-- Click on Conf 2 from widget to navigate to its product page -->
186+
<click selector="{{StorefrontCategoryProductSection.widgetProduct('Conf 2')}}" stepKey="clickConf2FromWidget"/>
187+
<waitForPageLoad stepKey="waitForConf2PageLoad"/>
188+
<waitForElementVisible selector="{{StorefrontProductInfoMainSection.productName}}" stepKey="waitForConf2ProductName"/>
189+
<waitForText selector="{{StorefrontProductInfoMainSection.productName}}" userInput="Conf 2" stepKey="verifyConf2ProductName"/>
190+
<!-- Verify price changes for Conf 2 with multiple attribute combinations -->
191+
<!-- Select Black color swatch -->
192+
<waitForElementVisible selector="{{StorefrontProductInfoMainSection.swatchOptionByLabel('Black')}}" stepKey="waitForBlackSwatch"/>
193+
<click selector="{{StorefrontProductInfoMainSection.swatchOptionByLabel('Black')}}" stepKey="selectBlackSwatch"/>
194+
<waitForPageLoad stepKey="waitAfterBlackSelection"/>
195+
<!-- Select Small size with Black color and verify price -->
196+
<waitForElementVisible selector="{{StorefrontProductInfoMainSection.attributeSelectByAttributeID('my size')}}" stepKey="waitForSizeDropdownForBlack"/>
197+
<selectOption selector="{{StorefrontProductInfoMainSection.attributeSelectByAttributeID('my size')}}" userInput="Small" stepKey="selectSmallForBlack"/>
198+
<waitForElementVisible selector="{{StorefrontProductInfoMainSection.productPrice}}" stepKey="waitForPriceBlackSmall"/>
199+
<waitForText selector="{{StorefrontProductInfoMainSection.productPrice}}" userInput="$210.00" stepKey="verifyBlackSmallPrice"/>
200+
<!-- Select Large size with Black color and verify price -->
201+
<selectOption selector="{{StorefrontProductInfoMainSection.attributeSelectByAttributeID('my size')}}" userInput="Large" stepKey="selectLargeForBlack"/>
202+
<waitForElementVisible selector="{{StorefrontProductInfoMainSection.productPrice}}" stepKey="waitForPriceBlackLarge"/>
203+
<waitForText selector="{{StorefrontProductInfoMainSection.productPrice}}" userInput="$230.00" stepKey="verifyBlackLargePrice"/>
204+
<!-- Select White color swatch -->
205+
<waitForElementVisible selector="{{StorefrontProductInfoMainSection.swatchOptionByLabel('White')}}" stepKey="waitForWhiteSwatch"/>
206+
<click selector="{{StorefrontProductInfoMainSection.swatchOptionByLabel('White')}}" stepKey="selectWhiteSwatch"/>
207+
<waitForPageLoad stepKey="waitAfterWhiteSelection"/>
208+
<!-- Select Small size with White color and verify price -->
209+
<waitForElementVisible selector="{{StorefrontProductInfoMainSection.attributeSelectByAttributeID('my size')}}" stepKey="waitForSizeDropdownForWhite"/>
210+
<selectOption selector="{{StorefrontProductInfoMainSection.attributeSelectByAttributeID('my size')}}" userInput="Small" stepKey="selectSmallForWhite"/>
211+
<waitForElementVisible selector="{{StorefrontProductInfoMainSection.productPrice}}" stepKey="waitForPriceWhiteSmall"/>
212+
<waitForText selector="{{StorefrontProductInfoMainSection.productPrice}}" userInput="$250.00" stepKey="verifyWhiteSmallPrice"/>
213+
<!-- Select Large size with White color and verify price -->
214+
<selectOption selector="{{StorefrontProductInfoMainSection.attributeSelectByAttributeID('my size')}}" userInput="Large" stepKey="selectLargeForWhite"/>
215+
<waitForElementVisible selector="{{StorefrontProductInfoMainSection.productPrice}}" stepKey="waitForPriceWhiteLarge"/>
216+
<waitForText selector="{{StorefrontProductInfoMainSection.productPrice}}" userInput="$270.00" stepKey="verifyWhiteLargePrice"/>
217+
</test>
218+
</tests>

app/code/Magento/Catalog/Test/Mftf/test-dependency-allowlist

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,6 @@ AdminSetQuantityToEachSkusConfigurableProductActionGroup
4343
SelectStorefrontSideBarAttributeOption
4444
AdminAddProductVideoWithPreviewActionGroup
4545
AdminSetBaseCurrencyActionGroup
46-
AdminSetDefaultCurrencyActionGroup
46+
AdminSetDefaultCurrencyActionGroup
47+
ChangeConfigurableProductChildProductPriceActionGroup
48+
SaveConfigurableProductAddToCurrentAttributeSetActionGroup

0 commit comments

Comments
 (0)