Skip to content

Commit befbcab

Browse files
author
Joan He
authored
Merge pull request #4113 from magento-arcticfoxes/2.3-develop-pr
[arcticfoxes] MC-15033: Configurable product gallery does not prepend images with multiple attributes
2 parents c0a2062 + a07b89b commit befbcab

File tree

6 files changed

+72
-6
lines changed

6 files changed

+72
-6
lines changed

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,15 @@
305305
<data key="filename">magento-again</data>
306306
<data key="file_extension">jpg</data>
307307
</entity>
308+
<entity name="TestImageAdobe" type="image">
309+
<data key="title" unique="suffix">magento-adobe</data>
310+
<data key="price">1.00</data>
311+
<data key="file_type">Upload File</data>
312+
<data key="shareable">Yes</data>
313+
<data key="file">adobe-base.jpg</data>
314+
<data key="filename">adobe-base</data>
315+
<data key="file_extension">jpg</data>
316+
</entity>
308317
<entity name="ProductWithUnicode" type="product">
309318
<data key="sku" unique="suffix">&#38657;&#20135;&#21697;</data>
310319
<data key="type_id">simple</data>

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@
4343
<actionGroup ref="saveProductForm" stepKey="saveSimpleProduct"/>
4444

4545
<!-- Assert product image in admin product form -->
46-
<actionGroup ref="assertProductImageAdminProductPage" stepKey="assertProductImageAdminProductPage"/>
46+
<actionGroup ref="assertProductImageAdminProductPage" stepKey="assertProductImageAdminProductPage">
47+
<argument name="image" value="MagentoLogo"/>
48+
</actionGroup>
4749

4850
<!-- Assert product in storefront product page -->
4951
<actionGroup ref="AssertProductInStorefrontProductPage" stepKey="AssertProductInStorefrontProductPage">

app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AdminConfigurableProductActionGroup.xml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,22 @@
131131
<click selector="{{AdminChooseAffectedAttributeSetPopup.confirm}}" stepKey="clickOnConfirmInPopup"/>
132132
</actionGroup>
133133

134+
<actionGroup name="createConfigurationsForAttributeWithImages" extends="generateConfigurationsByAttributeCode">
135+
<arguments>
136+
<argument name="attributeCode" type="string" defaultValue="SomeString"/>
137+
<argument name="image" defaultValue="ProductImage"/>
138+
</arguments>
139+
140+
<click selector="{{AdminCreateProductConfigurationsPanel.applySingleSetOfImages}}" stepKey="clickOnApplySingleImageSetToAllSku" after="enterAttributeQuantity"/>
141+
<waitForElementVisible selector="{{AdminCreateProductConfigurationsPanel.imageUploadButton}}" stepKey="seeImageSectionIsReady" after="clickOnApplySingleImageSetToAllSku"/>
142+
<attachFile selector="{{AdminCreateProductConfigurationsPanel.imageFileUpload}}" userInput="{{image.file}}" stepKey="uploadFile" after="seeImageSectionIsReady"/>
143+
<waitForElementNotVisible selector="{{AdminCreateProductConfigurationsPanel.uploadProgressBar}}" stepKey="waitForUpload" after="uploadFile"/>
144+
<waitForElementVisible selector="{{AdminCreateProductConfigurationsPanel.imageFile(image.fileName)}}" stepKey="waitForThumbnail" after="waitForUpload"/>
145+
146+
<click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickOnSaveButton2" after="clickOnNextButton4"/>
147+
<click selector="{{AdminChooseAffectedAttributeSetPopup.confirm}}" stepKey="clickOnConfirmInPopup" after="clickOnSaveButton2"/>
148+
</actionGroup>
149+
134150
<actionGroup name="createConfigurationsForTwoAttribute" extends="generateConfigurationsByAttributeCode">
135151
<arguments>
136152
<argument name="secondAttributeCode" type="string"/>

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@
2626
<element name="saveAttribute" type="button" selector="li[data-attribute-option-title=''] .action-save" timeout="30"/>
2727
<element name="attributeCheckboxByIndex" type="input" selector="li.attribute-option:nth-of-type({{var1}}) input" parameterized="true"/>
2828

29+
<element name="applySingleSetOfImages" type="radio" selector=".admin__field-label[for='apply-single-set-radio']" timeout="30"/>
30+
<element name="imageFileUpload" type="input" selector=".steps-wizard-section input[type='file'][name='image']"/>
31+
<element name="imageUploadButton" type="button" selector=".steps-wizard-section div.gallery"/>
32+
2933
<element name="applyUniquePricesByAttributeToEachSku" type="radio" selector=".admin__field-label[for='apply-unique-prices-radio']"/>
3034
<element name="applySinglePriceToAllSkus" type="radio" selector=".admin__field-label[for='apply-single-price-radio']"/>
3135
<element name="singlePrice" type="input" selector="#apply-single-price-input"/>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
1111
<section name="StorefrontProductInfoMainSection">
12-
<element name="swatchOptionByLabel" type="button" selector="div.swatch-option[option-label={{opt}}]" parameterized="true"/>
12+
<element name="swatchOptionByLabel" type="button" selector="div.swatch-option[option-label='{{opt}}']" parameterized="true"/>
1313
<element name="nthSwatchOption" type="button" selector="div.swatch-option:nth-of-type({{var}})" parameterized="true"/>
1414
<element name="selectedSwatchValue" type="text" selector="//div[contains(@class, 'swatch-attribute') and contains(., '{{attr}}')]//span[contains(@class, 'swatch-attribute-selected-option')]" parameterized="true"/>
1515
<element name="swatchAttributeOptions" type="text" selector="div.swatch-attribute-options"/>

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

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,16 +79,25 @@
7979
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="amOnProductGridPage"/>
8080
<waitForPageLoad time="30" stepKey="waitForProductGrid"/>
8181
<actionGroup ref="goToCreateProductPage" stepKey="goToCreateConfigurableProduct">
82-
<argument name="product" value="BaseConfigurableProduct"/>
82+
<argument name="product" value="ApiConfigurableProduct"/>
83+
</actionGroup>
84+
<!-- Add image to configurable product -->
85+
<actionGroup ref="addProductImage" stepKey="addFirstImageForProductConfigurable">
86+
<argument name="image" value="MagentoLogo"/>
87+
</actionGroup>
88+
<!-- Add image to configurable product -->
89+
<actionGroup ref="addProductImage" stepKey="addSecondImageForProductConfigurable">
90+
<argument name="image" value="TestImageNew"/>
8391
</actionGroup>
8492
<actionGroup ref="fillMainProductForm" stepKey="fillProductForm">
85-
<argument name="product" value="BaseConfigurableProduct"/>
93+
<argument name="product" value="ApiConfigurableProduct"/>
8694
</actionGroup>
8795
<searchAndMultiSelectOption selector="{{AdminProductFormSection.categoriesDropdown}}" parameterArray="[$$createCategory.name$$]" stepKey="fillCategory"/>
8896

8997
<!-- Create configurations based off the visual swatch we created earlier -->
90-
<actionGroup ref="createConfigurationsForAttribute" stepKey="createConfigurations">
98+
<actionGroup ref="createConfigurationsForAttributeWithImages" stepKey="createConfigurations">
9199
<argument name="attributeCode" value="{{ProductAttributeFrontendLabel.label}}"/>
100+
<argument name="image" value="TestImageAdobe"/>
92101
</actionGroup>
93102

94103
<!-- Go to the category page -->
@@ -111,7 +120,33 @@
111120

112121
<!-- Click a swatch and expect to see the configurable product, not see the simple product -->
113122
<click selector="{{StorefrontCategorySidebarSection.attributeNthOption(ProductAttributeFrontendLabel.label, '1')}}" stepKey="filterBySwatch1"/>
114-
<see selector="{{StorefrontCategoryMainSection.ProductItemInfo}}" userInput="{{BaseConfigurableProduct.name}}" stepKey="seeConfigurableProduct"/>
123+
<see selector="{{StorefrontCategoryMainSection.ProductItemInfo}}" userInput="{{ApiConfigurableProduct.name}}" stepKey="seeConfigurableProduct"/>
115124
<dontSee selector="{{StorefrontCategoryMainSection.ProductItemInfo}}" userInput="$$createSimpleProduct.name$$" stepKey="dontSeeSimpleProduct"/>
125+
126+
<!-- Assert configurable product in storefront product page -->
127+
<actionGroup ref="AssertProductInStorefrontProductPage" stepKey="AssertProductInStorefrontProductPage">
128+
<argument name="product" value="ApiConfigurableProduct"/>
129+
</actionGroup>
130+
131+
<!-- Assert configurable product image in storefront product page -->
132+
<actionGroup ref="assertProductImageStorefrontProductPage" stepKey="assertProductImageStorefrontProductPage">
133+
<argument name="product" value="ApiConfigurableProduct"/>
134+
<argument name="image" value="MagentoLogo"/>
135+
</actionGroup>
136+
137+
<!-- Assert configurable product image in storefront product page -->
138+
<actionGroup ref="assertProductImageStorefrontProductPage" stepKey="assertProductSecondImageStorefrontProductPage">
139+
<argument name="product" value="ApiConfigurableProduct"/>
140+
<argument name="image" value="TestImageNew"/>
141+
</actionGroup>
142+
143+
<!-- Click a swatch and expect to see the image from the swatch from the configurable product -->
144+
<click selector="{{StorefrontProductInfoMainSection.swatchOptionByLabel('adobe-thumb')}}" stepKey="clickSwatchOption"/>
145+
146+
<!-- Assert swatch option image for configurable product image in storefront product page -->
147+
<actionGroup ref="assertProductImageStorefrontProductPage" stepKey="assertSwatchImageStorefrontProductPage">
148+
<argument name="product" value="ApiConfigurableProduct"/>
149+
<argument name="image" value="TestImageAdobe"/>
150+
</actionGroup>
116151
</test>
117152
</tests>

0 commit comments

Comments
 (0)