Skip to content

Commit df4f173

Browse files
ACQE-8248: Product Attribute of multiselect type can be saved with all options unchecked
- Created MFTF test file for automating unselect multiselect attribute options and save the product
1 parent 7accebf commit df4f173

File tree

2 files changed

+112
-0
lines changed

2 files changed

+112
-0
lines changed

app/code/Magento/Catalog/Test/Mftf/Data/ProductAttributeData.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,5 +486,11 @@
486486
<data key="is_used_for_promo_rules">true</data>
487487
<requiredEntity type="FrontendLabel">ProductAttributeFrontendLabel</requiredEntity>
488488
</entity>
489+
<entity name="multiSelectAttributeWithThreeOptions" extends="productDropDownAttribute" type="ProductAttribute">
490+
<data key="frontend_input">multiselect</data>
491+
<data key="option1">1</data>
492+
<data key="option2">2</data>
493+
<data key="option3">3</data>
494+
</entity>
489495
</entities>
490496

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
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="AdminProductMultiselectAttributeUncheckAllOptionsTest">
22+
<annotations>
23+
<group value="Catalog"/>
24+
<title value="Product Attribute of multiselect type can be saved with all options unchecked"/>
25+
<features value="Uncheck multiselect attribute options and save the product"/>
26+
<stories value="Verify out of stock product swatch visibility"/>
27+
<description value="Verify that a product attribute of multiselect type can be saved with all options unchecked in the admin product edit page."/>
28+
<testCaseId value="AC-4856"/>
29+
<severity value="MAJOR"/>
30+
</annotations>
31+
<before>
32+
<!-- Login as admin -->
33+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
34+
<!-- Pre-condition Step-1 Multiselect attribute is created with three options: 1, 2, 3 -->
35+
<createData entity="multiSelectAttributeWithThreeOptions" stepKey="createMultiSelectProductAttributeWith2Options"/>
36+
<actionGroup ref="AdminOpenProductAttributePageActionGroup" stepKey="goToProductAttributes"/>
37+
<actionGroup ref="NavigateToCreatedProductAttributeActionGroup" stepKey="openAttributeFromGrid">
38+
<argument name="ProductAttribute" value="$$createMultiSelectProductAttributeWith2Options$$"/>
39+
</actionGroup>
40+
<actionGroup ref="CreateAttributeDropdownNthOptionActionGroup" stepKey="createOption1">
41+
<argument name="adminName" value="{{multiSelectAttributeWithThreeOptions.option1}}"/>
42+
<argument name="frontName" value="{{multiSelectAttributeWithThreeOptions.option1}}"/>
43+
<argument name="row" value="{{multiSelectAttributeWithThreeOptions.option1}}"/>
44+
</actionGroup>
45+
<actionGroup ref="CreateAttributeDropdownNthOptionActionGroup" stepKey="createOption2">
46+
<argument name="adminName" value="{{multiSelectAttributeWithThreeOptions.option2}}"/>
47+
<argument name="frontName" value="{{multiSelectAttributeWithThreeOptions.option2}}"/>
48+
<argument name="row" value="{{multiSelectAttributeWithThreeOptions.option2}}"/>
49+
</actionGroup>
50+
<actionGroup ref="CreateAttributeDropdownNthOptionActionGroup" stepKey="createOption3">
51+
<argument name="adminName" value="{{multiSelectAttributeWithThreeOptions.option3}}"/>
52+
<argument name="frontName" value="{{multiSelectAttributeWithThreeOptions.option3}}"/>
53+
<argument name="row" value="{{multiSelectAttributeWithThreeOptions.option3}}"/>
54+
</actionGroup>
55+
<waitForElement selector="{{AttributePropertiesSection.Save}}" stepKey="waitForSaveButton" />
56+
<click selector="{{AttributePropertiesSection.Save}}" stepKey="saveAttribute"/>
57+
<!-- Pre-condition Step-2 Multiselect Attribute added to default Attribute set -->
58+
<actionGroup ref="AdminOpenAttributeSetGridPageActionGroup" stepKey="openAttributeSetPage"/>
59+
<actionGroup ref="AdminOpenAttributeSetByNameActionGroup" stepKey="openDefaultAttributeSet"/>
60+
<actionGroup ref="AssignAttributeToGroupActionGroup" stepKey="assignAttributeToGroup">
61+
<argument name="group" value="Product Details"/>
62+
<argument name="attribute" value="$$createMultiSelectProductAttributeWith2Options.attribute_code$$"/>
63+
</actionGroup>
64+
<actionGroup ref="SaveAttributeSetActionGroup" stepKey="saveAttributeSet"/>
65+
<!-- Pre-condition Step-3 Product is created based on default attribute set. Value of multiselect attribute set to 1 and 2 for this product -->
66+
<createData entity="SimpleProduct" stepKey="createSimpleProduct"/>
67+
<actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="navigateToProductIndex"/>
68+
<actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterProduct">
69+
<argument name="product" value="$$createSimpleProduct$$"/>
70+
</actionGroup>
71+
<actionGroup ref="OpenEditProductOnBackendActionGroup" stepKey="openEditProduct">
72+
<argument name="product" value="$$createSimpleProduct$$"/>
73+
</actionGroup>
74+
<waitForElement selector="{{AdminProductFormSection.customSelectAttribute('$$createMultiSelectProductAttributeWith2Options.attribute_code$$')}}" stepKey="waitForMultiSelectAttributeToSelect" />
75+
<selectOption selector="{{AdminProductFormSection.customSelectAttribute('$$createMultiSelectProductAttributeWith2Options.attribute_code$$')}}" parameterArray="['1','2']" stepKey="selectFirstAndSecondOptions"/>
76+
<actionGroup ref="SaveProductFormActionGroup" stepKey="saveProductForm"/>
77+
</before>
78+
<after>
79+
<!-- Delete product -->
80+
<deleteData createDataKey="createSimpleProduct" stepKey="deleteProduct"/>
81+
<!-- Delete attribute -->
82+
<actionGroup ref="NavigateToCreatedProductAttributeActionGroup" stepKey="openAttributeFromGrid">
83+
<argument name="ProductAttribute" value="$$createMultiSelectProductAttributeWith2Options$$"/>
84+
</actionGroup>
85+
<actionGroup ref="DeleteProductAttributeByAttributeCodeActionGroup" stepKey="deleteProductAttribute"/>
86+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
87+
</after>
88+
<!-- Step 2 & 3 - Navigate: Products > Catalog and Open created product -->
89+
<actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="goToProductEditPage">
90+
<argument name="productId" value="$createSimpleProduct.id$"/>
91+
</actionGroup>
92+
<waitForPageLoad stepKey="waitForProductPageLoad"/>
93+
<!-- Step 4 - Uncheck all options of multiselect attribute -->
94+
<waitForElement selector="{{AdminProductFormSection.customSelectAttribute('$$createMultiSelectProductAttributeWith2Options.attribute_code$$')}}" stepKey="waitForMultiSelectAttributeToUnSelect" />
95+
<unselectOption selector="{{AdminProductFormSection.customSelectAttribute('$$createMultiSelectProductAttributeWith2Options.attribute_code$$')}}" parameterArray="['1','2']" stepKey="uncheckAllOptions"/>
96+
<!-- Step 5 - Save product -->
97+
<actionGroup ref="SaveProductFormActionGroup" stepKey="saveProductFormAfterUncheck"/>
98+
<waitForElementVisible selector="{{AdminMessagesSection.successMessage}}" stepKey="waitForSuccessMessage"/>
99+
<seeElement selector="{{AdminMessagesSection.successMessage}}" stepKey="seeSuccessMessage"/>
100+
<!-- Assert multiselect attribute has all options unchecked -->
101+
<dontSeeOptionIsSelected selector="{{AdminProductFormSection.customSelectAttribute('$$createMultiSelectProductAttributeWith2Options.attribute_code$$')}}" userInput="1" stepKey="assertOption1NotChecked"/>
102+
<dontSeeOptionIsSelected selector="{{AdminProductFormSection.customSelectAttribute('$$createMultiSelectProductAttributeWith2Options.attribute_code$$')}}" userInput="2" stepKey="assertOption2NotChecked"/>
103+
<dontSeeOptionIsSelected selector="{{AdminProductFormSection.customSelectAttribute('$$createMultiSelectProductAttributeWith2Options.attribute_code$$')}}" userInput="3" stepKey="assertOption3NotChecked"/>
104+
</test>
105+
</tests>
106+

0 commit comments

Comments
 (0)