Skip to content

Commit f09f1b3

Browse files
committed
ACQE-8891: Admin can create product with text swatch attribute in custom attribute set and verify single selection behavior
- Created data entities
1 parent 17791d0 commit f09f1b3

File tree

3 files changed

+23
-10
lines changed

3 files changed

+23
-10
lines changed

app/code/Magento/Swatches/Test/Mftf/ActionGroup/AdminSelectTextSwatchAttributeOptionActionGroup.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
<argument name="attributeCode" type="string"/>
1616
<argument name="optionValue" type="string"/>
1717
</arguments>
18+
<waitForElementClickable selector="{{AdminProductAttributesSection.attributeDropdownByCode(attributeCode)}}" stepKey="waitForAttributeDropdown"/>
1819
<selectOption selector="{{AdminProductAttributesSection.attributeDropdownByCode(attributeCode)}}" userInput="{{optionValue}}" stepKey="selectAttributeOption"/>
1920
<waitForPageLoad stepKey="waitAfterSelection"/>
2021
</actionGroup>

app/code/Magento/Swatches/Test/Mftf/Data/SwatchOptionData.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,16 @@
1717
<data key="admin_label" unique="suffix">VisualOpt2</data>
1818
<data key="default_label" unique="suffix">VisualOpt2</data>
1919
</entity>
20+
<entity name="textSwatchOption1" type="SwatchOption">
21+
<data key="admin_label">textSwatchOption1</data>
22+
<data key="default_label">textSwatchOption1</data>
23+
</entity>
24+
<entity name="textSwatchOption2" type="SwatchOption">
25+
<data key="admin_label">textSwatchOption2</data>
26+
<data key="default_label">textSwatchOption2</data>
27+
</entity>
28+
<entity name="textSwatchOption3" type="SwatchOption">
29+
<data key="admin_label">textSwatchOption3</data>
30+
<data key="default_label">textSwatchOption3</data>
31+
</entity>
2032
</entities>

app/code/Magento/Swatches/Test/Mftf/Test/AdminCreateProductWithTextSwatchInCustomAttributeSetTest.xml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424
<actionGroup ref="AddTextSwatchToProductActionGroup" stepKey="createTextSwatchAttribute">
2525
<argument name="attributeName" value="{{textSwatchAttribute.default_label}}"/>
2626
<argument name="attributeCode" value="{{textSwatchAttribute.attribute_code}}"/>
27-
<argument name="option1" value="textSwatchOption1"/>
28-
<argument name="option2" value="textSwatchOption2"/>
29-
<argument name="option3" value="textSwatchOption3"/>
27+
<argument name="option1" value="{{textSwatchOption1.admin_label}}"/>
28+
<argument name="option2" value="{{textSwatchOption2.admin_label}}"/>
29+
<argument name="option3" value="{{textSwatchOption3.admin_label}}"/>
3030
</actionGroup>
3131
<waitForElementVisible selector="{{AdminProductMessagesSection.successMessage}}" stepKey="waitForAttributeSuccessMessage"/>
3232
<!-- Precondition7,8: Create new attribute set based on Default -->
@@ -78,15 +78,15 @@
7878
<waitForElementVisible selector="{{AdminProductAttributesSection.attributeDropdownByCode(textSwatchAttribute.attribute_code)}}" stepKey="waitForTextSwatchAttribute"/>
7979
<actionGroup ref="AdminSelectTextSwatchAttributeOptionActionGroup" stepKey="selectFirstOption">
8080
<argument name="attributeCode" value="{{textSwatchAttribute.attribute_code}}"/>
81-
<argument name="optionValue" value="textSwatchOption1"/>
81+
<argument name="optionValue" value="{{textSwatchOption1.admin_label}}"/>
8282
</actionGroup>
8383
<!-- Step 7: Select second option - this should deselect the first option automatically -->
8484
<actionGroup ref="AdminSelectTextSwatchAttributeOptionActionGroup" stepKey="selectSecondOption">
8585
<argument name="attributeCode" value="{{textSwatchAttribute.attribute_code}}"/>
86-
<argument name="optionValue" value="textSwatchOption2"/>
86+
<argument name="optionValue" value="{{textSwatchOption2.admin_label}}"/>
8787
</actionGroup>
8888
<!-- Verify second option is selected -->
89-
<seeOptionIsSelected selector="{{AdminProductAttributesSection.attributeDropdownByCode(textSwatchAttribute.attribute_code)}}" userInput="textSwatchOption2" stepKey="verifySecondOptionSelected"/>
89+
<seeOptionIsSelected selector="{{AdminProductAttributesSection.attributeDropdownByCode(textSwatchAttribute.attribute_code)}}" userInput="{{textSwatchOption2.admin_label}}" stepKey="verifySecondOptionSelected"/>
9090
<!-- Step 8: Save product -->
9191
<actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/>
9292
<!-- Step 9: Edit product and verify second option is still selected -->
@@ -98,18 +98,18 @@
9898
<argument name="product" value="SimpleProduct"/>
9999
</actionGroup>
100100
<waitForElementVisible selector="{{AdminProductAttributesSection.attributeDropdownByCode(textSwatchAttribute.attribute_code)}}" stepKey="waitForSwatchAttributeAfterEdit"/>
101-
<seeOptionIsSelected selector="{{AdminProductAttributesSection.attributeDropdownByCode(textSwatchAttribute.attribute_code)}}" userInput="textSwatchOption2" stepKey="verifySecondOptionStillSelected"/>
101+
<seeOptionIsSelected selector="{{AdminProductAttributesSection.attributeDropdownByCode(textSwatchAttribute.attribute_code)}}" userInput="{{textSwatchOption2.admin_label}}" stepKey="verifySecondOptionStillSelected"/>
102102
<!-- Change option to third option - previous option should be deselected -->
103103
<actionGroup ref="AdminSelectTextSwatchAttributeOptionActionGroup" stepKey="selectThirdOption">
104104
<argument name="attributeCode" value="{{textSwatchAttribute.attribute_code}}"/>
105-
<argument name="optionValue" value="textSwatchOption3"/>
105+
<argument name="optionValue" value="{{textSwatchOption3.admin_label}}"/>
106106
</actionGroup>
107107
<!-- Verify third option is selected -->
108-
<seeOptionIsSelected selector="{{AdminProductAttributesSection.attributeDropdownByCode(textSwatchAttribute.attribute_code)}}" userInput="textSwatchOption3" stepKey="verifyThirdOptionSelected"/>
108+
<seeOptionIsSelected selector="{{AdminProductAttributesSection.attributeDropdownByCode(textSwatchAttribute.attribute_code)}}" userInput="{{textSwatchOption3.admin_label}}" stepKey="verifyThirdOptionSelected"/>
109109
<!-- Step 10: Save product again -->
110110
<actionGroup ref="SaveProductFormActionGroup" stepKey="saveProductAgain"/>
111111
<!-- Verify third option persisted after save -->
112112
<waitForElementVisible selector="{{AdminProductAttributesSection.attributeDropdownByCode(textSwatchAttribute.attribute_code)}}" stepKey="waitForSwatchAttributeAfterSecondSave"/>
113-
<seeOptionIsSelected selector="{{AdminProductAttributesSection.attributeDropdownByCode(textSwatchAttribute.attribute_code)}}" userInput="textSwatchOption3" stepKey="verifyThirdOptionPersisted"/>
113+
<seeOptionIsSelected selector="{{AdminProductAttributesSection.attributeDropdownByCode(textSwatchAttribute.attribute_code)}}" userInput="{{textSwatchOption3.admin_label}}" stepKey="verifyThirdOptionPersisted"/>
114114
</test>
115115
</tests>

0 commit comments

Comments
 (0)