Skip to content

Commit c74b0bb

Browse files
author
Joan He
committed
Merge remote-tracking branch 'trigger/MAGETWO-95588' into BugFixPR
2 parents 5f976fa + 71f7ab4 commit c74b0bb

File tree

3 files changed

+33
-2
lines changed

3 files changed

+33
-2
lines changed

app/code/Magento/Catalog/Test/Mftf/Section/AdminCreateProductAttributeSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,5 +75,6 @@
7575
<element name="Scope" type="select" selector="#is_global"/>
7676
<element name="AddToColumnOptions" type="select" selector="#is_used_in_grid"/>
7777
<element name="UseInFilterOptions" type="select" selector="#is_filterable_in_grid"/>
78+
<element name="UseInProductListing" type="select" selector="#used_in_product_listing"/>
7879
</section>
7980
</sections>

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

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,12 @@
1919
<group value="Swatches"/>
2020
</annotations>
2121
<before>
22+
<createData entity="ApiCategory" stepKey="createCategory"/>
2223
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
2324
</before>
2425
<after>
25-
<amOnPage url="admin/admin/auth/logout/" stepKey="amOnLogoutPage"/>
26+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
27+
<actionGroup ref="logout" stepKey="logout"/>
2628
</after>
2729

2830
<!-- Begin creating a new product attribute of type "Image Swatch" -->
@@ -67,6 +69,11 @@
6769
<click selector="{{AttributePropertiesSection.AdvancedProperties}}" stepKey="expandAdvancedProperties"/>
6870
<selectOption selector="{{AttributePropertiesSection.Scope}}" userInput="1" stepKey="selectGlobalScope"/>
6971

72+
<scrollToTopOfPage stepKey="scrollToTabs"/>
73+
<click selector="{{StorefrontPropertiesSection.StoreFrontPropertiesTab}}" stepKey="clickStorefrontPropertiesTab"/>
74+
<waitForElementVisible selector="{{AdvancedAttributePropertiesSection.UseInProductListing}}" stepKey="waitForTabSwitch"/>
75+
<selectOption selector="{{AdvancedAttributePropertiesSection.UseInProductListing}}" userInput="Yes" stepKey="useInProductListing"/>
76+
7077
<!-- Save the new product attribute -->
7178
<click selector="{{AttributePropertiesSection.SaveAndEdit}}" stepKey="clickSaveAndEdit1"/>
7279
<waitForElementVisible selector="{{AdminProductMessagesSection.successMessage}}" stepKey="waitForSuccess"/>
@@ -97,6 +104,7 @@
97104
<actionGroup ref="fillMainProductForm" stepKey="fillProductForm">
98105
<argument name="product" value="BaseConfigurableProduct"/>
99106
</actionGroup>
107+
<searchAndMultiSelectOption selector="{{AdminProductFormSection.categoriesDropdown}}" parameterArray="[$$createCategory.name$$]" stepKey="fillCategory"/>
100108

101109
<!-- Create configurations based off the Image Swatch we created earlier -->
102110
<click selector="{{AdminProductFormConfigurationsSection.createConfigurations}}" stepKey="clickCreateConfigurations"/>
@@ -134,5 +142,26 @@
134142
<expectedResult type="string">adobe-base</expectedResult>
135143
<actualResult type="string">{$grabSwatch6}</actualResult>
136144
</assertContains>
145+
146+
<!-- Go to the product listing page and see text swatch options -->
147+
<amOnPage url="$$createCategory.name$$.html" stepKey="goToCategoryPageStorefront"/>
148+
<waitForPageLoad stepKey="waitForProductListingPage"/>
149+
150+
<!-- Verify the storefront -->
151+
<grabAttributeFrom selector="{{StorefrontProductInfoMainSection.nthSwatchOption('1')}}" userInput="style" stepKey="grabSwatch7"/>
152+
<assertContains stepKey="assertSwatch7">
153+
<expectedResult type="string">adobe-thumb</expectedResult>
154+
<actualResult type="string">{$grabSwatch7}</actualResult>
155+
</assertContains>
156+
<grabAttributeFrom selector="{{StorefrontProductInfoMainSection.nthSwatchOption('2')}}" userInput="style" stepKey="grabSwatch8"/>
157+
<assertContains stepKey="assertSwatch8">
158+
<expectedResult type="string">adobe-small</expectedResult>
159+
<actualResult type="string">{$grabSwatch8}</actualResult>
160+
</assertContains>
161+
<grabAttributeFrom selector="{{StorefrontProductInfoMainSection.nthSwatchOption('3')}}" userInput="style" stepKey="grabSwatch9"/>
162+
<assertContains stepKey="assertSwatch9">
163+
<expectedResult type="string">adobe-base</expectedResult>
164+
<actualResult type="string">{$grabSwatch9}</actualResult>
165+
</assertContains>
137166
</test>
138167
</tests>

app/code/Magento/Swatches/view/frontend/templates/product/listing/renderer.phtml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ $productId = $block->getProduct()->getId();
2121
"numberToShow": <?= /* @escapeNotVerified */ $block->getNumberSwatchesPerProduct(); ?>,
2222
"jsonConfig": <?= /* @escapeNotVerified */ $block->getJsonConfig(); ?>,
2323
"jsonSwatchConfig": <?= /* @escapeNotVerified */ $block->getJsonSwatchConfig(); ?>,
24-
"mediaCallback": "<?= /* @escapeNotVerified */ $block->getMediaCallback() ?>"
24+
"mediaCallback": "<?= /* @escapeNotVerified */ $block->getMediaCallback() ?>",
25+
"jsonSwatchImageSizeConfig": <?= /* @noEscape */ $block->getJsonSwatchSizeConfig() ?>
2526
}
2627
}
2728
}

0 commit comments

Comments
 (0)