From 5759a88e94af545e647cf89cadd406d635135dcf Mon Sep 17 00:00:00 2001 From: minnakt Date: Fri, 8 Sep 2023 11:30:03 -0400 Subject: [PATCH] Slightly better Cypress assertions --- cypress/integration/auth.ts | 7 ++++--- src/context/auth.test.tsx | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/cypress/integration/auth.ts b/cypress/integration/auth.ts index a70a8638e2..02ac94a4f1 100644 --- a/cypress/integration/auth.ts +++ b/cypress/integration/auth.ts @@ -9,11 +9,12 @@ 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"); @@ -21,11 +22,11 @@ describe("Auth", () => { 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"); }); }); diff --git a/src/context/auth.test.tsx b/src/context/auth.test.tsx index de9ebad158..e534e53a38 100644 --- a/src/context/auth.test.tsx +++ b/src/context/auth.test.tsx @@ -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, });