Guest User

Untitled

a guest
Dec 8th, 2018
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. context("Login", () => {
  2. beforeEach(() => {
  3. cy.visit("localhost:8080/login");
  4. });
  5.  
  6. it("can find and type in email", () => {
  7. cy.get("#email")
  8. .type("fake@email.com")
  9. .should("have.value", "fake@email.com");
  10. });
  11.  
  12. it("can find and type in password", () => {
  13. cy.get("#password")
  14. .type("fakepassword")
  15. .should("have.value", "fakepassword");
  16. });
  17.  
  18. it("will fail when type invalid user credentials", () => {
  19. cy.get("#email").type("fake@email.com");
  20.  
  21. cy.get("#password").type("fakepassword");
  22.  
  23. cy.get("input[type=submit]").click();
  24.  
  25. cy.get("#login-message").should("have.text", "Login failed");
  26. });
  27.  
  28. it("will fail when type invalid password with valid user", () => {
  29. cy.get("#email").type("fake@email.com");
  30.  
  31. cy.get("#password").type("abc");
  32.  
  33. cy.get("input[type=submit]").click();
  34.  
  35. cy.get("#login-message").should("have.text", "Login failed");
  36. });
  37.  
  38. it("will succeed when type valid user credentials", () => {
  39. cy.get("#email").type("a@b.com");
  40.  
  41. cy.get("#password").type("abc");
  42.  
  43. cy.get("input[type=submit]").click();
  44.  
  45. cy.get("#login-message").should("not.have.text", "Login failed");
  46.  
  47. cy.location("pathname").should("include", "/user/profile");
  48. });
  49. });
Add Comment
Please, Sign In to add comment