|
1 | 1 | import UserBuilder from "../../../libs/user.builder";
|
2 | 2 |
|
3 | 3 | describe("Page Signup", function() {
|
| 4 | + before(function() { |
| 5 | + Cypress.Cookies.debug(true); |
| 6 | + }); |
| 7 | + |
4 | 8 | it("Open page on Desktop", function() {
|
5 | 9 | cy.visit("/auth/signup");
|
6 | 10 | });
|
@@ -66,26 +70,32 @@ describe("Page Signup", function() {
|
66 | 70 |
|
67 | 71 | it("Send the form with the fields name, email and password valid", function() {
|
68 | 72 | const { name, email, password } = UserBuilder.randomUserInfo();
|
69 |
| - console.log(name); |
70 | 73 |
|
71 | 74 | cy.visit("/auth/signup");
|
72 | 75 | cy.get("input[name=name]").type(name);
|
73 | 76 | cy.get("input[name=email]").type(email);
|
74 | 77 | cy.get("input[name=password]").type(password);
|
75 | 78 | cy.contains("Enviar").click();
|
| 79 | + cy.location("pathname").should("include", "dashboard"); |
76 | 80 | });
|
77 | 81 |
|
78 |
| - it("Send the form with all fields valid and verify if the JWT cookie is save", function() { |
| 82 | + it("Verify if the cookie jwt was create", function() { |
79 | 83 | const { name, email, password } = UserBuilder.randomUserInfo();
|
80 |
| - Cypress.Cookies.debug(true); |
81 | 84 |
|
| 85 | + cy.clearCookies(); |
82 | 86 | cy.visit("/auth/signup");
|
83 | 87 | cy.get("input[name=name]").type(name);
|
84 | 88 | cy.get("input[name=email]").type(email);
|
85 | 89 | cy.get("input[name=password]").type(password);
|
86 | 90 | cy.contains("Enviar").click();
|
87 |
| - cy.clearCookie("jjj"); |
88 |
| - cy.setCookie("jjj", "thing"); |
89 |
| - cy.getCookie("jjj").should("have.property", "value", "thing"); |
| 91 | + cy.location("pathname").should("include", "dashboard"); |
| 92 | + cy.contains("Dashboard").then(function() { |
| 93 | + cy.getCookie("jwt") |
| 94 | + .should("have.property", "value") |
| 95 | + .and( |
| 96 | + "match", |
| 97 | + /^[A-Za-z0-9-_=]+\.[A-Za-z0-9-_=]+\.?[A-Za-z0-9-_.+/=]*$/ |
| 98 | + ); |
| 99 | + }); |
90 | 100 | });
|
91 | 101 | });
|
0 commit comments