Skip to content

Commit 9cd5924

Browse files
committed
MAGETWO-93979: Required Field Indicators (Asterisks) Are Gone From Magento UI
- added functional test
1 parent 204f857 commit 9cd5924

File tree

3 files changed

+54
-0
lines changed

3 files changed

+54
-0
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,13 @@
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='._required[data-index="{{arg1}}"] > .admin__field-label span' parameterized="true"/>-->
20+
<element name="RequiredFieldIndicator" type="text" selector=" return window.getComputedStyle(document.querySelector('._required[data-index=name]&gt;.admin__field-label span'), ':after').getPropertyValue('content');"/>
21+
<element name="RequiredFieldIndicatorColor" type="text" selector=" return window.getComputedStyle(document.querySelector('._required[data-index=name]&gt;.admin__field-label span'), ':after').getPropertyValue('color');"/>
1922
<element name="categoryNameUseDefault" type="checkbox" selector="input[name='use_default[name]']"/>
2023
<element name="ContentTab" type="input" selector="input[name='name']"/>
2124
<element name="FieldError" type="text" selector=".admin__field-error[data-bind='attr: {for: {{field}}}, text: error']" parameterized="true"/>
25+
<element name="panelFieldControl" type="input" selector='//aside//div[@data-index="{{arg1}}"]/descendant::*[@name="{{arg2}}"]' parameterized="true"/>
2226
</section>
2327
<section name="CategoryContentSection">
2428
<element name="SelectFromGalleryBtn" type="button" selector="//label[text()='Select from Gallery']"/>

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
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"/>
1618
<element name="enableProductAttributeLabel" type="text" selector="//span[text()='Enable Product']/parent::label"/>
1719
<element name="enableProductAttributeLabelWrapper" type="text" selector="//span[text()='Enable Product']/parent::label/parent::div"/>
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
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+
<title value="Required fields should have the required asterisk indicator "/>
14+
<description value="Verify that Required fields should have the required indicator icon next to the field name"/>
15+
<severity value="MAJOR"/>
16+
<testCaseId value="MAGETWO-93979"/>
17+
<group value="Catalog"/>
18+
</annotations>
19+
<after>
20+
<amOnPage url="admin/admin/auth/logout/" stepKey="amOnLogoutPage"/>
21+
</after>
22+
23+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin1"/>
24+
<amOnPage url="{{AdminCategoryPage.url}}" stepKey="navigateToCategoryPage"/>
25+
<waitForElementVisible selector="{{AdminCategorySidebarActionSection.AddSubcategoryButton}}" stepKey="waitForAddSubCategoryVisible"/>
26+
<click selector="{{AdminCategorySidebarActionSection.AddSubcategoryButton}}" stepKey="clickOnAddSubCategory"/>
27+
28+
<!-- Verify that the Category Name field has the required field name indicator -->
29+
<!--<executeJS function="window.getComputedStyle(document.querySelector('{{AdminCategoryBasicFieldSection.RequiredFieldIndicator('name')}}'), ':after').getPropertyValue('color');" stepKey="getRequiredFieldIndicator"/>-->
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+
<!-- Verify that the Product Name and Sku fields have the required field name indicator -->
40+
<executeJS function="{{AdminProductFormSection.RequiredNameIndicator}}" stepKey="productNameRequiredFieldIndicator"/>
41+
<assertEquals expected='"*"' expectedType="string" actualType="variable" actual="productNameRequiredFieldIndicator" message="pass" stepKey="assertRequiredFieldIndicator3"/>
42+
43+
<executeJS function="{{AdminProductFormSection.RequiredSkuIndicator}}" stepKey="productSkuRequiredFieldIndicator"/>
44+
<assertEquals expected='"*"' expectedType="string" actualType="variable" actual="productSkuRequiredFieldIndicator" message="pass" stepKey="assertRequiredFieldIndicator4"/>
45+
46+
47+
</test>
48+
</tests>

0 commit comments

Comments
 (0)