Skip to content

Commit

Permalink
fix(test): improve /logout testing
Browse files Browse the repository at this point in the history
  • Loading branch information
connordoman committed Dec 4, 2023
1 parent d8e3c8a commit 8218455
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions app/web/cypress/e2e/logout.cy.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,23 @@
describe("Logout page", () => {
beforeEach(() => {
cy.visit("/login");
cy.get("input[name=email]").type("johnny@example.com");
cy.get("input[name=password]").type("password");
cy.get("button[type=submit]").click();
cy.wait(250);
});
beforeEach(() => {});

it("should redirect a logged out user to login", () => {
cy.visit("/logout");
cy.wait(250);
cy.visit("/logout");
cy.wait(250);
cy.url().should("include", "/login");
});

it("should clear a user session", () => {
cy.visit("/login");
cy.get("input[name=email]").type("johnny@example.com");
cy.get("input[name=password]").type("password");
cy.get("button[type=submit]").click();
cy.wait(250);
cy.url().should("match", /\/$/);
cy.visit("/logout");
cy.wait(250);
cy.visit("/user/dashboard");
cy.wait(250);
cy.wait(500);
cy.url().should("include", "/login");
});
});

0 comments on commit 8218455

Please sign in to comment.