Files
beardrive/internal/webapp/frontend/e2e/shell.spec.ts
Snow LeeandClaude Fable 5 1c4e178b39 feat(webapp): [phase 1] shell, session, projects, routing
- URL as source of truth: parseRoute/urlForPath/urlForView ported verbatim
  (src/router.ts), single catch-all route so encoded slashes survive
- hub shell: project nav with color chips, org bar, admin bar with pending
  count, sign-out per session flags; volume shell renders too
- empty-state onboarding (invite paste + create project), /join/<token>
  invite accept that survives the login redirect
- toast + modal prompt/confirm primitives (imperative promise API over a
  React host, matching the classic behavior)
- e2e: 7 new hub specs (11 total green); harness gains a no-org 'solo'
  account to reach the empty state

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01P5cxPQdSGJnjXCYY9GeWXt
2026-07-13 10:07:30 -07:00

32 lines
1.2 KiB
TypeScript

import { test, expect } from "@playwright/test";
import { login } from "./helpers";
test("unauthenticated visit redirects to the login page", async ({ page }) => {
await page.goto("/");
await page.waitForURL(/auth\/login/);
await expect(page.locator('input[name="email"]')).toBeVisible();
});
test("login lands in the app shell", async ({ page }) => {
await login(page);
await expect(page).toHaveTitle(/BearDrive/); // "<project> — BearDrive" in hub mode
await expect(page.locator("#sidebar")).toBeVisible();
await expect(page.locator("#topbar")).toBeVisible();
});
test("hashed assets are served immutable, shell revalidates", async ({ page, request }) => {
await login(page);
const src = await page.locator('script[type="module"]').getAttribute("src");
expect(src).toMatch(/^\/assets\/.+\.js$/);
const asset = await request.get(src!);
expect(asset.headers()["cache-control"]).toContain("immutable");
const shell = await request.get("/");
expect(shell.headers()["cache-control"]).toBe("no-cache");
});
test("mistyped API path is a real 404, not the shell", async ({ page }) => {
await login(page); // unauthenticated /api/* is a 401 before routing
const res = await page.request.get("/api/nope");
expect(res.status()).toBe(404);
});