Skip to content

Commit 7d48a37

Browse files
authored
ENGCOM-7619: Fix #26427 - Admin config section not expanded when fields are required. #28285
2 parents 75af4ac + 3a86cf2 commit 7d48a37

File tree

7 files changed

+129
-0
lines changed

7 files changed

+129
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AdminConfigCollapseStorefrontTabActionGroup">
12+
<conditionalClick selector="{{CatalogSection.storefront}}" dependentSelector="{{CatalogSection.CheckIfTabIsExpanded}}" visible="true" stepKey="collapseStorefrontTab"/>
13+
</actionGroup>
14+
</actionGroups>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AdminConfigExpandStorefrontTabActionGroup">
12+
<conditionalClick selector="{{CatalogSection.storefront}}" dependentSelector="{{CatalogSection.CheckIfTabExpand}}" visible="true" stepKey="expandStorefrontTab"/>
13+
</actionGroup>
14+
</actionGroups>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AdminConfigFillInputFilterFieldActionGroup">
12+
<arguments>
13+
<argument name="selector"/>
14+
<argument name="value" type="string"/>
15+
</arguments>
16+
<fillField selector="{{selector}}" userInput="{{value}}" stepKey="fillInputField"/>
17+
</actionGroup>
18+
</actionGroups>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AdminOpenStoreConfigCatalogPageActionGroup">
12+
<annotations>
13+
<description>Go to admin store configuration catalog page.</description>
14+
</annotations>
15+
16+
<amOnPage url="{{CatalogConfigPage.url}}" stepKey="openAdminStoreConfigPage"/>
17+
<waitForPageLoad stepKey="waitForPageLoad"/>
18+
</actionGroup>
19+
</actionGroups>

app/code/Magento/Config/Test/Mftf/Section/CatalogSection/CatalogSection.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
<section name="CatalogSection">
1111
<element name="storefront" type="select" selector="#catalog_frontend-head"/>
1212
<element name="CheckIfTabExpand" type="button" selector="#catalog_frontend-head:not(.open)"/>
13+
<element name="CheckIfTabIsExpanded" type="button" selector="#catalog_frontend-head.open"/>
1314
<element name="price" type="button" selector="#catalog_price-head"/>
1415
<element name="checkIfPriceExpand" type="button" selector="//a[@id='catalog_price-head' and @class='open']"/>
1516
<element name="catalogPriceScope" type="select" selector="#catalog_price_scope"/>
@@ -23,5 +24,6 @@
2324
<element name="CheckIfSeoTabExpand" type="button" selector="#catalog_seo-head:not(.open)"/>
2425
<element name="GenerateUrlRewrites" type="select" selector="#catalog_seo_generate_category_product_rewrites"/>
2526
<element name="successMessage" type="text" selector="#messages"/>
27+
<element name="productsPerPageOnGridAllowedValues" type="input" selector="//input[@id='catalog_frontend_grid_per_page_values']"/>
2628
</section>
2729
</sections>
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
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="AdminConfigCollapsedFieldsetValidationTest">
12+
<annotations>
13+
<features value="Backend"/>
14+
<stories value="Configuration Form Validation"/>
15+
<title value="Verify that form validation triggered on element inside hidden fieldset opens the fieldset in case of error"/>
16+
<description value="Verify that form validation triggered on element inside hidden fieldset opens the fieldset in case of error"/>
17+
<severity value="AVERAGE"/>
18+
<testCaseId value="MC-35785"/>
19+
<group value="configuration"/>
20+
</annotations>
21+
<before>
22+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
23+
</before>
24+
<after>
25+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
26+
</after>
27+
28+
<actionGroup ref="AdminOpenStoreConfigCatalogPageActionGroup" stepKey="navigateToConfigurationPage"/>
29+
<actionGroup ref="AdminConfigExpandStorefrontTabActionGroup" stepKey="expandStorefrontTab"/>
30+
<actionGroup ref="AdminUncheckUseSystemValueActionGroup" stepKey="uncheckUseSystemValue">
31+
<argument name="rowId" value="row_catalog_frontend_grid_per_page_values"/>
32+
</actionGroup>
33+
<actionGroup ref="AdminConfigFillInputFilterFieldActionGroup" stepKey="fillInputField">
34+
<argument name="selector" value="CatalogSection.productsPerPageOnGridAllowedValues"/>
35+
<argument name="value" value=""/>
36+
</actionGroup>
37+
<actionGroup ref="AdminConfigCollapseStorefrontTabActionGroup" stepKey="collapseStorefrontTab"/>
38+
<click selector="{{CatalogSection.save}}" stepKey="clickSaveConfigBtn"/>
39+
40+
<actionGroup ref="AssertAdminValidationErrorActionGroup" stepKey="assertValidationError">
41+
<argument name="inputId" value="catalog_frontend_grid_per_page_values"/>
42+
</actionGroup>
43+
</test>
44+
</tests>

app/code/Magento/Config/view/adminhtml/templates/system/config/edit.phtml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,24 @@ require([
255255
}
256256
});
257257

258+
window.configForm.on('invalid-form.validate', function (event, validation) {
259+
if (validation.errorList.length === 0) {
260+
return;
261+
}
262+
263+
jQuery.each(validation.errorList, function () {
264+
var element = jQuery(this.element || []);
265+
266+
if (element.length) {
267+
jQuery(element.parents('.section-config')).each(function () {
268+
if (!jQuery(this).hasClass('active')) {
269+
Fieldset.toggleCollapse(jQuery(this).children('.config.admin__collapsible-block').attr('id'));
270+
}
271+
});
272+
}
273+
});
274+
})
275+
258276
$$('.shared').each(function(element){
259277
Event.observe(element, 'change', adminSystemConfig.onchangeSharedElement);
260278

0 commit comments

Comments
 (0)