Skip to content

Commit e0448f0

Browse files
committed
MC-17552: Saving configurable product with custom product attribute (images as swatches)
Fixed selector
1 parent 44a35f9 commit e0448f0

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

app/code/Magento/Catalog/Test/Mftf/Test/AdminSaveConfigurableProductWithAttributesImagesAndSwatchesTest.xml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,13 @@
9696
<argument name="attributeCode" value="{{productVisualSwatchAttribute.attribute_code}}"/>
9797
</actionGroup>
9898

99+
<!-- Using this action to concatenate 2 strings to have unique identifier for grid -->
100+
<executeJS function="return '{{productVisualSwatchAttribute.attribute_code}}: red'" stepKey="attributeCodeRed"/>
101+
<executeJS function="return '{{productVisualSwatchAttribute.attribute_code}}: blue'" stepKey="attributeCodeBlue"/>
102+
99103
<!-- Add images for the products -->
100-
<attachFile selector="{{AdminProductFormConfigurationsSection.addImageByAttributeOption('red')}}" userInput="{{MagentoLogo.file}}" stepKey="uploadImageForFirstProduct"/>
101-
<attachFile selector="{{AdminProductFormConfigurationsSection.addImageByAttributeOption('blue')}}" userInput="{{ProductImage.file}}" stepKey="uploadImageForSecondProduct"/>
104+
<attachFile selector="{{AdminDataGridTableSection.rowTemplate({$attributeCodeRed})}}{{AdminProductFormConfigurationsSection.fileUploaderInput}}" userInput="{{MagentoLogo.file}}" stepKey="uploadImageForFirstProduct"/>
105+
<attachFile selector="{{AdminDataGridTableSection.rowTemplate({$attributeCodeBlue})}}{{AdminProductFormConfigurationsSection.fileUploaderInput}}" userInput="{{ProductImage.file}}" stepKey="uploadImageForSecondProduct"/>
102106

103107
<!-- Click "Save" button -->
104108
<actionGroup ref="saveProductForm" stepKey="clickSaveButton"/>

app/code/Magento/ConfigurableProduct/Test/Mftf/Section/AdminProductFormConfigurationsSection.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@
2626
<element name="skuValidationMessage" type="text" selector="input[name='configurable-matrix[{{index}}][sku]'] + label" parameterized="true"/>
2727
<element name="stepsWizardTitle" type="text" selector="div.content:not([style='display: none;']) .steps-wizard-title"/>
2828
<element name="attributeEntityByName" type="text" selector="//div[@class='attribute-entity']//div[normalize-space(.)='{{attributeLabel}}']" parameterized="true"/>
29-
<element name="addImageByAttributeOption" type="file" selector="//*[.='Attributes']/ancestor::tr//span[contains(text(), '{{option}}')]/ancestor::tr//input[@class='file-uploader-input']" parameterized="true"/>
29+
<element name="fileUploaderInput" type="file" selector="//input[@type='file' and @class='file-uploader-input']"/>
3030
</section>
3131
</sections>

app/code/Magento/Ui/Test/Mftf/Section/AdminDataGridTableSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,6 @@
2222
<element name="rowEditAction" type="button" selector="[data-role='grid'] tbody tr .action-select-wrap._active [data-action='item-edit']" timeout="30"/>
2323
<element name="dataGridEmpty" type="block" selector=".data-grid-tr-no-data td"/>
2424
<element name="dataGridWrap" type="block" selector=".admin__data-grid-wrap"/>
25+
<element name="rowTemplate" type="block" selector="//tbody/tr[td[*[contains(.,normalize-space('{{text}}'))]]]" parameterized="true" />
2526
</section>
2627
</sections>

0 commit comments

Comments
 (0)