♻️ Redirect the user to login if we get 401/403 (#1501)

This commit is contained in:
Alejandra
2025-02-19 12:00:08 +00:00
committed by GitHub
parent 50d2a3bfe1
commit 496c7090b3
2 changed files with 27 additions and 5 deletions

View File

@@ -115,3 +115,13 @@ test("Logged-out user cannot access protected routes", async ({ page }) => {
await page.goto("/settings")
await page.waitForURL("/login")
})
test("Redirects to /login when token is wrong", async ({ page }) => {
await page.goto("/settings")
await page.evaluate(() => {
localStorage.setItem("access_token", "invalid_token")
})
await page.goto("/settings")
await page.waitForURL("/login")
await expect(page).toHaveURL("/login")
})