Skip to content

Commit e6d398e

Browse files
committed
feat: add Cypress E2E tests for shop flow
1 parent 9eb5c95 commit e6d398e

File tree

4 files changed

+2123
-59
lines changed

4 files changed

+2123
-59
lines changed

frontend/cypress.config.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
const { defineConfig } = require('cypress');
2+
3+
module.exports = defineConfig({
4+
e2e: {
5+
baseUrl: 'http://localhost:5173',
6+
supportFile: false,
7+
},
8+
});

frontend/cypress/e2e/shop.cy.js

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
describe('Zappify Shop Flow', () => {
2+
beforeEach(() => {
3+
cy.visit('/');
4+
});
5+
6+
it('loads the homepage with products', () => {
7+
cy.contains('Zappify').should('be.visible');
8+
cy.get('.product-card').should('have.length.greaterThan', 0);
9+
});
10+
11+
it('can search for a product', () => {
12+
cy.get('input[placeholder*="looking for"]').type('Nike');
13+
cy.get('.product-card').should('have.length.greaterThan', 0);
14+
});
15+
16+
it('can open product detail page', () => {
17+
cy.get('.product-card').first().click();
18+
cy.contains('ADD TO CART').should('be.visible');
19+
cy.contains('SELECT SIZE').should('be.visible');
20+
});
21+
22+
it('can add product to cart', () => {
23+
cy.get('.product-card').first().click();
24+
cy.get('.size-btn').first().click();
25+
cy.contains('ADD TO CART').click();
26+
cy.contains('added to cart').should('be.visible');
27+
});
28+
29+
it('can open cart drawer', () => {
30+
cy.get('[title="Cart"]').click();
31+
cy.contains('SHOPPING BAG').should('be.visible');
32+
});
33+
34+
it('can open wishlist drawer', () => {
35+
cy.get('[title="Wishlist"]').click();
36+
cy.contains('MY WISHLIST').should('be.visible');
37+
});
38+
39+
it('login flow works', () => {
40+
cy.get('[title="Profile"]').click();
41+
cy.contains('Welcome Back').should('be.visible');
42+
cy.get('input[placeholder="Email Address"]').type('test@zappify.com');
43+
cy.get('input[placeholder="Password"]').type('test123');
44+
cy.contains('SIGN IN').click();
45+
});
46+
});

0 commit comments

Comments
 (0)