Skip to content

Commit ef12d51

Browse files
committed
Merge remote-tracking branch 'upstream/2.3.0-release' into MAGETWO-95002
2 parents a4393aa + 63d01ca commit ef12d51

File tree

39 files changed

+588
-180
lines changed

39 files changed

+588
-180
lines changed

app/code/Magento/Backend/view/adminhtml/web/js/validate-store.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ define([
6767
* 'Confirm' action handler.
6868
*/
6969
confirm: function () {
70+
$('body').trigger('processStart');
7071
dataPost().postData(requestData);
7172
}
7273
}

app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductAttributeActionGroup.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,11 @@
2020
<click selector="{{AdminProductAttributeGridSection.FirstRow}}" stepKey="clickOnAttributeRow"/>
2121
<waitForPageLoad stepKey="waitForPageLoad2" />
2222
</actionGroup>
23+
<actionGroup name="deleteProductAttribute" extends="navigateToCreatedProductAttribute">
24+
<click selector="{{AttributePropertiesSection.DeleteAttribute}}" stepKey="deleteAttribute"/>
25+
<click selector="{{ModalConfirmationSection.OkButton}}" stepKey="ClickOnDeleteButton"/>
26+
<waitForPageLoad stepKey="waitForPageLoad"/>
27+
<seeElement selector="{{AdminProductMessagesSection.successMessage}}"
28+
stepKey="waitForSuccessMessage"/>
29+
</actionGroup>
2330
</actionGroups>

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,13 @@
3232
<element name="DesignTab" type="button" selector="//strong[@class='admin__collapsible-title']//span[text()='Design']"/>
3333
<element name="LayoutDropdown" type="select" selector="select[name='page_layout']"/>
3434
</section>
35+
<section name="CategoryDisplaySettingsSection">
36+
<element name="DisplaySettingTab" type="button" selector="//strong[@class='admin__collapsible-title']//span[text()='Display Settings']"/>
37+
<element name="layeredNavigationPriceInput" type="input" selector="input[name='filter_price_range']"/>
38+
<element name="FieldError" type="text" selector=".admin__field-error[data-bind='attr: {for: {{field}}}, text: error']" parameterized="true"/>
39+
<element name="filterPriceRangeUseConfig" type="checkbox" selector="input[name='use_config[filter_price_range]']"/>
40+
<element name="RequiredFieldIndicator" type="text" selector=" return window.getComputedStyle(document.querySelector('._required[data-index={{arg1}}]&gt;.admin__field-label span'), ':after').getPropertyValue('content');" parameterized="true"/>
41+
</section>
3542
<section name="CatalogWYSIWYGSection">
3643
<element name="ShowHideBtn" type="button" selector="#togglecategory_form_description"/>
3744
<element name="TinyMCE4" type="text" selector=".mce-branding-powered-by"/>

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
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"/>
2525
</section>
26+
<section name="AttributeOptionsSection">
27+
<element name="AddOption" type="button" selector="#add_new_option_button"/>
28+
</section>
2629
<section name="StorefrontPropertiesSection">
2730
<element name="PageTitle" type="text" selector="//span[text()='Storefront Properties']" />
2831
<element name="StoreFrontPropertiesTab" selector="#product_attribute_tabs_front" type="button"/>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
10+
<section name="DropdownAttributeOptionsSection">
11+
<element name="nthOptionAdminLabel" type="input"
12+
selector="(//*[@id='manage-options-panel']//tr[{{var}}]//input[contains(@name, 'option[value]')])[1]" parameterized="true"/>
13+
</section>
14+
</sections>

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@
5050
<conditionalClick selector="{{ProductDescriptionWYSIWYGToolbarSection.WysiwygArrow}}" dependentSelector="{{ProductDescriptionWYSIWYGToolbarSection.checkIfWysiwygArrowExpand}}" stepKey="clickWysiwygArrowIfClosed" visible="true"/>
5151
<waitForText userInput="{{ImageFolder.name}}" stepKey="waitForNewFolder1" />
5252
<click userInput="{{ImageFolder.name}}" stepKey="clickOnCreatedFolder1" />
53-
<waitForLoadingMaskToDisappear stepKey="waitForLoading4" />
53+
<waitForLoadingMaskToDisappear stepKey="waitForLoading4" timeout="45"/>
5454
<attachFile selector="{{ProductDescriptionWYSIWYGToolbarSection.BrowseUploadImage}}" userInput="{{ImageUpload1.value}}" stepKey="uploadImage1"/>
55-
<waitForLoadingMaskToDisappear stepKey="waitForFileUpload1" />
55+
<waitForLoadingMaskToDisappear stepKey="waitForFileUpload1" timeout="30"/>
5656
<waitForElementVisible selector="{{ProductDescriptionWYSIWYGToolbarSection.image(ImageUpload1.value)}}" stepKey="waitForUploadImage1" />
5757
<seeElement selector="{{ProductDescriptionWYSIWYGToolbarSection.imageSelected(ImageUpload1.value)}}" stepKey="seeImageSelected1" />
5858
<see selector="{{ProductDescriptionWYSIWYGToolbarSection.DeleteSelectedBtn}}" userInput="Delete Selected" stepKey="seeDeleteBtn1"/>
@@ -63,7 +63,7 @@
6363
<dontSeeElement selector="{{ProductDescriptionWYSIWYGToolbarSection.image(ImageUpload1.value)}}" stepKey="dontSeeImage1" />
6464
<dontSeeElement selector="{{ProductDescriptionWYSIWYGToolbarSection.InsertFile}}" stepKey="dontSeeAddSelectedBtn2" />
6565
<attachFile selector="{{ProductDescriptionWYSIWYGToolbarSection.BrowseUploadImage}}" userInput="{{ImageUpload1.value}}" stepKey="uploadImage2"/>
66-
<waitForLoadingMaskToDisappear stepKey="waitForFileUpload2" />
66+
<waitForLoadingMaskToDisappear stepKey="waitForFileUpload2" timeout="45"/>
6767
<waitForElementVisible selector="{{ProductDescriptionWYSIWYGToolbarSection.image(ImageUpload1.value)}}" stepKey="waitForUploadImage2" />
6868
<click selector="{{ProductDescriptionWYSIWYGToolbarSection.InsertFile}}" stepKey="clickInsertBtn1" />
6969
<waitForElementVisible selector="{{ProductDescriptionWYSIWYGToolbarSection.ImageDescription}}" stepKey="waitForImageDescriptionButton1" />
@@ -75,10 +75,12 @@
7575
<click selector="{{ProductShortDescriptionWYSIWYGToolbarSection.Browse}}" stepKey="clickBrowse2" />
7676
<waitForElementVisible selector="{{ProductDescriptionWYSIWYGToolbarSection.CancelBtn}}" stepKey="waitForCancelButton2"/>
7777
<see selector="{{ProductShortDescriptionWYSIWYGToolbarSection.CancelBtn}}" userInput="Cancel" stepKey="seeCancelBtn2" />
78+
<waitForLoadingMaskToDisappear stepKey="waitForLoading13" timeout="30"/>
7879
<see selector="{{ProductShortDescriptionWYSIWYGToolbarSection.CreateFolder}}" userInput="Create Folder" stepKey="seeCreateFolderBtn2" />
80+
<waitForLoadingMaskToDisappear stepKey="waitForLoading14" timeout="40"/>
7981
<dontSeeElement selector="{{ProductShortDescriptionWYSIWYGToolbarSection.InsertFile}}" stepKey="dontSeeAddSelectedBtn3" />
8082
<attachFile selector="{{ProductShortDescriptionWYSIWYGToolbarSection.BrowseUploadImage}}" userInput="{{ImageUpload3.value}}" stepKey="uploadImage3"/>
81-
<waitForLoadingMaskToDisappear stepKey="waitForFileUpload3" />
83+
<waitForLoadingMaskToDisappear stepKey="waitForFileUpload3" timeout="45"/>
8284
<waitForElementVisible selector="{{ProductShortDescriptionWYSIWYGToolbarSection.image(ImageUpload3.value)}}" stepKey="waitForUploadImage3" />
8385
<waitForElement selector="{{ProductShortDescriptionWYSIWYGToolbarSection.DeleteSelectedBtn}}" stepKey="waitForDeletebtn" />
8486
<see selector="{{ProductShortDescriptionWYSIWYGToolbarSection.DeleteSelectedBtn}}" userInput="Delete Selected" stepKey="seeDeleteBtn2"/>
@@ -87,7 +89,7 @@
8789
<click selector="{{AdminConfirmationModalSection.ok}}" stepKey="confirmDelete2" />
8890
<dontSeeElement selector="{{ProductDescriptionWYSIWYGToolbarSection.InsertFile}}" stepKey="dontSeeAddSelectedBtn4" />
8991
<attachFile selector="{{ProductShortDescriptionWYSIWYGToolbarSection.BrowseUploadImage}}" userInput="{{ImageUpload3.value}}" stepKey="uploadImage4"/>
90-
<waitForLoadingMaskToDisappear stepKey="waitForFileUpload4" />
92+
<waitForLoadingMaskToDisappear stepKey="waitForFileUpload4" timeout="45"/>
9193
<waitForElementVisible selector="{{ProductShortDescriptionWYSIWYGToolbarSection.image(ImageUpload3.value)}}" stepKey="waitForUploadImage4" />
9294
<click selector="{{ProductShortDescriptionWYSIWYGToolbarSection.InsertFile}}" stepKey="clickInsertBtn" />
9395
<waitForLoadingMaskToDisappear stepKey="waitForLoading11" />

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

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,35 @@
6969
<waitForElementVisible selector="{{CategoryDesignSection.LayoutDropdown}}" stepKey="waitForLayoutDropDown" />
7070
<seeOptionIsSelected selector="{{CategoryDesignSection.LayoutDropdown}}" userInput="2 columns with right bar" stepKey="see2ColumnsSelected" />
7171
</test>
72+
<test name="AdminCategoryFormDisplaySettingsUIValidationTest">
73+
<annotations>
74+
<features value="Catalog"/>
75+
<stories value="Default layout configuration MAGETWO-88793"/>
76+
<title value="Category should not be saved once layered navigation price step field is left empty"/>
77+
<description value="Once the Config setting is unchecked Category should not be saved with layered navigation price field left empty"/>
78+
<severity value="AVERAGE"/>
79+
<testCaseId value="MAGETWO-95797"/>
80+
<group value="category"/>
81+
</annotations>
82+
<before>
83+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
84+
</before>
85+
<after>
86+
<actionGroup ref="logout" stepKey="logout"/>
87+
</after>
88+
<amOnPage url="{{AdminCategoryPage.url}}" stepKey="navigateToCategoryPage"/>
89+
<waitForPageLoad time="30" stepKey="waitForPageLoad1"/>
90+
<click selector="{{AdminCategorySidebarActionSection.AddSubcategoryButton}}" stepKey="clickOnAddSubCategory"/>
91+
<fillField selector="{{AdminCategoryBasicFieldSection.CategoryNameInput}}" userInput="{{SimpleSubCategory.name}}" stepKey="enterCategoryName"/>
92+
<click selector="{{CategoryDisplaySettingsSection.DisplaySettingTab}}" stepKey="clickOnDisplaySettingsTab"/>
93+
<waitForElementVisible selector="{{CategoryDisplaySettingsSection.filterPriceRangeUseConfig}}" stepKey="wait"/>
94+
<scrollTo selector="{{CategoryDisplaySettingsSection.layeredNavigationPriceInput}}" stepKey="scrollToLayeredNavigationField"/>
95+
<uncheckOption selector="{{CategoryDisplaySettingsSection.filterPriceRangeUseConfig}}" stepKey="uncheckConfigSetting"/>
96+
<click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="saveCategory"/>
97+
<see selector="{{AdminCategoryBasicFieldSection.FieldError('uid')}}" userInput="This is a required field." stepKey="seeErrorMessage"/>
98+
<!-- Verify that the Layered navigation price step field has the required indicator -->
99+
<comment userInput="Check if Layered navigation price field has required indictor icon" stepKey="comment" />
100+
<executeJS function="{{CategoryDisplaySettingsSection.RequiredFieldIndicator('filter_price_range')}}" stepKey="getRequiredFieldIndicator"/>
101+
<assertEquals expected='"*"' expectedType="string" actualType="variable" actual="getRequiredFieldIndicator" message="pass" stepKey="assertRequiredFieldIndicator1"/>
102+
</test>
72103
</tests>
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
9+
<test name="AdminCreateDropdownProductAttributeTest">
10+
<annotations>
11+
<features value="Catalog"/>
12+
<stories value="Create/configure Dropdown product attribute"/>
13+
<title value="Admin should be able to create dropdown product attribute"/>
14+
<description value="Admin should be able to create dropdown product attribute"/>
15+
<severity value="CRITICAL"/>
16+
<testCaseId value="MC-4982"/>
17+
<group value="Catalog"/>
18+
</annotations>
19+
<before>
20+
<actionGroup ref="LoginAsAdmin" stepKey="login"/>
21+
</before>
22+
<after>
23+
<!-- Remove attribute -->
24+
<actionGroup ref="deleteProductAttribute" stepKey="deleteAttribute">
25+
<argument name="ProductAttribute" value="productDropDownAttribute"/>
26+
</actionGroup>
27+
<actionGroup ref="logout" stepKey="logout"/>
28+
</after>
29+
30+
<amOnPage url="{{ProductAttributePage.url}}" stepKey="navigateToNewProductAttributePage"/>
31+
<waitForPageLoad stepKey="waitForPageLoad"/>
32+
33+
<!-- Set attribute properties -->
34+
<fillField selector="{{AttributePropertiesSection.DefaultLabel}}"
35+
userInput="{{ProductAttributeFrontendLabel.label}}" stepKey="fillDefaultLabel"/>
36+
<selectOption selector="{{AttributePropertiesSection.InputType}}"
37+
userInput="{{productDropDownAttribute.frontend_input}}" stepKey="fillInputType"/>
38+
39+
<!-- Set advanced attribute properties -->
40+
<click selector="{{AdvancedAttributePropertiesSection.AdvancedAttributePropertiesSectionToggle}}"
41+
stepKey="showAdvancedAttributePropertiesSection"/>
42+
<waitForElementVisible selector="{{AdvancedAttributePropertiesSection.AttributeCode}}"
43+
stepKey="waitForSlideOut"/>
44+
<fillField selector="{{AdvancedAttributePropertiesSection.AttributeCode}}"
45+
userInput="{{productDropDownAttribute.attribute_code}}"
46+
stepKey="fillAttributeCode"/>
47+
48+
<!-- Add new attribute options -->
49+
<click selector="{{AttributeOptionsSection.AddOption}}" stepKey="clickAddOption1"/>
50+
<fillField selector="{{DropdownAttributeOptionsSection.nthOptionAdminLabel('1')}}"
51+
userInput="Fish and Chips" stepKey="fillAdminValue1"/>
52+
53+
<click selector="{{AttributeOptionsSection.AddOption}}" stepKey="clickAddOption2"/>
54+
<fillField selector="{{DropdownAttributeOptionsSection.nthOptionAdminLabel('2')}}"
55+
userInput="Fish &amp; Chips" stepKey="fillAdminValue2"/>
56+
57+
<!-- Save the new product attribute -->
58+
<click selector="{{AttributePropertiesSection.Save}}" stepKey="clickSave1"/>
59+
<waitForPageLoad stepKey="waitForGridPageLoad1"/>
60+
<seeElement selector="{{AdminProductMessagesSection.successMessage}}"
61+
stepKey="waitForSuccessMessage"/>
62+
63+
<actionGroup ref="navigateToCreatedProductAttribute" stepKey="navigateToAttribute">
64+
<argument name="ProductAttribute" value="productDropDownAttribute"/>
65+
</actionGroup>
66+
<!-- Check attribute data -->
67+
<grabValueFrom selector="{{DropdownAttributeOptionsSection.nthOptionAdminLabel('2')}}"
68+
stepKey="secondOptionAdminLabel"/>
69+
<assertEquals actual="$secondOptionAdminLabel" expected="'Fish &amp; Chips'"
70+
stepKey="assertSecondOption"/>
71+
</test>
72+
</tests>

app/code/Magento/Catalog/view/adminhtml/ui_component/category_form.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,6 @@
331331
<item name="type" xsi:type="string">group</item>
332332
<item name="config" xsi:type="array">
333333
<item name="breakLine" xsi:type="boolean">true</item>
334-
<item name="required" xsi:type="boolean">true</item>
335334
</item>
336335
</argument>
337336
<field name="filter_price_range" formElement="input">
@@ -341,6 +340,9 @@
341340
</item>
342341
</argument>
343342
<settings>
343+
<validation>
344+
<rule name="required-entry" xsi:type="boolean">true</rule>
345+
</validation>
344346
<additionalClasses>
345347
<class name="admin__field-small">true</class>
346348
</additionalClasses>

app/code/Magento/Catalog/view/adminhtml/web/js/options.js

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -182,24 +182,16 @@ define([
182182
});
183183
}
184184
editForm.on('beforeSubmit', function () {
185-
var optionsValues = [],
186-
optionContainer = optionPanel.find('table tbody');
185+
var optionContainer = optionPanel.find('table tbody'),
186+
optionsValues;
187187

188188
if (optionPanel.hasClass(activePanelClass)) {
189-
optionContainer.find('input')
190-
.each(function () {
191-
if (this.disabled) {
192-
return;
193-
}
194-
195-
if (this.type === 'checkbox' || this.type === 'radio') {
196-
if (this.checked) {
197-
optionsValues.push(this.name + '=' + jQuery(this).val());
198-
}
199-
} else {
200-
optionsValues.push(this.name + '=' + jQuery(this).val());
201-
}
202-
});
189+
optionsValues = jQuery.map(
190+
optionContainer.find('tr'),
191+
function (row) {
192+
return jQuery(row).find('input, select, textarea').serialize();
193+
}
194+
);
203195
jQuery('<input>')
204196
.attr({
205197
type: 'hidden',

0 commit comments

Comments
 (0)