Skip to content

Commit 56463d5

Browse files
Merge pull request #9440 from adobe-commerce-tier-4/Tier4-Kings-PR-12-19-2024
[Support Tier-4-Kings glo16746] 12.19.2024 Regular delivery of bugfixes and improvements
2 parents 2990f74 + 7f6bae9 commit 56463d5

File tree

4 files changed

+83
-24
lines changed

4 files changed

+83
-24
lines changed
Lines changed: 5 additions & 4 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 2019 Adobe
5+
* All Rights Reserved.
6+
*/
77
-->
88

99
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -15,5 +15,6 @@
1515
<element name="groupedProductsAssociatedProductPrice" type="text" parameterized="true" selector="#super-product-table tbody tr:nth-of-type({{index}}) .price"/>
1616
<element name="groupedProductsAssociatedProductQuantity" type="input" parameterized="true" selector="#super-product-table tbody tr:nth-of-type({{index}}) input.qty"/>
1717
<element name="groupedProductOptions" type="input" selector="//td//strong[text()='{{productName}}']" parameterized="true"/>
18+
<element name="groupedProductOptionQtyError" type="text" selector="//*[@id='super_group[{{productId}}]-error']" parameterized="true"/>
1819
</section>
1920
</sections>
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright 2024 Adobe
5+
* All Rights Reserved.
6+
*/
7+
-->
8+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10+
<test name="AssertGroupedProductQtyOnProductPageTest">
11+
<annotations>
12+
<title value="Validate quantity in Storefront for a grouped product"/>
13+
<stories value="Storefront grouped product quantity validation when one child product has invalid quantity"/>
14+
<description value="On the storefront, validate that if a child product in a grouped product has an invalid quantity, the error is displayed only for that specific child product."/>
15+
<features value="GroupedProduct"/>
16+
<testCaseId value="AC-13508"/>
17+
<useCaseId value="ACP2E-3469"/>
18+
<severity value="MINOR"/>
19+
</annotations>
20+
<before>
21+
<!--Create simple and grouped product-->
22+
<createData entity="ApiProductWithDescription" stepKey="simple1"/>
23+
<createData entity="ApiProductWithDescription" stepKey="simple2"/>
24+
<createData entity="ApiProductWithDescription" stepKey="simple3"/>
25+
<createData entity="ApiGroupedProduct" stepKey="groupedProduct"/>
26+
<createData entity="OneSimpleProductLink" stepKey="addProductOne">
27+
<requiredEntity createDataKey="groupedProduct"/>
28+
<requiredEntity createDataKey="simple1"/>
29+
</createData>
30+
<updateData entity="OneMoreSimpleProductLink" createDataKey="addProductOne" stepKey="addProductTwo">
31+
<requiredEntity createDataKey="groupedProduct"/>
32+
<requiredEntity createDataKey="simple2"/>
33+
</updateData>
34+
<updateData entity="OneMoreSimpleProductLink" createDataKey="addProductOne" stepKey="addProductThree">
35+
<requiredEntity createDataKey="groupedProduct"/>
36+
<requiredEntity createDataKey="simple3"/>
37+
</updateData>
38+
</before>
39+
<after>
40+
<deleteData createDataKey="groupedProduct" stepKey="deleteGroupProduct"/>
41+
<deleteData createDataKey="simple1" stepKey="deleteSimple1"/>
42+
<deleteData createDataKey="simple2" stepKey="deleteSimple2"/>
43+
<deleteData createDataKey="simple3" stepKey="deleteSimple3"/>
44+
</after>
45+
<!-- Add grouped product to the cart -->
46+
<actionGroup ref="StorefrontAddThreeGroupedProductToTheCartActionGroup" stepKey="addGropedProductsToTheCart">
47+
<argument name="urlKey" value="$$groupedProduct.custom_attributes[url_key]$$"/>
48+
<argument name="product1" value="$$simple1.name$$"/>
49+
<argument name="product2" value="$$simple2.name$$"/>
50+
<argument name="product3" value="$$simple3.name$$"/>
51+
<argument name="qty1" value="1"/>
52+
<argument name="qty2" value="1"/>
53+
<argument name="qty3" value="-1"/>
54+
</actionGroup>
55+
<!-- Asserting product options qty errors-->
56+
<waitForElementNotVisible selector="{{StorefrontProductInfoMainSection.groupedProductOptionQtyError($simple1.id$)}}" stepKey="firstProductQtyError"/>
57+
<waitForElementNotVisible selector="{{StorefrontProductInfoMainSection.groupedProductOptionQtyError($simple2.id$)}}" stepKey="secondProductQtyError"/>
58+
<waitForElementVisible selector="{{StorefrontProductInfoMainSection.groupedProductOptionQtyError($simple3.id$)}}" stepKey="thirdProductQtyError"/>
59+
</test>
60+
</tests>

app/code/Magento/Store/etc/config.xml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
<?xml version="1.0"?>
22
<!--
3-
/**
4-
* Copyright © Magento, Inc. All rights reserved.
5-
* See COPYING.txt for license details.
3+
/************************************************************************
4+
*
5+
* Copyright 2013 Adobe
6+
* All Rights Reserved.
7+
*
8+
* ************************************************************************
69
*/
710
-->
811
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
@@ -21,13 +24,13 @@
2124
<merge_files>0</merge_files>
2225
<minify_files>0</minify_files>
2326
<minify_exclude>
24-
<tiny_mce>/tiny_mce/</tiny_mce>
27+
<tiny_mce_6>/tiny_mce_6/</tiny_mce_6>
2528
</minify_exclude>
2629
</js>
2730
<css>
2831
<minify_files>0</minify_files>
2932
<minify_exclude>
30-
<tiny_mce>/tiny_mce/</tiny_mce>
33+
<tiny_mce_6>/tiny_mce_6/</tiny_mce_6>
3134
</minify_exclude>
3235
</css>
3336
<image>

lib/web/mage/validation/validation.js

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,19 @@ define([
1313
$.each({
1414
'validate-grouped-qty': [
1515
function (value, element, params) {
16-
var result = false,
17-
total = 0;
16+
var result = true,
17+
total = 0,
18+
inputVal = parseFloat($(element).val()) || 0;
1819

19-
$(params).find('input[data-validate*="validate-grouped-qty"]').each(function (i, e) {
20-
var val = $(e).val(),
21-
valInt;
22-
23-
if (val && val.length > 0) {
24-
result = true;
25-
valInt = parseFloat(val) || 0;
20+
if (inputVal < 0) {
21+
result = false;
22+
}
2623

27-
if (valInt >= 0) {
28-
total += valInt;
29-
} else {
30-
result = false;
24+
$(params).find('input[data-validate*="validate-grouped-qty"]').each(function (i, e) {
25+
var groupedVal = parseFloat($(e).val()) || 0;
3126

32-
return result;
33-
}
27+
if (groupedVal >= 0) {
28+
total += groupedVal;
3429
}
3530
});
3631

0 commit comments

Comments
 (0)