Skip to content

Commit cbd352d

Browse files
ACQE-8163: Configurable product swatches appears as available but are out of stock
- Created action group to fill attribute fields and generate variations for two attributes
1 parent ebd6774 commit cbd352d

File tree

3 files changed

+270
-0
lines changed

3 files changed

+270
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* ADOBE CONFIDENTIAL
5+
*
6+
* Copyright 2025 Adobe
7+
* All Rights Reserved.
8+
*
9+
* NOTICE: All information contained herein is, and remains
10+
* the property of Adobe and its suppliers, if any. The intellectual
11+
* and technical concepts contained herein are proprietary to Adobe
12+
* and its suppliers and are protected by all applicable intellectual
13+
* property laws, including trade secret and copyright laws.
14+
* Dissemination of this information or reproduction of this material
15+
* is strictly forbidden unless prior written permission is obtained
16+
* from Adobe.
17+
*/
18+
-->
19+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
20+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
21+
<actionGroup name="AdminSelectAllValueOfTwoAttributesPageActionGroup">
22+
<annotations>
23+
<description>Selects values of each attribute to include in the product.</description>
24+
</annotations>
25+
<arguments>
26+
<argument name="attributeLabel1" type="string" defaultValue="{{colorProductAttribute.default_label}}"/>
27+
<argument name="attributeLabel2" type="string" defaultValue="{{sizeAttribute.default_label}}"/>
28+
</arguments>
29+
<click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickNextToSelectOptions"/>
30+
<click selector="{{AdminCreateProductConfigurationsPanel.selectAllByAttribute(attributeLabel1)}}" stepKey="selectAllSwatchAttributeOptions"/>
31+
<click selector="{{AdminCreateProductConfigurationsPanel.selectAllByAttribute(attributeLabel2)}}" stepKey="selectAllSwatchAttributeOptions1"/>
32+
<click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickNextToApplyQuantity"/>
33+
<click selector="{{AdminCreateProductConfigurationsPanel.applySingleQuantityToEachSkus}}" stepKey="clickOnApplySingleQuantityToEachSku"/>
34+
<fillField selector="{{AdminCreateProductConfigurationsPanel.quantity}}" userInput="100" stepKey="enterAttributeQuantity"/>
35+
<click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton3"/>
36+
<click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton4"/>
37+
</actionGroup>
38+
</actionGroups>
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* ADOBE CONFIDENTIAL
5+
*
6+
* Copyright 2025 Adobe
7+
* All Rights Reserved.
8+
*
9+
* NOTICE: All information contained herein is, and remains
10+
* the property of Adobe and its suppliers, if any. The intellectual
11+
* and technical concepts contained herein are proprietary to Adobe
12+
* and its suppliers and are protected by all applicable intellectual
13+
* property laws, including trade secret and copyright laws.
14+
* Dissemination of this information or reproduction of this material
15+
* is strictly forbidden unless prior written permission is obtained
16+
* from Adobe.
17+
*/
18+
-->
19+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
20+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
21+
<actionGroup name="FillProductAttributeFieldsActionGroup">
22+
<annotations>
23+
<description>Fill custom attribute form fields.</description>
24+
</annotations>
25+
<arguments>
26+
<argument name="attributeLabel" type="string" defaultValue="Test Attribute"/>
27+
<argument name="attributeCode" type="string" defaultValue="test_attribute"/>
28+
<argument name="inputType" type="string" defaultValue="Dropdown"/>
29+
<argument name="scope" type="string" defaultValue="Yes"/>
30+
</arguments>
31+
<click selector="{{AdminProductAttributeGridSection.createNewAttributeBtn}}" stepKey="clickAddNewAttributeButton"/>
32+
<fillField selector="{{AttributePropertiesSection.DefaultLabel}}" userInput="{{attributeLabel}}" stepKey="fillAttributeLabel"/>
33+
<selectOption selector="{{AttributePropertiesSection.InputType}}" userInput="{{inputType}}" stepKey="selectDropdown"/>
34+
<scrollTo selector="{{AdvancedAttributePropertiesSection.AdvancedAttributePropertiesSectionToggle}}" stepKey="scrollToSection"/>
35+
<conditionalClick selector="{{AdvancedAttributePropertiesSection.AdvancedAttributePropertiesSectionToggle}}" dependentSelector="{{AdvancedAttributePropertiesSection.AttributeCode}}" visible="false" stepKey="openSection"/>
36+
<waitForElementVisible selector="{{AdvancedAttributePropertiesSection.AttributeCode}}" stepKey="waitForSlideOutSection"/>
37+
<fillField selector="{{AdvancedAttributePropertiesSection.AttributeCode}}" userInput="{{attributeLabel}}" stepKey="fillAttributeCode"/>
38+
<selectOption selector="{{AdvancedAttributePropertiesSection.Scope}}" userInput="{{scope}}" stepKey="selectScope"/>
39+
</actionGroup>
40+
</actionGroups>
Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* ADOBE CONFIDENTIAL
5+
*
6+
* Copyright 2025 Adobe
7+
* All Rights Reserved.
8+
*
9+
* NOTICE: All information contained herein is, and remains
10+
* the property of Adobe and its suppliers, if any. The intellectual
11+
* and technical concepts contained herein are proprietary to Adobe
12+
* and its suppliers and are protected by all applicable intellectual
13+
* property laws, including trade secret and copyright laws.
14+
* Dissemination of this information or reproduction of this material
15+
* is strictly forbidden unless prior written permission is obtained
16+
* from Adobe.
17+
*/
18+
-->
19+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
20+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
21+
<test name="AdminCheckOutOfStockProductSwatchesAppearOnConfigurationUpdateTest">
22+
<annotations>
23+
<features value="ConfigurableProduct"/>
24+
<stories value="Verify out of stock product swatch visibility"/>
25+
<title value="Display Out of Stock Swatch on Configurable Product Page"/>
26+
<description value="Verify Swatch of Configurable Product when display Out of Stock products is enabled"/>
27+
<severity value="MINOR"/>
28+
<testCaseId value="AC-7020"/>
29+
<group value="catalog"/>
30+
</annotations>
31+
<before>
32+
<!-- Pre-condition Step-1 Create Category and Create Configurable product -->
33+
<createData entity="_defaultCategory" stepKey="createCategory"/>
34+
<createData entity="BaseConfigurableProduct" stepKey="createConfigProduct">
35+
<requiredEntity createDataKey="createCategory"/>
36+
</createData>
37+
<!-- Pre-condition Step-2 Set Display out of stock products to yes -->
38+
<magentoCLI command="config:set {{CatalogInventoryOptionsShowOutOfStockEnable.path}} {{CatalogInventoryOptionsShowOutOfStockEnable.value}}" stepKey="setConfigShowOutOfStockTrue"/>
39+
</before>
40+
<after>
41+
<!-- Delete Category -->
42+
<deleteData stepKey="deleteCategory" createDataKey="createCategory" />
43+
<!-- Delete Config Product -->
44+
<deleteData stepKey="deleteConfigProduct" createDataKey="createConfigProduct" />
45+
<actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="navigateToProductIndex"/>
46+
<actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterProduct">
47+
<argument name="product" value="$$createConfigProduct$$"/>
48+
</actionGroup>
49+
<actionGroup ref="AdminDeleteAllProductsFromGridActionGroup" stepKey="selectAndDeleteProducts"/>
50+
<waitForElement selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="deleteMessage"/>
51+
<click selector="{{AdminProductGridFilterSection.clearFilters}}" stepKey="clickClearFiltersAfter"/>
52+
<!-- Delete color attribute -->
53+
<actionGroup ref="DeleteProductAttributeByCodeActionGroup" stepKey="deleteColorAttribute">
54+
<argument name="attribute_code" value="{{colorProductAttribute.default_label}}"/>
55+
</actionGroup>
56+
<!-- Delete size attribute -->
57+
<actionGroup ref="DeleteProductAttributeByCodeActionGroup" stepKey="deleteSizeAttribute">
58+
<argument name="attribute_code" value="{{sizeAttribute.default_label}}"/>
59+
</actionGroup>
60+
<magentoCLI command="config:set {{CatalogInventoryOptionsShowOutOfStockDisable.path}} {{CatalogInventoryOptionsShowOutOfStockDisable.value}}" stepKey="setConfigShowOutOfStockFalse"/>
61+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
62+
</after>
63+
<!-- Step 1 - Admin Login -->
64+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
65+
<!-- Step 2 - Navigate to Stores > Attributes > Products > Product Attribute-->
66+
<actionGroup ref="AdminOpenProductAttributePageActionGroup" stepKey="navigateToProductAttributeGrid" />
67+
<actionGroup ref="FillProductAttributeFieldsActionGroup" stepKey="fillColorAttributeFields">
68+
<argument name="attributeLabel" value="{{colorProductAttribute.default_label}}" />
69+
<argument name="attributeCode" value="{{colorProductAttribute.default_label}}" />
70+
<argument name="inputType" value="{{textSwatchAttribute.input_type}}" />
71+
<argument name="scope" value="{{productAttributeDropdownTwoOptions.scope}}" />
72+
</actionGroup>
73+
<click selector="{{AttributePropertiesSection.addSwatch}}" stepKey="clickAddBlackSwatch"/>
74+
<waitForAjaxLoad stepKey="waitForAjaxLoad"/>
75+
<actionGroup ref="AdminAddTextSwatchForAdminActionGroup" stepKey="addBlackSwatchOption">
76+
<argument name="position" value="0"/>
77+
<argument name="swatchName" value="Black"/>
78+
<argument name="swatchDescription" value="Black"/>
79+
</actionGroup>
80+
<click selector="{{AttributePropertiesSection.addSwatch}}" stepKey="clickAddBlueSwatch"/>
81+
<waitForAjaxLoad stepKey="waitForAjaxLoad1"/>
82+
<actionGroup ref="AdminAddTextSwatchForAdminActionGroup" stepKey="addBlueSwatchOption">
83+
<argument name="position" value="1"/>
84+
<argument name="swatchName" value="Blue"/>
85+
<argument name="swatchDescription" value="Blue"/>
86+
</actionGroup>
87+
<click selector="{{AttributePropertiesSection.addSwatch}}" stepKey="clickAddWhiteSwatch"/>
88+
<waitForAjaxLoad stepKey="waitForAjaxLoad2"/>
89+
<actionGroup ref="AdminAddTextSwatchForAdminActionGroup" stepKey="addWhiteSwatchOption">
90+
<argument name="position" value="2"/>
91+
<argument name="swatchName" value="White"/>
92+
<argument name="swatchDescription" value="White"/>
93+
</actionGroup>
94+
<click selector="{{AdminCreateNewProductAttributeSection.saveAttribute}}" stepKey="clickOnColorSaveAttribute"/>
95+
<waitForPageLoad stepKey="waitForColorAttributeToSave"/>
96+
<waitForElement selector="{{AdminProductMessagesSection.successMessage}}" stepKey="seeColorSaveProductMessage"/>
97+
<!-- Step 3: Create other new Attribute with label size -->
98+
<actionGroup ref="AdminOpenProductAttributePageActionGroup" stepKey="navigateToProductAttributeGrid1" />
99+
<actionGroup ref="FillProductAttributeFieldsActionGroup" stepKey="fillSizeAttributeFields">
100+
<argument name="attributeLabel" value="{{sizeAttribute.default_label}}" />
101+
<argument name="attributeCode" value="{{sizeAttribute.default_label}}" />
102+
<argument name="inputType" value="{{textSwatchAttribute.input_type}}" />
103+
<argument name="scope" value="{{productAttributeDropdownTwoOptions.scope}}" />
104+
</actionGroup>
105+
<click selector="{{AttributePropertiesSection.addSwatch}}" stepKey="clickAddSmallSwatch"/>
106+
<waitForAjaxLoad stepKey="waitForAjaxLoad3"/>
107+
<actionGroup ref="AdminAddTextSwatchForAdminActionGroup" stepKey="addSmallSwatchOption">
108+
<argument name="position" value="0"/>
109+
<argument name="swatchName" value="Small"/>
110+
<argument name="swatchDescription" value="Small"/>
111+
</actionGroup>
112+
<click selector="{{AttributePropertiesSection.addSwatch}}" stepKey="clickAddMediumSwatch"/>
113+
<waitForAjaxLoad stepKey="waitForAjaxLoad4"/>
114+
<actionGroup ref="AdminAddTextSwatchForAdminActionGroup" stepKey="addMediumSwatchOption">
115+
<argument name="position" value="1"/>
116+
<argument name="swatchName" value="Medium"/>
117+
<argument name="swatchDescription" value="Medium"/>
118+
</actionGroup>
119+
<click selector="{{AttributePropertiesSection.addSwatch}}" stepKey="clickAddLargeSwatch"/>
120+
<waitForAjaxLoad stepKey="waitForAjaxLoad5"/>
121+
<actionGroup ref="AdminAddTextSwatchForAdminActionGroup" stepKey="addLargeSwatchOption">
122+
<argument name="position" value="2"/>
123+
<argument name="swatchName" value="Large"/>
124+
<argument name="swatchDescription" value="Large"/>
125+
</actionGroup>
126+
<click selector="{{AdminCreateNewProductAttributeSection.saveAttribute}}" stepKey="clickOnSizeSaveAttribute"/>
127+
<waitForPageLoad stepKey="waitForSizeAttributeToSave"/>
128+
<waitForElement selector="{{AdminProductMessagesSection.successMessage}}" stepKey="seeSizeSaveProductMessage"/>
129+
<actionGroup ref="AdminOpenAttributeSetGridPageActionGroup" stepKey="openAttributeSetPage"/>
130+
<actionGroup ref="AdminOpenAttributeSetByNameActionGroup" stepKey="openAttributeSetForColor">
131+
<argument name="attributeSetName" value="Default"/>
132+
</actionGroup>
133+
<waitForText userInput="{{colorProductAttribute.default_label}}" selector="{{AdminProductAttributeSetEditSection.unassignedAttributesTree}}" stepKey="seeColorAttributeInUnassigned"/>
134+
<actionGroup ref="AssignAttributeToGroupActionGroup" stepKey="assignColorAttributeToGroup">
135+
<argument name="group" value="Product Details"/>
136+
<argument name="attribute" value="{{colorProductAttribute.default_label}}"/>
137+
</actionGroup>
138+
<waitForText userInput="{{sizeAttribute.default_label}}" selector="{{AdminProductAttributeSetEditSection.unassignedAttributesTree}}" stepKey="seeSizeAttributeInUnassigned"/>
139+
<actionGroup ref="AssignAttributeToGroupActionGroup" stepKey="assignSizeAttributeToGroup">
140+
<argument name="group" value="Product Details"/>
141+
<argument name="attribute" value="{{sizeAttribute.default_label}}"/>
142+
</actionGroup>
143+
<actionGroup ref="SaveAttributeSetActionGroup" stepKey="saveSizeAttributeSet"/>
144+
<!-- Step 4 - Edit Configurable Product -->
145+
<actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="navigateToProductIndex"/>
146+
<actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterProduct">
147+
<argument name="product" value="$$createConfigProduct$$"/>
148+
</actionGroup>
149+
<actionGroup ref="OpenEditProductOnBackendActionGroup" stepKey="openEditProduct2">
150+
<argument name="product" value="$$createConfigProduct$$"/>
151+
</actionGroup>
152+
<click selector="{{AdminProductFormConfigurationsSection.createConfigurations}}" stepKey="clickOnCreateConfigurations"/>
153+
<actionGroup ref="AdminSelectAttributeInConfigurableAttributesGrid" stepKey="selectColorAttribute">
154+
<argument name="attributeCode" value="{{colorProductAttribute.default_label}}"/>
155+
</actionGroup>
156+
<actionGroup ref="AdminSelectAttributeInConfigurableAttributesGrid" stepKey="selectSizeAttribute">
157+
<argument name="attributeCode" value="{{sizeAttribute.default_label}}"/>
158+
</actionGroup>
159+
<actionGroup ref="AdminSelectAllValueOfTwoAttributesPageActionGroup" stepKey="selectColorOptions">
160+
<argument name="attributeLabel1" value="{{colorProductAttribute.default_label}}" />
161+
<argument name="attributeLabel2" value="{{sizeAttribute.default_label}}" />
162+
</actionGroup>
163+
<actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct1"/>
164+
<!-- Step 5 - open child product and make out of stock -->
165+
<actionGroup ref="AdminOpenChildVariationOfConfigurableProductActionGroup" stepKey="OpenChildVariation">
166+
<argument name="variation" value="$$createConfigProduct.name$$-Blue-Medium" />
167+
</actionGroup>
168+
<switchToNextTab stepKey="switchToConfigChildProductPage"/>
169+
<waitForPageLoad stepKey="waitForProductPageLoad"/>
170+
<selectOption selector="{{AdminProductFormSection.productStockStatus}}" userInput="{{UpdateAttributeQtyAndStockToOutOfStock.stockAvailability}}" stepKey="selectChildProductStockStatus"/>
171+
<actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct2"/>
172+
<closeTab stepKey="closeConfigChildProductPage"/>
173+
<!-- Step 6 - Navigate to Storefront product page -->
174+
<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openProductPage">
175+
<argument name="productUrl" value="$$createConfigProduct.custom_attributes[url_key]$$"/>
176+
</actionGroup>
177+
<!-- Step 7 - Verify Blue Medium combination is disabled -->
178+
<click selector="{{StorefrontProductInfoMainSection.swatchOptionByLabel('Blue')}}" stepKey="clickBlueSwatch1"/>
179+
<waitForElementVisible selector="{{StorefrontProductInfoMainSection.swatchOptionByLabel('Medium')}}" stepKey="waitForMediumSwatchVisible"/>
180+
<grabAttributeFrom selector="{{StorefrontProductInfoMainSection.swatchOptionByLabel('Medium')}}" userInput="disabled" stepKey="grabMediumAttribute"/>
181+
<assertEquals stepKey="assertMediumDisabled">
182+
<expectedResult type="string">true</expectedResult>
183+
<actualResult type="string">{$grabMediumAttribute}</actualResult>
184+
</assertEquals>
185+
<!-- Step 8 - Verify Blue Large combination is enabled -->
186+
<!-- Select Blue color swatch -->
187+
<click selector="{{StorefrontProductInfoMainSection.swatchOptionByLabel('Blue')}}" stepKey="clickBlueSwatch2"/>
188+
<waitForElementClickable selector="{{StorefrontProductInfoMainSection.swatchOptionByLabel('Large')}}" stepKey="waitForLargeSwatchClickable"/>
189+
<click selector="{{StorefrontProductInfoMainSection.swatchOptionByLabel('Large')}}" stepKey="clickLargeSize"/>
190+
<waitForElement selector="{{StorefrontProductInfoMainSection.selectedSwatchValue('Large')}}" stepKey="assertLargeSelected"/>
191+
</test>
192+
</tests>

0 commit comments

Comments
 (0)