Skip to content

Commit e157797

Browse files
MacMac
authored andcommitted
Merge remote-tracking branch 'remotes/github/MAGETWO-96409' into EPAM-PR-28
2 parents 6e8e096 + 2b3fd68 commit e157797

File tree

5 files changed

+202
-3
lines changed

5 files changed

+202
-3
lines changed
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
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="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="AdminAttributeTextSwatchesCanBeFiledTest">
12+
<annotations>
13+
<features value="Backend"/>
14+
<stories value="Unable to add more attributes in size"/>
15+
<title value="Check that attribute text swatches can be filed"/>
16+
<description value="Check that attribute text swatches can be filed"/>
17+
<severity value="MAJOR"/>
18+
<testCaseId value="MAGETWO-96710"/>
19+
<useCaseId value="MAGETWO-96409"/>
20+
<group value="backend"/>
21+
<group value="ui"/>
22+
</annotations>
23+
<before>
24+
25+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
26+
27+
</before>
28+
<after>
29+
<!-- Delete all 10 store views -->
30+
<actionGroup ref="AdminDeleteStoreViewActionGroup" stepKey="deleteStoreView1">
31+
<argument name="customStore" value="customStore"/>
32+
</actionGroup>
33+
<actionGroup ref="AdminDeleteStoreViewActionGroup" stepKey="deleteStoreView2">
34+
<argument name="customStore" value="NewStoreViewData"/>
35+
</actionGroup>
36+
<actionGroup ref="AdminDeleteStoreViewActionGroup" stepKey="deleteStoreView3">
37+
<argument name="customStore" value="storeViewData"/>
38+
</actionGroup>
39+
<actionGroup ref="AdminDeleteStoreViewActionGroup" stepKey="deleteStoreView4">
40+
<argument name="customStore" value="storeViewData1"/>
41+
</actionGroup>
42+
<actionGroup ref="AdminDeleteStoreViewActionGroup" stepKey="deleteStoreView5">
43+
<argument name="customStore" value="storeViewData2"/>
44+
</actionGroup>
45+
<actionGroup ref="AdminDeleteStoreViewActionGroup" stepKey="deleteStoreView6">
46+
<argument name="customStore" value="storeViewData3"/>
47+
</actionGroup>
48+
<actionGroup ref="AdminDeleteStoreViewActionGroup" stepKey="deleteStoreView7">
49+
<argument name="customStore" value="storeViewData4"/>
50+
</actionGroup>
51+
<actionGroup ref="AdminDeleteStoreViewActionGroup" stepKey="deleteStoreView8">
52+
<argument name="customStore" value="storeViewData5"/>
53+
</actionGroup>
54+
<actionGroup ref="AdminDeleteStoreViewActionGroup" stepKey="deleteStoreView9">
55+
<argument name="customStore" value="storeViewData6"/>
56+
</actionGroup>
57+
<actionGroup ref="AdminDeleteStoreViewActionGroup" stepKey="deleteStoreView10">
58+
<argument name="customStore" value="storeViewData7"/>
59+
</actionGroup>
60+
61+
<actionGroup ref="logout" stepKey="logout"/>
62+
</after>
63+
64+
<!-- Create 10 store views -->
65+
<actionGroup ref="AdminCreateStoreViewActionGroup" stepKey="createStoreView1">
66+
<argument name="customStore" value="customStore"/>
67+
</actionGroup>
68+
<actionGroup ref="AdminCreateStoreViewActionGroup" stepKey="createStoreView2">
69+
<argument name="customStore" value="NewStoreViewData"/>
70+
</actionGroup>
71+
<actionGroup ref="AdminCreateStoreViewActionGroup" stepKey="createStoreView3">
72+
<argument name="customStore" value="storeViewData"/>
73+
</actionGroup>
74+
<actionGroup ref="AdminCreateStoreViewActionGroup" stepKey="createStoreView4">
75+
<argument name="customStore" value="storeViewData1"/>
76+
</actionGroup>
77+
<actionGroup ref="AdminCreateStoreViewActionGroup" stepKey="createStoreView5">
78+
<argument name="customStore" value="storeViewData2"/>
79+
</actionGroup>
80+
<actionGroup ref="AdminCreateStoreViewActionGroup" stepKey="createStoreView6">
81+
<argument name="customStore" value="storeViewData3"/>
82+
</actionGroup>
83+
<actionGroup ref="AdminCreateStoreViewActionGroup" stepKey="createStoreView7">
84+
<argument name="customStore" value="storeViewData4"/>
85+
</actionGroup>
86+
<actionGroup ref="AdminCreateStoreViewActionGroup" stepKey="createStoreView8">
87+
<argument name="customStore" value="storeViewData5"/>
88+
</actionGroup>
89+
<actionGroup ref="AdminCreateStoreViewActionGroup" stepKey="createStoreView9">
90+
<argument name="customStore" value="storeViewData6"/>
91+
</actionGroup>
92+
<actionGroup ref="AdminCreateStoreViewActionGroup" stepKey="createStoreView10">
93+
<argument name="customStore" value="storeViewData7"/>
94+
</actionGroup>
95+
96+
<!--Navigate to Product attribute page-->
97+
<amOnPage url="{{ProductAttributePage.url}}" stepKey="navigateToNewProductAttributePage"/>
98+
<waitForPageLoad stepKey="waitForPageLoad"/>
99+
<fillField userInput="test_label" selector="{{AttributePropertiesSection.DefaultLabel}}" stepKey="fillDefaultLabel"/>
100+
<selectOption selector="{{AttributePropertiesSection.InputType}}" userInput="Text Swatch" stepKey="selectInputType"/>
101+
<click selector="{{AttributePropertiesSection.addSwatch}}" stepKey="clickAddSwatch"/>
102+
<waitForAjaxLoad stepKey="waitForAjaxLoad"/>
103+
104+
<!-- Fill Swatch and Description fields for Admin -->
105+
<fillField selector="{{AttributeManageSwatchSection.swatchField('Admin')}}" userInput="test" stepKey="fillSwatchForAdmin"/>
106+
<fillField selector="{{AttributeManageSwatchSection.descriptionField('Admin')}}" userInput="test" stepKey="fillDescriptionForAdmin"/>
107+
108+
<!-- Grab value Swatch and Description fields for Admin -->
109+
<grabValueFrom selector="{{AttributeManageSwatchSection.swatchField('Admin')}}" stepKey="grabSwatchForAdmin"/>
110+
<grabValueFrom selector="{{AttributeManageSwatchSection.descriptionField('Admin')}}" stepKey="grabDescriptionForAdmin"/>
111+
112+
<!-- Check that Swatch and Description fields for Admin are not empty-->
113+
<assertNotEmpty actual="$grabSwatchForAdmin" stepKey="checkSwatchFieldForAdmin"/>
114+
<assertNotEmpty actual="$grabDescriptionForAdmin" stepKey="checkDescriptionFieldForAdmin"/>
115+
</test>
116+
</tests>

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@
2222
<element name="TinyMCE4" type="button" selector="//span[text()='Default Value']/parent::label/following-sibling::div//div[@class='mce-branding-powered-by']"/>
2323
<element name="checkIfTabOpen" selector="//div[@id='advanced_fieldset-wrapper' and not(contains(@class,'opened'))]" type="button"/>
2424
<element name="useInLayeredNavigation" type="select" selector="#is_filterable"/>
25+
<element name="addSwatch" type="button" selector="#add_new_swatch_text_option_button"/>
26+
</section>
27+
<section name="AttributeManageSwatchSection">
28+
<element name="swatchField" type="input" selector="//th[contains(@class, 'col-swatch')]/span[contains(text(), '{{arg}}')]/ancestor::thead/following-sibling::tbody//input[@placeholder='Swatch']" parameterized="true"/>
29+
<element name="descriptionField" type="input" selector="//th[contains(@class, 'col-swatch')]/span[contains(text(), '{{arg}}')]/ancestor::thead/following-sibling::tbody//input[@placeholder='Description']" parameterized="true"/>
2530
</section>
2631
<section name="AttributeOptionsSection">
2732
<element name="AddOption" type="button" selector="#add_new_option_button"/>

app/code/Magento/Store/Test/Mftf/Data/StoreData.xml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,80 @@
6565
<data key="name" unique="suffix">StoreView</data>
6666
<data key="code" unique="suffix">StoreViewCode</data>
6767
</entity>
68+
69+
<!-- For creation 10 Store Views-->
70+
<entity name="storeViewData" type="store">
71+
<data key="group_id">1</data>
72+
<data key="name" unique="suffix">storeView</data>
73+
<data key="code" unique="suffix">storeView</data>
74+
<data key="is_active">1</data>
75+
<data key="store_id">null</data>
76+
<data key="store_type">store</data>
77+
<data key="store_action">add</data>
78+
</entity>
79+
<entity name="storeViewData1" type="store">
80+
<data key="group_id">1</data>
81+
<data key="name" unique="suffix">storeView</data>
82+
<data key="code" unique="suffix">storeView</data>
83+
<data key="is_active">1</data>
84+
<data key="store_id">null</data>
85+
<data key="store_type">store</data>
86+
<data key="store_action">add</data>
87+
</entity>
88+
<entity name="storeViewData2" type="store">
89+
<data key="group_id">1</data>
90+
<data key="name" unique="suffix">storeView</data>
91+
<data key="code" unique="suffix">storeView</data>
92+
<data key="is_active">1</data>
93+
<data key="store_id">null</data>
94+
<data key="store_type">store</data>
95+
<data key="store_action">add</data>
96+
</entity>
97+
<entity name="storeViewData3" type="store">
98+
<data key="group_id">1</data>
99+
<data key="name" unique="suffix">storeView</data>
100+
<data key="code" unique="suffix">storeView</data>
101+
<data key="is_active">1</data>
102+
<data key="store_id">null</data>
103+
<data key="store_type">store</data>
104+
<data key="store_action">add</data>
105+
</entity>
106+
<entity name="storeViewData4" type="store">
107+
<data key="group_id">1</data>
108+
<data key="name" unique="suffix">storeView</data>
109+
<data key="code" unique="suffix">storeView</data>
110+
<data key="is_active">1</data>
111+
<data key="store_id">null</data>
112+
<data key="store_type">store</data>
113+
<data key="store_action">add</data>
114+
</entity>
115+
<entity name="storeViewData5" type="store">
116+
<data key="group_id">1</data>
117+
<data key="name" unique="suffix">storeView</data>
118+
<data key="code" unique="suffix">storeView</data>
119+
<data key="is_active">1</data>
120+
<data key="store_id">null</data>
121+
<data key="store_type">store</data>
122+
<data key="store_action">add</data>
123+
</entity>
124+
<entity name="storeViewData6" type="store">
125+
<data key="group_id">1</data>
126+
<data key="name" unique="suffix">storeView</data>
127+
<data key="code" unique="suffix">storeView</data>
128+
<data key="is_active">1</data>
129+
<data key="store_id">null</data>
130+
<data key="store_type">store</data>
131+
<data key="store_action">add</data>
132+
</entity>
133+
<entity name="storeViewData7" type="store">
134+
<data key="group_id">1</data>
135+
<data key="name" unique="suffix">storeView</data>
136+
<data key="code" unique="suffix">storeView</data>
137+
<data key="is_active">1</data>
138+
<data key="store_id">null</data>
139+
<data key="store_type">store</data>
140+
<data key="store_action">add</data>
141+
</entity>
68142
<entity name="SecondStoreUnique" type="store">
69143
<data key="name" unique="suffix">Second Store View </data>
70144
<data key="code" unique="suffix">second_store_view_</data>

app/code/Magento/Swatches/view/adminhtml/templates/catalog/product/attribute/text.phtml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ $stores = $block->getStoresSortedBySortOrder();
2121
<th class="col-draggable"></th>
2222
<th class="col-default"><span><?= $block->escapeHtml(__('Is Default')) ?></span></th>
2323
<?php foreach ($stores as $_store): ?>
24-
<th class="col-swatch col-<%- data.id %>
24+
<th class="col-swatch col-swatch-min-width col-<%- data.id %>
2525
<?php if ($_store->getId() == \Magento\Store\Model\Store::DEFAULT_STORE_ID): ?> _required<?php endif; ?>"
2626
colspan="2">
2727
<span><?= $block->escapeHtml($_store->getName()) ?></span>
@@ -75,15 +75,15 @@ $stores = $block->getStoresSortedBySortOrder();
7575
</td>
7676
<?php foreach ($stores as $_store): ?>
7777
<?php $storeId = (int)$_store->getId(); ?>
78-
<td class="col-swatch col-<%- data.id %>">
78+
<td class="col-swatch col-swatch-min-width col-<%- data.id %>">
7979
<input class="input-text
8080
swatch-text-field-<?= /* @noEscape */ $storeId ?>
8181
<?php if ($storeId == \Magento\Store\Model\Store::DEFAULT_STORE_ID): ?> required-option required-unique<?php endif; ?>"
8282
name="swatchtext[value][<%- data.id %>][<?= /* @noEscape */ $storeId ?>]"
8383
type="text" value="<%- data.swatch<?= /* @noEscape */ $storeId ?> %>"
8484
placeholder="<?= $block->escapeHtml(__("Swatch")) ?>"/>
8585
</td>
86-
<td class="swatch-col-<%- data.id %>">
86+
<td class="col-swatch-min-width swatch-col-<%- data.id %>">
8787
<input name="optiontext[value][<%- data.id %>][<?= /* @noEscape */ $storeId ?>]"
8888
value="<%- data.store<?= /* @noEscape */ $storeId ?> %>"
8989
class="input-text<?php if ($storeId == \Magento\Store\Model\Store::DEFAULT_STORE_ID): ?> required-option<?php endif; ?>"

app/code/Magento/Swatches/view/adminhtml/web/css/swatches.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,10 @@
149149
width: 50px;
150150
}
151151

152+
.col-swatch-min-width {
153+
min-width: 30px;
154+
}
155+
152156
.swatches-visual-col.unavailable:after {
153157
content: '';
154158
position: absolute;

0 commit comments

Comments
 (0)