Skip to content
This repository was archived by the owner on Apr 29, 2019. It is now read-only.

Commit 71dcb63

Browse files
author
Joan He
committed
Merge remote-tracking branch 'origin/MAGETWO-93979' into BugFixPR
2 parents af70540 + 5285f69 commit 71dcb63

File tree

12 files changed

+83
-21
lines changed

12 files changed

+83
-21
lines changed

app/code/Magento/Bundle/Test/Mftf/Section/AdminProductFormBundleSection.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
<!--FirstProductOption-->
6363
<element name="firstProductOption" type="checkbox" selector="//div[@class='admin__data-grid-outer-wrap']//tr[@data-repeat-index='0']//input[@type='checkbox']"/>
6464
<!--Category Selection-->
65-
<element name="categoriesDropDown" type="multiselect" selector="//div[@data-index='category_ids']//div" timeout="30"/>
65+
<element name="categoriesDropDown" type="multiselect" selector="//div[@data-index='category_ids']//div[@class='admin__field-control']" timeout="30"/>
6666
<element name="defaultCategory" type="multiselect" selector="//div[@data-index='category_ids']//span[contains(text(), 'Default Category')]"/>
6767
<element name="categoryByName" type="multiselect" selector="//div[@data-index='category_ids']//span[contains(text(), '{{category}}')]" parameterized="true"/>
6868
<element name="searchForCategory" type="input" selector="div.action-menu._active > div.admin__action-multiselect-search-wrap input" timeout="30"/>

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,12 @@
1616
<element name="enableCategoryLabel" type="text" selector="input[name='is_active']+label"/>
1717
<element name="enableUseDefault" type="checkbox" selector="input[name='use_default[is_active]']"/>
1818
<element name="CategoryNameInput" type="input" selector="input[name='name']"/>
19+
<element name="RequiredFieldIndicator" type="text" selector=" return window.getComputedStyle(document.querySelector('._required[data-index=name]&gt;.admin__field-label span'), ':after').getPropertyValue('content');"/>
20+
<element name="RequiredFieldIndicatorColor" type="text" selector=" return window.getComputedStyle(document.querySelector('._required[data-index=name]&gt;.admin__field-label span'), ':after').getPropertyValue('color');"/>
1921
<element name="categoryNameUseDefault" type="checkbox" selector="input[name='use_default[name]']"/>
2022
<element name="ContentTab" type="input" selector="input[name='name']"/>
2123
<element name="FieldError" type="text" selector=".admin__field-error[data-bind='attr: {for: {{field}}}, text: error']" parameterized="true"/>
24+
<element name="panelFieldControl" type="input" selector='//aside//div[@data-index="{{arg1}}"]/descendant::*[@name="{{arg2}}"]' parameterized="true"/>
2225
</section>
2326
<section name="CategoryContentSection">
2427
<element name="SelectFromGalleryBtn" type="button" selector="//label[text()='Select from Gallery']"/>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@
2929
</section>
3030
<section name="ModifyAttributes">
3131
<!-- Parameter is the attribute name -->
32-
<element name="nthExistingAttribute" type="select" selector="//*[text()='{{attributeName}}']/../..//select" parameterized="true"/>
32+
<element name="nthExistingAttribute" type="select" selector="//*[text()='{{attributeName}}']/../../..//select" parameterized="true"/>
3333
</section>
3434
</sections>

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,19 @@
1414
<element name="useDefaultOptionTitle" type="text" selector="[data-index='options'] tr.data-row [data-index='title'] [name^='options_use_default']"/>
1515
<element name="useDefaultOptionTitleByIndex" type="text" selector="[data-index='options'] [data-index='values'] tr[data-repeat-index='{{var1}}'] [name^='options_use_default']" parameterized="true"/>
1616
<element name="addOptionBtn" type="button" selector="button[data-index='button_add']"/>
17-
<element name="fillOptionTitle" type="input" selector="//span[text()='{{var1}}']/parent::div/parent::div/parent::div//label[text()='Option Title']/parent::span/parent::div//input[@class='admin__control-text']" parameterized="true"/>
17+
<element name="fillOptionTitle" type="input" selector="//span[text()='{{var1}}']/parent::div/parent::div/parent::div//span[text()='Option Title']/parent::label/parent::div/parent::div//input[@class='admin__control-text']" parameterized="true"/>
1818
<element name="optionTitleInput" type="input" selector="input[name='product[options][0][title]']"/>
1919
<element name="optionTypeOpenDropDown" type="button" selector=".admin__dynamic-rows[data-index='options'] .action-select"/>
2020
<element name="optionTypeTextField" type="button" selector=".admin__dynamic-rows[data-index='options'] .action-menu._active li li"/>
2121
<element name="maxCharactersInput" type="input" selector="input[name='product[options][0][max_characters]']"/>
2222

23-
<element name="checkSelect" type="select" selector="//span[text()='{{var1}}']/parent::div/parent::div/parent::div//label[text()='Option Type']/parent::span/parent::div//div[@data-role='selected-option']" parameterized="true"/>
24-
<element name="checkDropDown" type="select" selector="//span[text()='{{var1}}']/parent::div/parent::div/parent::div//parent::label/parent::span/parent::div//li[@class='admin__action-multiselect-menu-inner-item']//label[text()='Drop-down']" parameterized="true"/>
23+
<element name="checkSelect" type="select" selector="//span[text()='{{var1}}']/parent::div/parent::div/parent::div//span[text()='Option Type']/parent::label/parent::div/parent::div//div[@data-role='selected-option']" parameterized="true"/>
24+
<element name="checkDropDown" type="select" selector="//span[text()='{{var1}}']/parent::div/parent::div/parent::div//parent::label/parent::div/parent::div//li[@class='admin__action-multiselect-menu-inner-item']//label[text()='Drop-down']" parameterized="true"/>
2525
<element name="clickAddValue" type="button" selector="//span[text()='{{var1}}']/parent::div/parent::div/parent::div//tfoot//button" parameterized="true"/>
26-
<element name="fillOptionValueTitle" type="input" selector="//span[text()='{{var1}}']/parent::div/parent::div/parent::div//tbody/tr[@data-repeat-index='{{var2}}']//label[text()='Title']/parent::span/parent::div//div[@class='admin__field-control']/input" parameterized="true"/>
26+
<element name="fillOptionValueTitle" type="input" selector="//span[text()='{{var1}}']/parent::div/parent::div/parent::div//tbody/tr[@data-repeat-index='{{var2}}']//span[text()='Title']/parent::label/parent::div/parent::div//div[@class='admin__field-control']/input" parameterized="true"/>
2727
<element name="fillOptionValuePrice" type="input" selector="//span[text()='{{var1}}']/parent::div/parent::div/parent::div//tbody/tr[@data-repeat-index='{{var2}}']//span[text()='Price']/parent::label/parent::div//div[@class='admin__control-addon']/input" parameterized="true"/>
28-
<element name="clickSelectPriceType" type="select" selector="//span[text()='{{var1}}']/parent::div/parent::div/parent::div//tbody//tr[@data-repeat-index='{{var2}}']//label[text()='Price Type']/parent::span/parent::div//select" parameterized="true"/>
29-
<element name="checkboxUseDefaultTitle" type="checkbox" selector="//span[text()='Option Title']/parent::label/parent::div/div//input[@type='checkbox']"/>
28+
<element name="clickSelectPriceType" type="select" selector="//span[text()='{{var1}}']/parent::div/parent::div/parent::div//tbody//tr[@data-repeat-index='{{var2}}']//span[text()='Price Type']/parent::label/parent::div/parent::div//select" parameterized="true"/>
29+
<element name="checkboxUseDefaultTitle" type="checkbox" selector="//span[text()='Option Title']/parent::label/parent::div/parent::div/div//input[@type='checkbox']"/>
3030
<element name="checkboxUseDefaultOption" type="checkbox" selector="//table[@data-index='values']//tbody//tr[@data-repeat-index='{{var1}}']//div[@class='admin__field-control']//input[@type='checkbox']" parameterized="true"/>
3131

3232
<!-- Elements that make it easier to select the most recently added element -->

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@
1212
<element name="attributeSetFilter" type="input" selector="div[data-index='attribute_set_id'] .admin__field-control input" timeout="30"/>
1313
<element name="attributeSetFilterResult" type="input" selector="div[data-index='attribute_set_id'] .action-menu-item._last" timeout="30"/>
1414
<element name="productName" type="input" selector=".admin__field[data-index=name] input"/>
15+
<element name="RequiredNameIndicator" type="text" selector=" return window.getComputedStyle(document.querySelector('._required[data-index=name]&gt;.admin__field-label span'), ':after').getPropertyValue('content');"/>
16+
<element name="RequiredSkuIndicator" type="text" selector=" return window.getComputedStyle(document.querySelector('._required[data-index=sku]&gt;.admin__field-label span'), ':after').getPropertyValue('content');"/>
1517
<element name="productSku" type="input" selector=".admin__field[data-index=sku] input"/>
16-
<element name="enableProductAttributeLabel" type="text" selector="//label[text()='Enable Product']"/>
17-
<element name="enableProductAttributeLabelWrapper" type="text" selector="//label[text()='Enable Product']/parent::span"/>
18+
<element name="enableProductAttributeLabel" type="text" selector="//span[text()='Enable Product']/parent::label"/>
19+
<element name="enableProductAttributeLabelWrapper" type="text" selector="//span[text()='Enable Product']/parent::label/parent::div"/>
1820
<element name="productStatus" type="checkbox" selector="input[name='product[status]']"/>
1921
<element name="enableProductLabel" type="checkbox" selector="input[name='product[status]']+label"/>
2022
<element name="productStatusUseDefault" type="checkbox" selector="input[name='use_default[status]']"/>
@@ -41,7 +43,7 @@
4143
<element name="visibility" type="select" selector="//select[@name='product[visibility]']"/>
4244
<element name="visibilityUseDefault" type="checkbox" selector="//input[@name='use_default[visibility]']"/>
4345
<element name="divByDataIndex" type="input" selector="div[data-index='{{var}}']" parameterized="true"/>
44-
<element name="attributeLabelByText" type="text" selector="//*[@class='admin__field']//label[text()='{{attributeLabel}}']" parameterized="true"/>
46+
<element name="attributeLabelByText" type="text" selector="//*[@class='admin__field']//span[text()='{{attributeLabel}}']" parameterized="true"/>
4547
</section>
4648
<section name="ProductInWebsitesSection">
4749
<element name="sectionHeader" type="button" selector="div[data-index='websites']" timeout="30"/>
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
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="AdminRequiredFieldsHaveRequiredFieldIndicatorTest">
12+
<annotations>
13+
<stories value="Verify the presence of required field indicators across different pages in Magento Admin"/>
14+
<title value="Required fields should have the required asterisk indicator "/>
15+
<description value="Verify that Required fields should have the required indicator icon next to the field name"/>
16+
<severity value="MAJOR"/>
17+
<testCaseId value="MAGETWO-94330"/>
18+
<group value="Catalog"/>
19+
</annotations>
20+
<after>
21+
<amOnPage url="admin/admin/auth/logout/" stepKey="amOnLogoutPage"/>
22+
</after>
23+
24+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin1"/>
25+
<amOnPage url="{{AdminCategoryPage.url}}" stepKey="navigateToCategoryPage"/>
26+
<waitForElementVisible selector="{{AdminCategorySidebarActionSection.AddSubcategoryButton}}" stepKey="waitForAddSubCategoryVisible"/>
27+
<click selector="{{AdminCategorySidebarActionSection.AddSubcategoryButton}}" stepKey="clickOnAddSubCategory"/>
28+
29+
<!-- Verify that the Category Name field has the required field name indicator -->
30+
<executeJS function="{{AdminCategoryBasicFieldSection.RequiredFieldIndicator}}" stepKey="getRequiredFieldIndicator"/>
31+
<assertEquals expected='"*"' expectedType="string" actualType="variable" actual="getRequiredFieldIndicator" message="pass" stepKey="assertRequiredFieldIndicator1"/>
32+
33+
<executeJS function="{{AdminCategoryBasicFieldSection.RequiredFieldIndicatorColor}}" stepKey="getRequiredFieldIndicatorColor"/>
34+
<assertEquals expected="rgb(226, 38, 38)" expectedType="string" actualType="variable" actual="getRequiredFieldIndicatorColor" message="pass" stepKey="assertRequiredFieldIndicator2"/>
35+
36+
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndexPage"/>
37+
<click selector="{{AdminProductGridActionSection.addProductToggle}}" stepKey="addProductDropdown"/>
38+
<click selector="{{AdminProductGridActionSection.addSimpleProduct}}" stepKey="addSimpleProduct"/>
39+
40+
<!-- Verify that the Product Name and Sku fields have the required field name indicator -->
41+
<executeJS function="{{AdminProductFormSection.RequiredNameIndicator}}" stepKey="productNameRequiredFieldIndicator"/>
42+
<assertEquals expected='"*"' expectedType="string" actualType="variable" actual="productNameRequiredFieldIndicator" message="pass" stepKey="assertRequiredFieldIndicator3"/>
43+
<executeJS function="{{AdminProductFormSection.RequiredSkuIndicator}}" stepKey="productSkuRequiredFieldIndicator"/>
44+
<assertEquals expected='"*"' expectedType="string" actualType="variable" actual="productSkuRequiredFieldIndicator" message="pass" stepKey="assertRequiredFieldIndicator4"/>
45+
46+
<!-- Verify that the CMS page have the required field name indicator next to Page Title -->
47+
<amOnPage url="{{CmsPagesPage.url}}" stepKey="amOnPagePagesGrid"/>
48+
<waitForPageLoad stepKey="waitForPageLoad1"/>
49+
<click selector="{{CmsPagesPageActionsSection.addNewPageButton}}" stepKey="clickAddNewPage"/>
50+
<executeJS function="{{CmsNewPagePageBasicFieldsSection.RequiredFieldIndicator}}" stepKey="pageTitleRequiredFieldIndicator"/>
51+
<assertEquals expected='"*"' expectedType="string" actualType="variable" actual="pageTitleRequiredFieldIndicator" message="pass" stepKey="assertRequiredFieldIndicator5"/>
52+
53+
</test>
54+
</tests>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
<fillField userInput="{{_defaultProduct.price}}" selector="{{AdminProductFormSection.productPrice}}" stepKey="fillPrice"/>
6868
<fillField userInput="{{_defaultProduct.quantity}}" selector="{{AdminProductFormSection.productQuantity}}" stepKey="fillQuantity"/>
6969

70-
<conditionalClick selector="{{AdminProductCustomizableOptionsSection.customizableOptions}}" dependentSelector="{{AdminProductCustomizableOptionsSection.checkIfCustomizableOptionsTabOpen}}" visible="true" stepKey="clickIfContentTabCloses2"/>
70+
<conditionalClick selector="{{AdminProductCustomizableOptionsSection.customizableOptions}}" dependentSelector="{{AdminProductCustomizableOptionsSection.checkIfCustomizableOptionsTabOpen}}" visible="true" stepKey="clickIfContentTabCloses2"/>
7171
<click selector="{{AdminProductCustomizableOptionsSection.addOptionBtn}}" stepKey="clickAddOption"/>
7272
<waitForPageLoad stepKey="waitAfterAddOption"/>
7373
<fillField selector="input[name='product[options][0][title]']" userInput="Radio Option" stepKey="fillOptionTitle"/>

app/code/Magento/Cms/Test/Mftf/Section/CmsNewPagePageBasicFieldsSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd">
1111
<section name="CmsNewPagePageBasicFieldsSection">
1212
<element name="pageTitle" type="input" selector="input[name=title]"/>
13+
<element name="RequiredFieldIndicator" type="text" selector=" return window.getComputedStyle(document.querySelector('._required[data-index=title]&gt;.admin__field-label span'), ':after').getPropertyValue('content');"/>
1314
<element name="isActive" type="button" selector="//input[@name='is_active' and @value='{{var1}}']" parameterized="true"/>
1415
<element name="duplicatedURLKey" type="input" selector="//input[contains(@data-value,'{{var1}}')]" parameterized="true"/>
1516
</section>

app/code/Magento/Ui/view/base/web/templates/form/field.html

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@
88
visible="visible"
99
css="$data.additionalClasses"
1010
attr="'data-index': index">
11-
<span class="admin__field-label" if="$data.label" visible="$data.labelVisible">
12-
<label translate="label" attr="'data-config-scope': $data.scopeLabel, for: uid" />
13-
</span>
11+
<div class="admin__field-label">
12+
<label if="$data.label" visible="$data.labelVisible" attr="for: uid">
13+
<span translate="label" attr="'data-config-scope': $data.scopeLabel" />
14+
</label>
15+
</div>
1416
<div class="admin__field-control"
1517
css="'_with-tooltip': $data.tooltip, '_with-reset': $data.showFallbackReset && $data.isDifferedFromDefault">
1618
<render args="elementTmpl" ifnot="hasAddons()"/>

app/design/adminhtml/Magento/backend/web/css/source/forms/_fields.less

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@
210210
overflow: hidden;
211211
}
212212

213-
label {
213+
span {
214214
display: inline-block;
215215
line-height: @field-label__line-height;
216216
vertical-align: middle;
@@ -228,7 +228,7 @@
228228

229229
.required > &, // ToDo UI: change classes 'required' to '_required'.
230230
._required > & {
231-
> span {
231+
span {
232232
&:after {
233233
color: @validation__color;
234234
content: '*';
@@ -515,7 +515,7 @@
515515
position: absolute;
516516
top: 0;
517517

518-
label {
518+
span {
519519
&:before {
520520
display: block;
521521
}
@@ -530,7 +530,7 @@
530530
}
531531

532532
& > .admin__field-label {
533-
label {
533+
span {
534534
&:before {
535535
display: none;
536536
}

dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Section/ProductDetails/NewCategoryIds.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<selector>[name="name"]</selector>
1212
</name>
1313
<parent_category>
14-
<selector>div[data-index="parent"]>div</selector>
14+
<selector>div[data-index="parent"]>div[class="admin__field-control"]</selector>
1515
<class>Magento\Catalog\Test\Block\Adminhtml\Product\Edit\Section\ProductDetails\CategoryIds</class>
1616
</parent_category>
1717
</fields>

dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/ProductForm.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class ProductForm extends FormSections
2828
*
2929
* @var string
3030
*/
31-
protected $attribute = './/*[contains(@class,"label")]/label[text()="%s"]';
31+
protected $attribute = './/*[contains(@class,"label")]//span[text()="%s"]';
3232

3333
/**
3434
* Product new from date field on the product form

0 commit comments

Comments
 (0)