Skip to content

Commit

Permalink
Create test for the homepage and products visibility
Browse files Browse the repository at this point in the history
  • Loading branch information
rdpfeifle committed Jan 8, 2024
1 parent 9e4572b commit 017f663
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
31 changes: 31 additions & 0 deletions cypress/e2e/products.cy.js
Original file line number Diff line number Diff line change
@@ -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
});
1 change: 0 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Urban Grace - Discover our latest range of products including women's clothing, jewelry, and more. Enjoy special discounts and early access as a community member.">
<title>Urban Grace</title>
<title>Urban Grace</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap" rel="stylesheet">
Expand Down

0 comments on commit 017f663

Please sign in to comment.