|
| 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