From 017f663e1be91956b8d12b094518a46cf299a7f6 Mon Sep 17 00:00:00 2001 From: rdpcodes <54380958+rdpfeifle@users.noreply.github.com> Date: Mon, 8 Jan 2024 14:10:24 -0700 Subject: [PATCH] Create test for the homepage and products visibility --- cypress/e2e/products.cy.js | 31 +++++++++++++++++++++++++++++++ index.html | 1 - 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 cypress/e2e/products.cy.js diff --git a/cypress/e2e/products.cy.js b/cypress/e2e/products.cy.js new file mode 100644 index 0000000..ccb3db3 --- /dev/null +++ b/cypress/e2e/products.cy.js @@ -0,0 +1,31 @@ +describe("Homepage functionality and products visibility", () => { + beforeEach(() => { + cy.visit("../../index.html"); + }); + + it("should correctly display the application's title", () => { + cy.title().should("equal", "Urban Grace"); + }); + + it("should have at least one product displayed in the products container", () => { + cy.get("#products-container .product-container") + .its("length") + .should("be.greaterThan", 0); + }); + + it("should render product cards with all details", () => { + cy.get("#products-container").each(($product) => { + cy.wrap($product).find(".product-image").should("be.visible"); + cy.wrap($product).find(".product-title").should("be.visible"); + cy.wrap($product).find(".product-category").should("be.visible"); + cy.wrap($product).find(".product-price").should("be.visible"); + cy.wrap($product).find(".add-to-cart").should("be.visible"); + }); + }); + + // should show the - [qty] + when clicking the 'Add to Cart' + // the "add to cart" button should be invisible after clicking on it + // should update UI state when 'Add to Cart' is clicked + // should update product quantity in UI when modified + // should allow to open the cart when clicking the cart button +}); diff --git a/index.html b/index.html index bdaccf4..f310269 100644 --- a/index.html +++ b/index.html @@ -5,7 +5,6 @@ Urban Grace - Urban Grace