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 1/2] 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 From ce0be57f41a394866f2b1057677c6f54caa6d087 Mon Sep 17 00:00:00 2001 From: rdpcodes <54380958+rdpfeifle@users.noreply.github.com> Date: Mon, 8 Jan 2024 15:35:45 -0700 Subject: [PATCH 2/2] Change test name in products.cy.js --- cypress/e2e/products.cy.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/cypress/e2e/products.cy.js b/cypress/e2e/products.cy.js index ccb3db3..2dea03c 100644 --- a/cypress/e2e/products.cy.js +++ b/cypress/e2e/products.cy.js @@ -3,7 +3,7 @@ describe("Homepage functionality and products visibility", () => { cy.visit("../../index.html"); }); - it("should correctly display the application's title", () => { + it("should have 'Urban Grace' as the page title", () => { cy.title().should("equal", "Urban Grace"); }); @@ -22,10 +22,4 @@ describe("Homepage functionality and products visibility", () => { 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 });