import { test, expect } from "@playwright/test"; import { signInAs, BASE } from "./dev"; const TAB_LABELS = [ "Home", "Schedule", "Events", "Media", "Roster", "Training", "Announcements", "Settings", ]; test.describe("app shell", () => { test("renders the shell with 8 nav tabs at a 360px viewport", async ({ page }) => { await page.setViewportSize({ width: 360, height: 780 }); await signInAs(page, `e2e-mobile-${Date.now()}@example.com`); await page.goto(`${BASE}/schedule`); await expect(page).toHaveURL(`${BASE}/schedule`); // Header + page title. await expect(page.getByRole("heading", { name: "Schedule", level: 1 })).toBeVisible(); // One tab per primary destination. for (const label of TAB_LABELS) { await expect(page.getByRole("link", { name: label, exact: true })).toBeVisible(); } // The current tab is marked active. await expect(page.getByRole("link", { name: "Schedule" })).toHaveAttribute( "aria-current", "page", ); // The schedule grid renders (unit D7): role columns and an instance row. await expect(page.getByText("Audio")).toBeVisible(); await expect(page.getByText("Livestream")).toBeVisible(); await expect(page.getByText("Slides")).toBeVisible(); }); test("shows the desktop rail inside the shell at desktop width", async ({ page }) => { await page.setViewportSize({ width: 1024, height: 768 }); await signInAs(page, `e2e-desktop-${Date.now()}@example.com`); await page.goto(`${BASE}/roster`); for (const label of TAB_LABELS) { await expect(page.getByRole("link", { name: label, exact: true })).toBeVisible(); } // Active tab follows the route. await expect(page.getByRole("link", { name: "Roster" })).toHaveAttribute( "aria-current", "page", ); }); test("redirects unauthenticated users away from the shell", async ({ page }) => { await page.setViewportSize({ width: 360, height: 780 }); await page.goto(`${BASE}/schedule`); await expect(page).toHaveURL(`${BASE}/login`); }); }); test.describe("health", () => { test("/api/health returns ok", async ({ request }) => { const res = await request.get(`${BASE}/api/health`); expect(res.ok()).toBe(true); const body = (await res.json()) as { status: string }; expect(body.status).toBe("ok"); }); });