Skip to content

Commit 16c01dc

Browse files
committed
Merge branch 'MC-3080' into RE-develop
2 parents d9693e0 + ecf72b8 commit 16c01dc

File tree

6 files changed

+170
-2
lines changed

6 files changed

+170
-2
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<element name="AdvancedProperties" type="button" selector="#advanced_fieldset-wrapper"/>
1616
<element name="DefaultValue" type="input" selector="#default_value_text"/>
1717
<element name="Save" type="button" selector="#save"/>
18-
<element name="SaveAndEdit" type="button" selector="#save_and_edit_button"/>
18+
<element name="SaveAndEdit" type="button" selector="#save_and_edit_button" timeout="30"/>
1919
<element name="TinyMCE4" type="button" selector="//span[text()='Default Value']/parent::label/following-sibling::div//div[@class='mce-branding-powered-by']"/>
2020
<element name="checkIfTabOpen" selector="//div[@id='advanced_fieldset-wrapper' and not(contains(@class,'opened'))]" type="button"/>
2121
</section>

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@
99
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd">
1111
<section name="AdminProductAttributeGridSection">
12-
<element name="AttributeCode" type="text" selector="//td[contains(text(),'{{var1}}')]" parameterized="true"/>
12+
<element name="AttributeCode" type="text" selector="//td[contains(text(),'{{var1}}')]" parameterized="true" timeout="30"/>
1313
<element name="createNewAttributeBtn" type="button" selector="button[data-index='add_new_attribute_button']"/>
1414
<element name="GridFilterFrontEndLabel" type="input" selector="#attributeGrid_filter_frontend_label"/>
1515
<element name="Search" type="button" selector="button[data-action=grid-filter-apply]" timeout="30"/>
1616
<element name="ResetFilter" type="button" selector="button[data-action='grid-filter-reset']" timeout="30"/>
1717
<element name="FirstRow" type="button" selector="//*[@id='attributeGrid_table']/tbody/tr[1]"/>
18+
<element name="FilterByAttributeCode" type="input" selector="#attributeGrid_filter_attribute_code"/>
1819
</section>
1920
</sections>
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="setColorPickerByHex">
12+
<arguments>
13+
<argument name="nthColorPicker" type="string" defaultValue="1"/>
14+
<argument name="hexColor" type="string" defaultValue="e74c3c"/>
15+
</arguments>
16+
<!-- This 6x backspace stuff is some magic that is necessary to interact with this field correctly -->
17+
<pressKey selector="{{AdminColorPickerSection.hexByIndex(nthColorPicker)}}" parameterArray="[\Facebook\WebDriver\WebDriverKeys::BACKSPACE,\Facebook\WebDriver\WebDriverKeys::BACKSPACE,\Facebook\WebDriver\WebDriverKeys::BACKSPACE,\Facebook\WebDriver\WebDriverKeys::BACKSPACE,\Facebook\WebDriver\WebDriverKeys::BACKSPACE,\Facebook\WebDriver\WebDriverKeys::BACKSPACE,'{{hexColor}}']" stepKey="fillHex1"/>
18+
<click selector="{{AdminColorPickerSection.submitByIndex(nthColorPicker)}}" stepKey="submitColor1"/>
19+
</actionGroup>
20+
<actionGroup name="assertSwatchColor">
21+
<arguments>
22+
<argument name="nthSwatch" type="string" defaultValue="1"/>
23+
<argument name="expectedStyle" type="string" defaultValue="background: rgb(0, 0, 0);"/>
24+
</arguments>
25+
<grabAttributeFrom selector="{{AdminManageSwatchSection.nthSwatch(nthSwatch)}}" userInput="style" stepKey="grabStyle1"/>
26+
<assertEquals stepKey="assertStyle1">
27+
<actualResult type="string">{$grabStyle1}</actualResult>
28+
<expectedResult type="string">{{expectedStyle}}</expectedResult>
29+
</assertEquals>
30+
</actionGroup>
31+
<actionGroup name="openSwatchMenuByIndex">
32+
<arguments>
33+
<argument name="index" type="string" defaultValue="0"/>
34+
</arguments>
35+
<!-- I had to use executeJS to perform the click to get around the use of CSS ::before and ::after -->
36+
<executeJS function="jQuery('#swatch_window_option_option_{{index}}').click()" stepKey="clickSwatch1"/>
37+
</actionGroup>
38+
</actionGroups>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd">
11+
<section name="AdminColorPickerSection">
12+
<element name="hexByIndex" type="input" selector="//div[@class='colorpicker'][{{var}}]/div[@class='colorpicker_hex']/input" parameterized="true"/>
13+
<element name="submitByIndex" type="button" selector="//div[@class='colorpicker'][{{var}}]/div[@class='colorpicker_submit']" parameterized="true"/>
14+
</section>
15+
</sections>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd">
11+
<section name="AdminManageSwatchSection">
12+
<element name="adminInputByIndex" type="input" selector="optionvisual[value][option_{{var}}][0]" parameterized="true"/>
13+
<element name="addSwatch" type="button" selector="#add_new_swatch_visual_option_button" timeout="30"/>
14+
<element name="nthSwatch" type="button" selector="#swatch-visual-options-panel table tbody tr:nth-of-type({{var}}) .swatch_window" parameterized="true"/>
15+
<element name="nthChooseColor" type="button" selector="#swatch-visual-options-panel table tbody tr:nth-of-type({{var}}) .swatch_row_name.colorpicker_handler" parameterized="true"/>
16+
<element name="nthDelete" type="button" selector="#swatch-visual-options-panel table tbody tr:nth-of-type({{var}}) button.delete-option" parameterized="true"/>
17+
</section>
18+
</sections>
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd">
11+
<test name="AdminConfigureSwatchesTest">
12+
<annotations>
13+
<features value="Swatches"/>
14+
<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"/>
17+
<severity value="CRITICAL"/>
18+
<testCaseId value="MC-3080"/>
19+
<group value="Swatches"/>
20+
</annotations>
21+
<before>
22+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
23+
</before>
24+
<after>
25+
<click selector="{{AdminManageSwatchSection.nthDelete('1')}}" stepKey="deleteSwatch1"/>
26+
<click selector="{{AdminManageSwatchSection.nthDelete('2')}}" stepKey="deleteSwatch2"/>
27+
<click selector="{{AdminManageSwatchSection.nthDelete('3')}}" stepKey="deleteSwatch3"/>
28+
<waitForPageLoad stepKey="waitToClickSave2"/>
29+
<click selector="{{AttributePropertiesSection.SaveAndEdit}}" stepKey="clickSaveAndEdit2"/>
30+
<amOnPage url="admin/admin/auth/logout/" stepKey="amOnLogoutPage"/>
31+
</after>
32+
33+
<!-- Go to the edit page for the "color" attribute -->
34+
<amOnPage url="{{AdminProductAttributeGridPage.url}}" stepKey="goToProductAttributes"/>
35+
<waitForPageLoad stepKey="waitForProductAttributes"/>
36+
<fillField selector="{{AdminProductAttributeGridSection.FilterByAttributeCode}}" userInput="color" stepKey="fillFilter"/>
37+
<click selector="{{AdminProductAttributeGridSection.Search}}" stepKey="clickSearch"/>
38+
<click selector="{{AdminProductAttributeGridSection.AttributeCode('color')}}" stepKey="clickRowToEdit"/>
39+
40+
<!-- Change to visual swatches -->
41+
<selectOption selector="{{AdminNewAttributePanel.inputType}}" userInput="swatch_visual" stepKey="selectVisualSwatch"/>
42+
43+
<!-- Set swatch #1 using the color picker -->
44+
<click selector="{{AdminManageSwatchSection.addSwatch}}" stepKey="clickAddSwatch1"/>
45+
<actionGroup ref="openSwatchMenuByIndex" stepKey="clickSwatch1">
46+
<argument name="index" value="0"/>
47+
</actionGroup>
48+
<click selector="{{AdminManageSwatchSection.nthChooseColor('1')}}" stepKey="clickChooseColor1"/>
49+
<actionGroup ref="setColorPickerByHex" stepKey="fillHex1">
50+
<argument name="nthColorPicker" value="1"/>
51+
<argument name="hexColor" value="e74c3c"/>
52+
</actionGroup>
53+
<fillField selector="{{AdminManageSwatchSection.adminInputByIndex('0')}}" userInput="red" stepKey="fillAdmin1"/>
54+
<!-- Set swatch #2 using the color picker -->
55+
<click selector="{{AdminManageSwatchSection.addSwatch}}" stepKey="clickAddSwatch2"/>
56+
<actionGroup ref="openSwatchMenuByIndex" stepKey="clickSwatch2">
57+
<argument name="index" value="1"/>
58+
</actionGroup>
59+
<click selector="{{AdminManageSwatchSection.nthChooseColor('2')}}" stepKey="clickChooseColor2"/>
60+
<actionGroup ref="setColorPickerByHex" stepKey="fillHex2">
61+
<argument name="nthColorPicker" value="2"/>
62+
<argument name="hexColor" value="2ecc71"/>
63+
</actionGroup>
64+
<fillField selector="{{AdminManageSwatchSection.adminInputByIndex('1')}}" userInput="green" stepKey="fillAdmin2"/>
65+
<!-- Set swatch #3 using the color picker -->
66+
<click selector="{{AdminManageSwatchSection.addSwatch}}" stepKey="clickAddSwatch3"/>
67+
<actionGroup ref="openSwatchMenuByIndex" stepKey="clickSwatch3">
68+
<argument name="index" value="2"/>
69+
</actionGroup>
70+
<click selector="{{AdminManageSwatchSection.nthChooseColor('3')}}" stepKey="clickChooseColor3"/>
71+
<actionGroup ref="setColorPickerByHex" stepKey="fillHex3">
72+
<argument name="nthColorPicker" value="3"/>
73+
<argument name="hexColor" value="3498db"/>
74+
</actionGroup>
75+
<fillField selector="{{AdminManageSwatchSection.adminInputByIndex('2')}}" userInput="blue" stepKey="fillAdmin3"/>
76+
<waitForPageLoad stepKey="waitToClickSave"/>
77+
78+
<!-- Save -->
79+
<click selector="{{AttributePropertiesSection.SaveAndEdit}}" stepKey="clickSaveAndEdit1"/>
80+
<waitForElementVisible selector="{{AdminProductMessagesSection.successMessage}}" stepKey="waitForSuccess"/>
81+
82+
<!-- Assert that the Save was successful after round trip to server -->
83+
<actionGroup ref="assertSwatchColor" stepKey="assertSwatch1">
84+
<argument name="nthSwatch" value="1"/>
85+
<argument name="expectedStyle" value="background: rgb(231, 77, 60);"/>
86+
</actionGroup>
87+
<actionGroup ref="assertSwatchColor" stepKey="assertSwatch2">
88+
<argument name="nthSwatch" value="2"/>
89+
<argument name="expectedStyle" value="background: rgb(46, 204, 112);"/>
90+
</actionGroup>
91+
<actionGroup ref="assertSwatchColor" stepKey="assertSwatch3">
92+
<argument name="nthSwatch" value="3"/>
93+
<argument name="expectedStyle" value="background: rgb(52, 152, 219);"/>
94+
</actionGroup>
95+
</test>
96+
</tests>

0 commit comments

Comments
 (0)