Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: addToCart takes actual product code into account #18731

Merged
merged 24 commits into from May 7, 2024

Conversation

ChristophHi
Copy link
Contributor

No description provided.

Comment on lines 50 to 51
* Was the product added to the cart merged into an existing cart entry (with increased quantity),
* or did the system create a new cart entry?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: The question mark in the end of the sentence is a bit confusing. What about:

Suggested change
* Was the product added to the cart merged into an existing cart entry (with increased quantity),
* or did the system create a new cart entry?
* Tells whether the product added to the cart was merged into an existing cart entry (with increased quantity),
* or the system created a new cart entry.

@@ -72,6 +72,7 @@ export class CartAddEntrySuccessEvent extends CartEvent {
entry?: OrderEntry;
quantityAdded?: number;
deliveryModeChanged?: boolean;
pickupStore?: string;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this change really related to this PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is related (because we need to display the pickup store name in the confirmation dialogue).
But still this is a good hint, on a second look I saw that this information can also be derived from the cart modification via entry.deliveryPointOfService.name, then the event does not need to be touched!

@@ -43,6 +43,12 @@ export interface FeatureTogglesInterface {
*/
productConfiguratorAttributeTypesV2?: boolean;

/**
* The addedToCart dialog is driven by 'CartAddEntrySuccessEvent'. Previously it was driven
* by 'CartUiEventAddToCart event. Code changes affect 'AddedToCartDialogEventListener'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* by 'CartUiEventAddToCart event. Code changes affect 'AddedToCartDialogEventListener'
* by 'CartUiEventAddToCart' event. Code changes affect 'AddedToCartDialogEventListener'

protected calculateEntryWasMerged(
successEvent: CartAddEntrySuccessEvent
): boolean {
// In case quantityAdded zero, the system could have run into stock issues.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From unit tests and implementation I understood that in case of stock issues the property quantityAdded is undefined (not 0).

So what about updating the comment:

Suggested change
// In case quantityAdded zero, the system could have run into stock issues.
// In case `quantityAdded` is `undefined`, the system could have run into stock issues.

Btw. IMHO we could turn this inline comment in to a fully-fledged JSDoc of this method.

@ChristophHi ChristophHi marked this pull request as ready for review May 7, 2024 06:48
@ChristophHi ChristophHi requested a review from a team as a code owner May 7, 2024 06:48
Copy link

cypress bot commented May 7, 2024

4 flaky tests on run #43499 ↗︎

0 119 2 0 Flakiness 4

Details:

Merge a9e599f into 4a9fe91...
Project: spartacus Commit: 4c7206c960 ℹ️
Status: Passed Duration: 04:46 💡
Started: May 7, 2024 6:57 AM Ended: May 7, 2024 7:02 AM
Flakiness  regression/checkout/checkout-flow.core-e2e.cy.ts • 1 flaky test • B2C

View Output Video

Test Artifacts
Checkout flow > Desktop > should checkout with a registered user Test Replay Screenshots Video
Flakiness  ssr/pages.core-e2e.cy.ts • 3 flaky tests • SSR

View Output Video

Test Artifacts
SSR > should render homepage Test Replay Screenshots Video
SSR > should render PLP Test Replay Screenshots Video
SSR > should render PDP Test Replay Screenshots Video

Review all test suite changes for PR #18731 ↗︎

@ChristophHi ChristophHi merged commit 541f7d3 into develop May 7, 2024
26 checks passed
@ChristophHi ChristophHi deleted the fix/CXSPA-6791-addToCart branch May 7, 2024 11:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants