Skip to content

Commit

Permalink
Merge branch 'develop' into auth-acc-order-beta
Browse files Browse the repository at this point in the history
  • Loading branch information
Ferri0 authored Dec 7, 2024
2 parents cdb8af0 + a81ba3c commit 8494af6
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions cypress/src/tests/e2eTests/events/add-to-cart.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { products } from "../../../fixtures";
import { expectsEventWithContext } from "../../../assertions";
/**
* https://github.com/adobe/commerce-events/blob/main/examples/events/add-to-cart.md
*
* Required Contexts: page, storefront, product, shoppingCart, changedProducts
*/

it("is sent on add to cart button click", () => {
cy.visit(products.configurable.urlPathWithOptions);
// add to cart
cy.get(".product-details__buttons__add-to-cart button")
.should("be.visible")
.click();

cy.waitForResource("commerce-events-collector.js").then(() => {
cy.window()
.its("adobeDataLayer")
.then((adobeDataLayer) => {
expectsEventWithContext(
"add-to-cart",
[
"pageContext",
"storefrontInstanceContext",
"productContext",
"shoppingCartContext",
"changedProductsContext",
],
adobeDataLayer
);
});
});
});

0 comments on commit 8494af6

Please sign in to comment.