Skip to content

Commit a7fa47b

Browse files
committed
Fix #26427 - Admin config section not expanded when fields are required.
1 parent b7c9e07 commit a7fa47b

File tree

7 files changed

+122
-0
lines changed

7 files changed

+122
-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: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
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+
<group value="configuration"/>
19+
</annotations>
20+
<before>
21+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
22+
</before>
23+
<after>
24+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
25+
</after>
26+
27+
<actionGroup ref="AdminOpenStoreConfigCatalogPageActionGroup" stepKey="navigateToConfigurationPage"/>
28+
<actionGroup ref="AdminConfigExpandStorefrontTabActionGroup" stepKey="expandStorefrontTab"/>
29+
<actionGroup ref="AdminUncheckUseSystemValueActionGroup" stepKey="uncheckUseSystemValue">
30+
<argument name="rowId" value="row_catalog_frontend_grid_per_page_values"/>
31+
</actionGroup>
32+
<actionGroup ref="AdminConfigFillInputFilterFieldActionGroup" stepKey="fillInputField">
33+
<argument name="selector" value="CatalogSection.productsPerPageOnGridAllowedValues"/>
34+
<argument name="value" value=""/>
35+
</actionGroup>
36+
<actionGroup ref="AdminConfigCollapseStorefrontTabActionGroup" stepKey="collapseStorefrontTab"/>
37+
<click selector="{{CatalogSection.save}}" stepKey="clickSaveConfigBtn"/>
38+
39+
<actionGroup ref="AssertAdminValidationErrorActionGroup" stepKey="assertValidationError">
40+
<argument name="inputId" value="catalog_frontend_grid_per_page_values"/>
41+
</actionGroup>
42+
</test>
43+
</tests>

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

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

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

0 commit comments

Comments
 (0)