Skip to content

Commit 359ea71

Browse files
committed
ACP2E-23: [Magento Cloud] Error message in PDP disappearing quickly
1 parent 7ba2b79 commit 359ea71

File tree

3 files changed

+64
-8
lines changed

3 files changed

+64
-8
lines changed

app/code/Magento/Catalog/Test/Mftf/Data/CatalogConfigurationData.xml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,18 @@
2222
<data key="label">Website</data>
2323
<data key="value">1</data>
2424
</entity>
25+
<!-- Catalog > Recently Viewed/Compared Products > Synchronize Widget Products With Backend Storage -->
26+
<entity name="DisableSynchronizeWidgetProductsWithBackendStorage">
27+
<!-- Default configuration -->
28+
<data key="path">catalog/recently_products/synchronize_with_backend</data>
29+
<data key="scope_id">0</data>
30+
<data key="label">No</data>
31+
<data key="value">0</data>
32+
</entity>
33+
<entity name="EnableSynchronizeWidgetProductsWithBackendStorage">
34+
<data key="path">catalog/recently_products/synchronize_with_backend</data>
35+
<data key="scope_id">0</data>
36+
<data key="label">Yes</data>
37+
<data key="value">1</data>
38+
</entity>
2539
</entities>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
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+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
9+
<test name="StorefrontAddProductToCartVerifyThatErrorMessageShouldNotDisappearTest">
10+
<annotations>
11+
<title value="Adding a product to cart from product detail page with higher quantity then available when synchronize widget products with backend storage enabled"/>
12+
<description value="Adding a product to cart from product detail page with higher quantity then available when synchronize widget products with backend storage enabled"/>
13+
<features value="Module/ Catalog"/>
14+
<severity value="AVERAGE"/>
15+
<testCaseId value="AC-1571"/>
16+
<useCaseId value="ACP2E-23"/>
17+
<stories value="[Magento Cloud] Error message in PDP disappearing quickly"/>
18+
<group value="customer"/>
19+
</annotations>
20+
21+
<before>
22+
<!-- Set in Stores > Configuration > Catalog > Catalog > > Recently Viewed/Compared Products > Synchronize Widget Products With Backend Storage = "Yes" -->
23+
<magentoCLI command="config:set {{EnableSynchronizeWidgetProductsWithBackendStorage.path}} {{EnableSynchronizeWidgetProductsWithBackendStorage.value}}" stepKey="setEnableSynchronizeWidgetProductsWithBackendStorage"/>
24+
<createData entity="_defaultCategory" stepKey="createCategory"/>
25+
<createData entity="_defaultProduct" stepKey="createSimpleProduct">
26+
<requiredEntity createDataKey="createCategory"/>
27+
</createData>
28+
<magentoCron stepKey="runCronReindex" groups="index"/>
29+
</before>
30+
<after>
31+
<deleteData createDataKey="createSimpleProduct" stepKey="deleteProduct"/>
32+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
33+
<magentoCLI command="config:set {{DisableSynchronizeWidgetProductsWithBackendStorage.path}} {{DisableSynchronizeWidgetProductsWithBackendStorage.value}}" stepKey="setDisableSynchronizeWidgetProductsWithBackendStorage"/>
34+
</after>
35+
36+
<actionGroup ref="StorefrontOpenProductEntityPageActionGroup" stepKey="openProductPage">
37+
<argument name="product" value="$$createSimpleProduct$$"/>
38+
</actionGroup>
39+
40+
<fillField selector="{{StorefrontProductInfoMainSection.qty}}" userInput="1001" stepKey="fillQuantity"/>
41+
42+
<actionGroup ref="StorefrontProductPageAddSimpleProductToCartActionGroup" stepKey="addProductToCart"/>
43+
<!-- Check that error remains -->
44+
<see userInput="The requested qty is not available" stepKey="assertProductErrorRemains"/>
45+
</test>
46+
</tests>

app/code/Magento/Customer/view/frontend/web/js/customer-data.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -176,10 +176,9 @@ define([
176176
*/
177177
update: function (sections) {
178178
var sectionId = 0,
179-
sectionDataIds = $.cookieStorage.get('section_data_ids') || {},
180-
pdpSectionsNames = ['cart', 'directory-data', 'messages'];
179+
sectionDataIds = $.cookieStorage.get('section_data_ids') || {};
181180

182-
if (_.isArray(_.keys(sections)) && _.isEqual(pdpSectionsNames, _.keys(sections))) {
181+
if ($.inArray('cart', _.keys(sections)) !== -1) {
183182
$.cookieStorage.set('pdp_qty_error', true);
184183
}
185184

@@ -189,11 +188,8 @@ define([
189188
storage.set(sectionName, sectionData);
190189
storageInvalidation.remove(sectionName);
191190

192-
if (_.keys(sections).length === 1) {
193-
194-
if (_.isEmpty(sectionData.messages) && $.cookieStorage.get('pdp_qty_error')) {
195-
return;
196-
}
191+
if (_.isEmpty(sectionData.messages) && $.cookieStorage.get('pdp_qty_error')) {
192+
return;
197193
}
198194
buffer.notify(sectionName, sectionData);
199195
});

0 commit comments

Comments
 (0)