Skip to content

Commit 3866f53

Browse files
committed
Merge remote-tracking branch 'adobe-commerce-tier-4/ACP2E-3710' into PR_2025_06_25_muntianu
2 parents a20a6ff + 00f2774 commit 3866f53

File tree

6 files changed

+132
-25
lines changed

6 files changed

+132
-25
lines changed

app/code/Magento/Customer/Test/Mftf/Test/StorefrontLoginFormCheckDuplicateValidateMessageTest.xml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
3-
/**
4-
* Copyright © Magento, Inc. All rights reserved.
5-
* See COPYING.txt for license details.
6-
*/
3+
/**
4+
* Copyright 2022 Adobe
5+
* All Rights Reserved.
6+
*/
77
-->
88

99
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -18,9 +18,7 @@
1818
<group value="Customer"/>
1919
<group value="cloud"/>
2020
<group value="pr_exclude"/>
21-
<skip>
22-
<issueId value="AC-12714"/>
23-
</skip>
21+
<testCaseId value="AC-12714"/>
2422
</annotations>
2523

2624
<actionGroup ref="StorefrontOpenCustomerLoginPageActionGroup" stepKey="goToSignInPage"/>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright 2025 Adobe
5+
* All Rights Reserved.
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="StorefrontValidateThreeGroupedProductQtyErrorMessageActionGroup">
12+
<annotations>
13+
<description>Validates Child Products Quantities Input Error Messages are displaying</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="firstProductId" type="string"/>
17+
<argument name="secondProductId" type="string"/>
18+
<argument name="thirdProductId" type="string" />
19+
</arguments>
20+
<dontSeeElement selector="{{StorefrontProductInfoMainSection.groupedProductOptionQtyError(firstProductId)}}" stepKey="checkingInputValidationErrorMessageForFirstProduct"/>
21+
<seeElement selector="{{StorefrontProductInfoMainSection.groupedProductOptionQtyError(secondProductId)}}" stepKey="checkingInputValidationErrorMessageForSecondProduct"/>
22+
<dontSeeElement selector="{{StorefrontProductInfoMainSection.groupedProductOptionQtyError(thirdProductId)}}" stepKey="checkingInputValidationErrorMessageForThirdProduct"/>
23+
</actionGroup>
24+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright 2025 Adobe
5+
* All Rights Reserved.
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="StoreFrontValidateGroupedProductQuantityInputErrorMessageTest">
12+
<annotations>
13+
<features value="GroupedProduct"/>
14+
<stories value="Verify grouped product qty validation message in Storefront"/>
15+
<title value="Grouped product qty validation should be displayed only on invalid qty textbox"/>
16+
<description value="Grouped product qty validation should be displayed only on invalid qty textbox"/>
17+
<testCaseId value="AC-13325"/>
18+
<severity value="MAJOR"/>
19+
<group value="GroupedProduct"/>
20+
</annotations>
21+
<before>
22+
<createData entity="ApiProductWithDescription" stepKey="simple1"/>
23+
<createData entity="ApiProductWithDescription" stepKey="simple2"/>
24+
<createData entity="ApiProductWithDescription" stepKey="simple3"/>
25+
<createData entity="ApiGroupedProduct" stepKey="product"/>
26+
<createData entity="OneSimpleProductLink" stepKey="addProductOne">
27+
<requiredEntity createDataKey="product"/>
28+
<requiredEntity createDataKey="simple1"/>
29+
</createData>
30+
<updateData entity="OneMoreSimpleProductLink" createDataKey="addProductOne" stepKey="addProductTwo">
31+
<requiredEntity createDataKey="product"/>
32+
<requiredEntity createDataKey="simple2"/>
33+
</updateData>
34+
<updateData entity="OneMoreSimpleProductLink" createDataKey="addProductOne" stepKey="addProductThree">
35+
<requiredEntity createDataKey="product"/>
36+
<requiredEntity createDataKey="simple3"/>
37+
</updateData>
38+
</before>
39+
<after>
40+
<deleteData createDataKey="product" stepKey="deleteGroupedProduct"/>
41+
<deleteData createDataKey="simple1" stepKey="deleteSimple1"/>
42+
<deleteData createDataKey="simple2" stepKey="deleteSimple2"/>
43+
<deleteData createDataKey="simple3" stepKey="deleteSimple3"/>
44+
</after>
45+
<actionGroup ref="StorefrontAddThreeGroupedProductToTheCartActionGroup" stepKey="enterSimpleProductsQty">
46+
<argument name="urlKey" value="$$product.custom_attributes[url_key]$$" />
47+
<argument name="product1" value="$simple1.name$"/>
48+
<argument name="product2" value="$simple2.name$"/>
49+
<argument name="product3" value="$simple3.name$"/>
50+
<argument name="qty1" value="0"/>
51+
<argument name="qty2" value="-10"/>
52+
<argument name="qty3" value="5"/>
53+
</actionGroup>
54+
<actionGroup ref="StorefrontValidateThreeGroupedProductQtyErrorMessageActionGroup" stepKey="verifyQtyInputErrorMessage">
55+
<argument name="firstProductId" value="$simple1.id$"/>
56+
<argument name="secondProductId" value="$simple2.id$"/>
57+
<argument name="thirdProductId" value="$simple3.id$"/>
58+
</actionGroup>
59+
<actionGroup ref="StorefrontAddThreeGroupedProductToTheCartActionGroup" stepKey="enterSimpleProductsQty2">
60+
<argument name="urlKey" value="$$product.custom_attributes[url_key]$$" />
61+
<argument name="product1" value="$simple1.name$"/>
62+
<argument name="product2" value="$simple2.name$"/>
63+
<argument name="product3" value="$simple3.name$"/>
64+
<argument name="qty1" value="0"/>
65+
<argument name="qty2" value="0"/>
66+
<argument name="qty3" value="5"/>
67+
</actionGroup>
68+
<see userInput="You added $$product.name$$ to your shopping cart" stepKey="seeGroupedAddedToCart"/>
69+
</test>
70+
</tests>

app/code/Magento/Theme/view/base/requirejs-config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
2-
* Copyright © Magento, Inc. All rights reserved.
3-
* See COPYING.txt for license details.
2+
* Copyright 2014 Adobe
3+
* All Rights Reserved.
44
*/
55

66
var config = {

lib/web/mage/validation.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
* Copyright © Magento, Inc. All rights reserved.
33
* See COPYING.txt for license details.
44
*/
5-
5+
/* eslint-disable no-useless-escape */
6+
// jscs:disable no-useless-escape
67
define([
78
'jquery',
89
'moment',
@@ -15,6 +16,23 @@ define([
1516

1617
var creditCartTypes, rules, showLabel, originValidateDelegate;
1718

19+
if ($.validator) {
20+
let originalErrorsFor = $.validator.prototype.errorsFor;
21+
22+
$.validator.prototype.errorsFor = function (element) {
23+
let name = this.escapeCssMeta(this.idOrName(element)),
24+
describer = $(element).attr('aria-describedby'),
25+
selector = `label[for='${name}'], label[for='${name}'] *`;
26+
27+
// 'aria-describedby' should directly reference the error element
28+
if (describer) {
29+
selector += `, #${this.escapeCssMeta(describer).replace(/\s+/g, ', #')}`;
30+
selector += ':visible';
31+
}
32+
return originalErrorsFor.call(this, element).add(this.errors().filter(selector));
33+
};
34+
}
35+
1836
$.extend(true, $, {
1937
// @TODO: Move methods 'isEmpty', 'isEmptyNoTrim', 'parseNumber', 'stripHtml' in file with utility functions
2038
mage: {

lib/web/mage/validation/validation.js

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
2-
* Copyright © Magento, Inc. All rights reserved.
3-
* See COPYING.txt for license details.
2+
* Copyright 2013 Adobe
3+
* All Rights Reserved.
44
*/
55

66
define([
@@ -12,24 +12,21 @@ define([
1212

1313
$.each({
1414
'validate-grouped-qty': [
15-
function (value, element, params) {
16-
var result = true,
17-
total = 0,
18-
inputVal = parseFloat($(element).val()) || 0;
15+
function (value, element) {
16+
let inputValue = parseFloat($(element).val()) || 0;
1917

20-
if (inputVal < 0) {
21-
result = false;
18+
if (inputValue < 0) {
19+
return false;
2220
}
2321

24-
$(params).find('input[data-validate*="validate-grouped-qty"]').each(function (i, e) {
25-
var groupedVal = parseFloat($(e).val()) || 0;
22+
// eslint-disable-next-line one-var
23+
let allInputs = $('#super-product-table input[data-validate*="validate-grouped-qty"]');
2624

27-
if (groupedVal >= 0) {
28-
total += groupedVal;
29-
}
30-
});
25+
if (allInputs.first().is(element)) {
26+
return allInputs.toArray().some(input => parseFloat($(input).val()) > 0);
27+
}
3128

32-
return result && total > 0;
29+
return true;
3330
},
3431
$.mage.__('Please specify the quantity of product(s).')
3532
],

0 commit comments

Comments
 (0)