Skip to content

Commit

Permalink
Create user.spec.js
Browse files Browse the repository at this point in the history
  • Loading branch information
KOSASIH authored May 10, 2024
1 parent 088406d commit 97f1fca
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions test/e2e/user.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// test/e2e/user.spec.js

describe('User Feature', () => {
beforeEach(() => {
cy.visit('/');
});

it('should register a new user', () => {
cy.get('[data-testid="register-button"]').click();
cy.get('[data-testid="first-name-input"]').type('John');
cy.get('[data-testid="last-name-input"]').type('Doe');
cy.get('[data-testid="email-input"]').type('[email protected]');
cy.get('[data-testid="password-input"]').type('password123');
cy.get('[data-testid="register-form-button"]').click();
cy.get('[data-testid="welcome-message"]').should('contain', 'Welcome, John Doe');
});

it('should login a user', () => {
cy.get('[data-testid="login-button"]').click();
cy.get('[data-testid="email-input"]').type('[email protected]');
cy.get('[data-testid="password-input"]').type('password123');
cy.get('[data-testid="login-form-button"]').click();
cy.get('[data-testid="welcome-message"]').should('contain', 'Welcome, John Doe');
});
});

0 comments on commit 97f1fca

Please sign in to comment.