Guest User

Untitled

a guest
Oct 22nd, 2017
382
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. describe('Log In', () => {
  2. it('succesfully performs login action', () => {
  3. ...
  4. });
  5. it('displays error message when login fails', () => {
  6. // go directly to login path
  7. cy.visit('/login');
  8. // try to log in with incorect credentials
  9. cy
  10. .get('input')
  11. .first()
  12. .type('test@email.com');
  13. cy.get('input[type=password]').type('password');
  14. cy.get('button[type=submit]').click();
  15. // Erro message should appear
  16. cy.contains('Something went wrong');
  17. });
  18. it('redirects unauthorized users', () => {
  19. // go to protected ptah
  20. cy.visit('/c');
  21. // we should be redirected to login page
  22. cy.url().should('contains', '/login');
  23. });
  24. });
Add Comment
Please, Sign In to add comment