Skip to content
This repository has been archived by the owner on Jul 2, 2024. It is now read-only.

Commit

Permalink
Slightly better Cypress assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
minnakt committed Sep 8, 2023
1 parent aebc2bb commit 5759a88
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions cypress/integration/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,24 @@ describe("Auth", () => {
cy.logout();
cy.visit("/");
cy.enterLoginCredentials();
cy.url().should("include", "/user/admin/patches");
cy.location("pathname").should("equal", "/user/admin/patches");
});

it("Can log out via the dropdown", () => {
cy.visit("/");
cy.location("pathname").should("equal", "/user/admin/patches");
cy.dataCy("user-dropdown-link").click();
cy.dataCy("log-out").click();
cy.location("pathname").should("equal", "/login");
});

it("Automatically authenticates user if they are logged in", () => {
cy.visit("/version/123123");
cy.url().should("include", "/version/123123");
cy.location("pathname").should("equal", "/version/123123");
});

it("Redirects user to their patches page if they are already logged in and visit login page", () => {
cy.visit("/login");
cy.url().should("include", "/user/admin/patches");
cy.location("pathname").should("equal", "/user/admin/patches");
});
});
2 changes: 1 addition & 1 deletion src/context/auth.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ describe("auth", () => {
beforeEach(() => {
Object.defineProperty(window, "location", {
value: {
href: "http://just-a-placeholder.com",
href: "https://just-a-placeholder.com",
},
writable: true,
});
Expand Down

0 comments on commit 5759a88

Please sign in to comment.