Make a cypress test for a page with the following requirements: 1. Should have a login…
- User
Make a cypress test for a page with the following requirements:
- Should have a login button
- Should show error if password is incorrect
- Should have button to redirect to registration page
- Assistant
Here is an example of a Cypress test that meets the specified requirements for a page with a login button, an error message for incorrect passwords, and a button to redirect to a registration page:
codedescribe('Login page', () => { beforeEach(() => { cy.visit('/login') }) it('has a login button', () => { cy.get('[data-testid="login-button"]').should('exist') }) it('displays an error message for incorrect password', () => { cy.get('[data-testid="password-input"]').type('wrongpassword') cy.get('[data-testid="login-button"]').click() cy.get('[data-testid="error-message"]').should('contain', 'Incorrect password') }) it('redirects to registration page when registration button is clicked', () => { cy.get('[data-testid="register-button"]').click() cy.url().should('include', '/register') }) })