Skip to content

Commit 252519c

Browse files
committed
MC-3078: Admin can create product attribute with text swatch
- Fix code review feedback
1 parent 6f0bcce commit 252519c

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed

app/code/Magento/Swatches/Test/Mftf/Section/AdminManageSwatchSection.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
<element name="nthSwatch" type="button" selector="#swatch-visual-options-panel table tbody tr:nth-of-type({{var}}) .swatch_window" parameterized="true"/>
1515
<element name="addSwatchText" type="button" selector="#add_new_swatch_text_option_button"/>
1616
<element name="swatchTextByIndex" type="input" selector="input[name='swatchtext[value][option_{{index}}][0]']" parameterized="true"/>
17+
<element name="nthSwatchText" type="input" selector="#swatch-text-options-panel table tbody tr:nth-of-type({{var}}) td:nth-of-type(3) input" parameterized="true"/>
18+
<element name="nthSwatchAdminDescription" type="input" selector="#swatch-text-options-panel table tbody tr:nth-of-type({{var}}) td:nth-of-type(4) input" parameterized="true"/>
19+
<!-- Selector for Admin Description input where the index is zero-based -->
1720
<element name="swatchAdminDescriptionByIndex" type="input" selector="input[name='optiontext[value][option_{{index}}][0]']" parameterized="true"/>
1821
<element name="nthChooseColor" type="button" selector="#swatch-visual-options-panel table tbody tr:nth-of-type({{var}}) .swatch_row_name.colorpicker_handler" parameterized="true"/>
1922
<element name="nthDelete" type="button" selector="#swatch-visual-options-panel table tbody tr:nth-of-type({{var}}) button.delete-option" parameterized="true"/>

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

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,27 @@
4141
<fillField selector="{{AdminManageSwatchSection.swatchAdminDescriptionByIndex('2')}}" userInput="Something blue." stepKey="fillDescription2"/>
4242
<click selector="{{AttributePropertiesSection.AdvancedProperties}}" stepKey="expandAdvancedProperties"/>
4343
<selectOption selector="{{AttributePropertiesSection.Scope}}" userInput="1" stepKey="selectGlobalScope"/>
44-
<click selector="{{AttributePropertiesSection.Save}}" stepKey="clickSave"/>
44+
<!-- Save and verify -->
45+
<click selector="{{AttributePropertiesSection.SaveAndEdit}}" stepKey="clickSave"/>
46+
<seeInField selector="{{AttributePropertiesSection.DefaultLabel}}" userInput="{{ProductAttributeFrontendLabel.label}}" stepKey="seeDefaultLabel"/>
47+
<seeInField selector="{{AdminManageSwatchSection.nthSwatchText('1')}}" userInput="red" stepKey="seeSwatch0"/>
48+
<seeInField selector="{{AdminManageSwatchSection.nthSwatchAdminDescription('1')}}" userInput="Something red." stepKey="seeDescription0"/>
49+
<seeInField selector="{{AdminManageSwatchSection.nthSwatchText('2')}}" userInput="green" stepKey="seeSwatch1"/>
50+
<seeInField selector="{{AdminManageSwatchSection.nthSwatchAdminDescription('2')}}" userInput="Something green." stepKey="seeDescription1"/>
51+
<seeInField selector="{{AdminManageSwatchSection.nthSwatchText('3')}}" userInput="blue" stepKey="seeSwatch2"/>
52+
<seeInField selector="{{AdminManageSwatchSection.nthSwatchAdminDescription('3')}}" userInput="Something blue." stepKey="seeDescription2"/>
4553

4654
<!-- Create a configurable product to verify the storefront with -->
4755
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="amOnProductGridPage"/>
4856
<waitForPageLoad time="30" stepKey="waitForProductGrid"/>
49-
<click selector="{{AdminProductGridActionSection.addProductToggle}}" stepKey="clickOnAddProductToggle"/>
50-
<click selector="{{AdminProductGridActionSection.addConfigurableProduct}}" stepKey="clickOnAddConfigurableProduct"/>
51-
<fillField userInput="{{_defaultProduct.name}}" selector="{{AdminProductFormSection.productName}}" stepKey="fillName"/>
52-
<fillField userInput="{{_defaultProduct.sku}}" selector="{{AdminProductFormSection.productSku}}" stepKey="fillSKU"/>
53-
<fillField userInput="{{_defaultProduct.price}}" selector="{{AdminProductFormSection.productPrice}}" stepKey="fillPrice"/>
54-
<fillField userInput="{{_defaultProduct.quantity}}" selector="{{AdminProductFormSection.productQuantity}}" stepKey="fillQuantity"/>
57+
<actionGroup ref="goToCreateProductPage" stepKey="goToCreateConfigurableProduct">
58+
<argument name="product" value="BaseConfigurableProduct"/>
59+
</actionGroup>
5560
<click selector="{{AdminProductSEOSection.sectionHeader}}" stepKey="openSeoSection"/>
5661
<fillField userInput="{{_defaultProduct.urlKey}}" selector="{{AdminProductSEOSection.urlKeyInput}}" stepKey="fillUrlKey"/>
62+
<actionGroup ref="fillMainProductForm" stepKey="fillProductForm">
63+
<argument name="product" value="BaseConfigurableProduct"/>
64+
</actionGroup>
5765

5866
<!-- Create configurations based off the Text Swatch we created earlier -->
5967
<click selector="{{AdminProductFormConfigurationsSection.createConfigurations}}" stepKey="clickCreateConfigurations"/>

0 commit comments

Comments
 (0)