Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- describe('Log In', () => {
- it('succesfully performs login action', () => {
- ...
- });
- it('displays error message when login fails', () => {
- // go directly to login path
- cy.visit('/login');
- // try to log in with incorect credentials
- cy
- .get('input')
- .first()
- .type('test@email.com');
- cy.get('input[type=password]').type('password');
- cy.get('button[type=submit]').click();
- // Erro message should appear
- cy.contains('Something went wrong');
- });
- it('redirects unauthorized users', () => {
- // go to protected ptah
- cy.visit('/c');
- // we should be redirected to login page
- cy.url().should('contains', '/login');
- });
- });
Add Comment
Please, Sign In to add comment