Skip to content
File

Blob: tests/e2e/specs/05-auth-guards.spec.ts

typescript23 lines
1import { LOGIN_URL_PATTERN, test, expect } from "../fixtures/anvil-test";
2 
3test.describe("Auth guards", () => {
4 test("redirects unauthenticated user from protected routes to login", async ({ livePage }) => {
5 await livePage.goto("/app/projects");
6 await livePage.waitForURL(LOGIN_URL_PATTERN);
7 
8 await livePage.goto("/app/projects/new");
9 await livePage.waitForURL(LOGIN_URL_PATTERN);
10 
11 await livePage.goto("/app/me");
12 await livePage.waitForURL(LOGIN_URL_PATTERN);
13 });
14 
15 test("landing page is accessible without authentication", async ({ livePage }) => {
16 await livePage.goto("/");
17 
18 // Use a specific heading from the landing page hero section.
19 await expect(livePage.getByRole("link", { name: "anvil Edge-native CI" })).toBeVisible();
20 await expect(livePage).toHaveURL(/\/$/);
21 });
22});