Skip to content

Commit 509b977

Browse files
committed
Merge branch 'MC-3080-2' into RE-develop
2 parents f6f51dd + bf66499 commit 509b977

File tree

3 files changed

+67
-4
lines changed

3 files changed

+67
-4
lines changed

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,17 @@
2828
<expectedResult type="string">{{expectedStyle}}</expectedResult>
2929
</assertEquals>
3030
</actionGroup>
31+
<actionGroup name="assertStorefrontSwatchColor">
32+
<arguments>
33+
<argument name="nthSwatch" type="string" defaultValue="1"/>
34+
<argument name="expectedRgb" type="string" defaultValue="rgb(231, 77, 60)"/>
35+
</arguments>
36+
<grabAttributeFrom selector="{{StorefrontProductInfoMainSection.nthSwatchOption(nthSwatch)}}" userInput="style" stepKey="grabStyle1"/>
37+
<assertEquals stepKey="assertStyle1">
38+
<actualResult type="string">{$grabStyle1}</actualResult>
39+
<expectedResult type="string">background: center center no-repeat {{expectedRgb}};</expectedResult>
40+
</assertEquals>
41+
</actionGroup>
3142
<actionGroup name="openSwatchMenuByIndex">
3243
<arguments>
3344
<argument name="index" type="string" defaultValue="0"/>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd">
1111
<section name="StorefrontProductInfoMainSection">
1212
<element name="swatchOptionByLabel" type="button" selector="div.swatch-option[option-label={{opt}}]" parameterized="true"/>
13+
<element name="nthSwatchOption" type="button" selector="div.swatch-option:nth-of-type({{var}})" parameterized="true"/>
1314
<element name="selectedSwatchValue" type="text" selector="//div[contains(@class, 'swatch-attribute') and contains(., '{{attr}}')]//span[contains(@class, 'swatch-attribute-selected-option')]" parameterized="true"/>
1415
<element name="swatchAttributeOptions" type="text" selector="div.swatch-attribute-options"/>
1516
<element name="nthSwatchOptionText" type="button" selector="div.swatch-option.text:nth-of-type({{n}})" parameterized="true"/>

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

Lines changed: 55 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
<annotations>
1313
<features value="Swatches"/>
1414
<stories value="Create/configure swatches"/>
15-
<title value="Admin can configure swatches display in configuration"/>
16-
<description value="Admin can configure swatches display in configuration"/>
15+
<title value="Admin can create product attribute with picked color swatch"/>
16+
<description value="Admin can create product attribute with picked color swatch"/>
1717
<severity value="CRITICAL"/>
1818
<testCaseId value="MC-3080"/>
1919
<group value="Swatches"/>
@@ -22,11 +22,18 @@
2222
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
2323
</before>
2424
<after>
25+
<!-- Clean up our modifications to the existing color attribute -->
26+
<amOnPage url="{{AdminProductAttributeGridPage.url}}" stepKey="goToProductAttributes"/>
27+
<waitForPageLoad stepKey="waitForProductAttributes"/>
28+
<fillField selector="{{AdminProductAttributeGridSection.FilterByAttributeCode}}" userInput="color" stepKey="fillFilter"/>
29+
<click selector="{{AdminProductAttributeGridSection.Search}}" stepKey="clickSearch"/>
30+
<click selector="{{AdminProductAttributeGridSection.AttributeCode('color')}}" stepKey="clickRowToEdit"/>
2531
<click selector="{{AdminManageSwatchSection.nthDelete('1')}}" stepKey="deleteSwatch1"/>
2632
<click selector="{{AdminManageSwatchSection.nthDelete('2')}}" stepKey="deleteSwatch2"/>
2733
<click selector="{{AdminManageSwatchSection.nthDelete('3')}}" stepKey="deleteSwatch3"/>
28-
<waitForPageLoad stepKey="waitToClickSave2"/>
29-
<click selector="{{AttributePropertiesSection.SaveAndEdit}}" stepKey="clickSaveAndEdit2"/>
34+
<waitForPageLoad stepKey="waitToClickSave"/>
35+
<click selector="{{AttributePropertiesSection.SaveAndEdit}}" stepKey="clickSaveAndEdit"/>
36+
<!-- Logout -->
3037
<amOnPage url="admin/admin/auth/logout/" stepKey="amOnLogoutPage"/>
3138
</after>
3239

@@ -92,5 +99,49 @@
9299
<argument name="nthSwatch" value="3"/>
93100
<argument name="expectedStyle" value="background: rgb(52, 152, 219);"/>
94101
</actionGroup>
102+
103+
<!-- Create a configurable product to verify the storefront with -->
104+
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="amOnProductGridPage"/>
105+
<waitForPageLoad time="30" stepKey="waitForProductGrid"/>
106+
<actionGroup ref="goToCreateProductPage" stepKey="goToCreateConfigurableProduct">
107+
<argument name="product" value="BaseConfigurableProduct"/>
108+
</actionGroup>
109+
<actionGroup ref="fillMainProductForm" stepKey="fillProductForm">
110+
<argument name="product" value="BaseConfigurableProduct"/>
111+
</actionGroup>
112+
<click selector="{{AdminProductSEOSection.sectionHeader}}" stepKey="openSeoSection"/>
113+
<fillField userInput="{{_defaultProduct.urlKey}}" selector="{{AdminProductSEOSection.urlKeyInput}}" stepKey="fillUrlKey"/>
114+
<!-- Create configurations based off the Text Swatch we created earlier -->
115+
<click selector="{{AdminProductFormConfigurationsSection.createConfigurations}}" stepKey="clickCreateConfigurations"/>
116+
<click selector="{{AdminCreateProductConfigurationsPanel.filters}}" stepKey="clickFilters"/>
117+
<fillField selector="{{AdminCreateProductConfigurationsPanel.attributeCode}}" userInput="color" stepKey="fillFilterAttributeCodeField"/>
118+
<click selector="{{AdminCreateProductConfigurationsPanel.applyFilters}}" stepKey="clickApplyFiltersButton"/>
119+
<click selector="{{AdminCreateProductConfigurationsPanel.firstCheckbox}}" stepKey="clickOnFirstCheckbox"/>
120+
<click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton1"/>
121+
<click selector="{{AdminCreateProductConfigurationsPanel.selectAll}}" stepKey="clickOnSelectAll"/>
122+
<click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton2"/>
123+
<click selector="{{AdminCreateProductConfigurationsPanel.applySingleQuantityToEachSkus}}" stepKey="clickOnApplySingleQuantityToEachSku"/>
124+
<fillField selector="{{AdminCreateProductConfigurationsPanel.quantity}}" userInput="1" stepKey="enterAttributeQuantity"/>
125+
<click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton3"/>
126+
<click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton4"/>
127+
<click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickOnSaveButton2"/>
128+
129+
<!-- Go to the product page and see text swatch options -->
130+
<amOnPage url="{{_defaultProduct.urlKey}}.html" stepKey="amOnProductPage"/>
131+
<waitForPageLoad stepKey="waitForProductPage"/>
132+
133+
<!-- Verify that the storefront shows the swatches too -->
134+
<actionGroup ref="assertStorefrontSwatchColor" stepKey="assertSwatch4">
135+
<argument name="nthSwatch" value="1"/>
136+
<argument name="expectedRgb" value="rgb(231, 77, 60)"/>
137+
</actionGroup>
138+
<actionGroup ref="assertStorefrontSwatchColor" stepKey="assertSwatch5">
139+
<argument name="nthSwatch" value="2"/>
140+
<argument name="expectedRgb" value="rgb(46, 204, 112)"/>
141+
</actionGroup>
142+
<actionGroup ref="assertStorefrontSwatchColor" stepKey="assertSwatch6">
143+
<argument name="nthSwatch" value="3"/>
144+
<argument name="expectedRgb" value="rgb(52, 152, 219)"/>
145+
</actionGroup>
95146
</test>
96147
</tests>

0 commit comments

Comments
 (0)