Skip to content

Commit 73c9a4f

Browse files
author
Joan He
committed
Merge remote-tracking branch 'origin/MAGETWO-68802-Clicking-Empty-Toggle' into MAGETWO-90927-product-save-warning
2 parents bbaa5fb + 7d91b4e commit 73c9a4f

File tree

7 files changed

+68
-19
lines changed

7 files changed

+68
-19
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,18 @@
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//span[text()='Option Title']/parent::label/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//label[text()='Option Title']/parent::span/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//span[text()='Option Type']/parent::label/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//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//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"/>
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}}']//span[text()='Title']/parent::label/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}}']//label[text()='Title']/parent::span/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}}']//span[text()='Price Type']/parent::label/parent::div//select" 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"/>
2929
<element name="checkboxUseDefaultTitle" type="checkbox" selector="//span[text()='Option Title']/parent::label/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

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
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"/>
1515
<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"/>
1618
<element name="productStatus" type="checkbox" selector="input[name='product[status]']"/>
1719
<element name="enableProductLabel" type="checkbox" selector="input[name='product[status]']+label"/>
1820
<element name="productStatusUseDefault" type="checkbox" selector="input[name='use_default[status]']"/>
@@ -39,11 +41,10 @@
3941
<element name="visibility" type="select" selector="//select[@name='product[visibility]']"/>
4042
<element name="visibilityUseDefault" type="checkbox" selector="//input[@name='use_default[visibility]']"/>
4143
<element name="divByDataIndex" type="input" selector="div[data-index='{{var}}']" parameterized="true"/>
42-
<element name="attributeLabelByText" type="text" selector="//*[@class='admin__field']//span[text()='{{attributeLabel}}']" parameterized="true"/>
44+
<element name="attributeLabelByText" type="text" selector="//*[@class='admin__field']//label[text()='{{attributeLabel}}']" parameterized="true"/>
4345
</section>
4446
<section name="ProductInWebsitesSection">
4547
<element name="sectionHeader" type="button" selector="div[data-index='websites']" timeout="30"/>
46-
<!--<element name="websites" type="checkbox" selector="input[name='product[website_ids][{{var1}}]']" parameterized="true"/>-->
4748
<element name="website" type="checkbox" selector="//label[contains(text(), '{{var1}}')]/parent::div//input[@type='checkbox']" parameterized="true"/>
4849
</section>
4950
<section name="ProductDesignSection">
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd">
11+
<test name="AdminSimpleProductUiValidationTest">
12+
<annotations>
13+
<title value="UI elements on the simple product edit screen should be organized as expected"/>
14+
<description value="Admin should be able to use simple product UI in expected manner"/>
15+
<testCaseId value="MAGETWO-92835"/>
16+
<group value="Catalog"/>
17+
</annotations>
18+
19+
<before>
20+
<!-- This was copied and modified from the EndToEndB2CGuestUserTest -->
21+
<createData entity="ApiCategory" stepKey="createCategory"/>
22+
<createData entity="_defaultProduct" stepKey="createSimpleProduct">
23+
<requiredEntity createDataKey="createCategory"/>
24+
</createData>
25+
</before>
26+
27+
<after>
28+
<deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/>
29+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
30+
</after>
31+
32+
<!--check admin for valid Enable Status label-->
33+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
34+
<amOnPage url="{{AdminProductEditPage.url($$createSimpleProduct.id$$)}}" stepKey="goToEditPage"/>
35+
<waitForPageLoad stepKey="wait1"/>
36+
<seeCheckboxIsChecked selector="{{AdminProductFormSection.productStatus}}" stepKey="seeCheckboxEnableProductIsChecked"/>
37+
38+
<!--check click on wrapping container does not trigger status change-->
39+
<click selector="{{AdminProductFormSection.enableProductAttributeLabelWrapper}}" stepKey="clickEnableProductWrapper"/>
40+
<seeCheckboxIsChecked selector="{{AdminProductFormSection.productStatus}}" stepKey="seeCheckboxEnableProductIsCheckedAfterWrapperClick"/>
41+
42+
<!--check click on label itself does trigger status change-->
43+
<click selector="{{AdminProductFormSection.enableProductAttributeLabel}}" stepKey="clickEnableProductLabel"/>
44+
<dontSeeCheckboxIsChecked selector="{{AdminProductFormSection.productStatus}}" stepKey="dontSeeCheckboxEnableProductIsCheckedAfterLabelClick"/>
45+
</test>
46+
</tests>

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
<testCaseId value="MAGETWO-91436"/>
1919
<group value="product"/>
2020
</annotations>
21+
<before>
2122
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
2223
<!--Create new website -->
2324
<actionGroup ref="AdminCreateWebsiteActionGroup" stepKey="createAdditionalWebsite">
@@ -34,7 +35,6 @@
3435

3536
<!--Create Store view -->
3637
<amOnPage url="{{AdminSystemStorePage.url}}" stepKey="amOnAdminSystemStorePage"/>
37-
<waitForElementVisible selector="{{AdminStoresMainActionsSection.createStoreViewButton}}" stepKey="waitForStoreViewBtn"/>
3838
<click selector="{{AdminStoresMainActionsSection.createStoreViewButton}}" stepKey="createStoreViewButton"/>
3939
<waitForPageLoad stepKey="waitForProductPageLoad"/>
4040
<selectOption userInput="Second Store" selector="{{AdminNewStoreSection.storeGrpDropdown}}" stepKey="selectStoreGroup"/>
@@ -46,7 +46,7 @@
4646
<conditionalClick selector="{{AdminNewStoreSection.acceptNewStoreViewCreation}}" dependentSelector="{{AdminNewStoreSection.acceptNewStoreViewCreation}}" visible="true" stepKey="AcceptNewStoreViewCreation"/>
4747
<waitForElementVisible selector="{{AdminStoresGridSection.storeFilterTextField}}" stepKey="waitForPageReolad"/>
4848
<see userInput="You saved the store view." stepKey="seeSaveMessage" />
49-
49+
</before>
5050
<after>
5151
<actionGroup ref="ResetWebUrlOptions" stepKey="resetUrlOption"/>
5252
<actionGroup ref="AdminDeleteWebsiteActionGroup" stepKey="deleteTestWebsite">
@@ -65,8 +65,7 @@
6565
<fillField userInput="{{_defaultProduct.price}}" selector="{{AdminProductFormSection.productPrice}}" stepKey="fillPrice"/>
6666
<fillField userInput="{{_defaultProduct.quantity}}" selector="{{AdminProductFormSection.productQuantity}}" stepKey="fillQuantity"/>
6767

68-
<!--<click selector="{{AdminProductCustomizableOptionsSection.customizableOptions}}" stepKey="openCustomOptionsSection"/>-->
69-
<conditionalClick selector="{{AdminProductCustomizableOptionsSection.customizableOptions}}" dependentSelector="{{AdminProductCustomizableOptionsSection.checkIfCustomizableOptionsTabOpen}}" visible="true" stepKey="clickIfContentTabCloses2"/>
68+
<conditionalClick selector="{{AdminProductCustomizableOptionsSection.customizableOptions}}" dependentSelector="{{AdminProductCustomizableOptionsSection.checkIfCustomizableOptionsTabOpen}}" visible="true" stepKey="clickIfContentTabCloses2"/>
7069
<click selector="{{AdminProductCustomizableOptionsSection.addOptionBtn}}" stepKey="clickAddOption"/>
7170
<waitForPageLoad stepKey="waitAfterAddOption"/>
7271
<fillField selector="input[name='product[options][0][title]']" userInput="Radio Option" stepKey="fillOptionTitle"/>

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

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

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -183,10 +183,13 @@
183183

184184
.admin__field-label {
185185
color: @field-label__color;
186-
cursor: pointer;
187186
margin: 0;
188187
text-align: right;
189188

189+
label {
190+
cursor: pointer;
191+
}
192+
190193
+ br {
191194
display: none;
192195
}
@@ -207,7 +210,7 @@
207210
overflow: hidden;
208211
}
209212

210-
span {
213+
label {
211214
display: inline-block;
212215
line-height: @field-label__line-height;
213216
vertical-align: middle;
@@ -512,7 +515,7 @@
512515
position: absolute;
513516
top: 0;
514517

515-
span {
518+
label {
516519
&:before {
517520
display: block;
518521
}
@@ -527,7 +530,7 @@
527530
}
528531

529532
& > .admin__field-label {
530-
span {
533+
label {
531534
&:before {
532535
display: none;
533536
}

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")]/span[text()="%s"]';
31+
protected $attribute = './/*[contains(@class,"label")]/label[text()="%s"]';
3232

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

0 commit comments

Comments
 (0)