mike/playwright.config.ts
Amal 94987e6bd7 test: Playwright e2e suite (auth, chat, projects, tabular reviews, workflows)
Port of the amal66/mike fork's Playwright end-to-end suite onto the
upstream backend/ + frontend/ layout:

- e2e/: auth.setup (bootstraps a confirmed e2e@mike.local user via the
  Supabase admin API and saves storageState), auth-flows, critical-path
  (create project -> upload PDF -> ask a question -> streamed response),
  chat-management, project-management, tabular-reviews,
  workflows-account; fixtures/test.pdf
- playwright.config.ts: single-worker (shared test user), setup project
  + chromium project with saved auth state; webServer adapted from the
  fork's monorepo command (npm run dev --workspace apps/web) to
  upstream's layouts: backend `npm run dev` (health-checked on :3001)
  and frontend `npm run dev` (:3000)
- root package.json (upstream has none): @playwright/test, typescript
  dev-deps and test:e2e scripts, trimmed from the fork's root manifest
- root tsconfig.json scoped to e2e/ + playwright.config.ts so
  `npx tsc --noEmit` typechecks the suite
- .gitignore: playwright artifacts + e2e/.auth (session tokens)

Specs select by ARIA role/name and placeholder text only - no
data-testid attributes, so no app-code changes are required.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CEguyEgXa9JjCciXCcVemC
2026-07-20 09:52:46 -07:00

65 lines
2.1 KiB
TypeScript

import { defineConfig, devices } from "@playwright/test";
/**
* Run `npx playwright install` to download the browsers.
* See https://playwright.dev/docs/test-configuration.
*/
export default defineConfig({
testDir: "./e2e",
/* These E2E tests run against a single shared backend and a single shared
test user (e2e@mike.local). Running them concurrently causes data races
on shared list views (projects/chats/workflows) and on the user's
session, producing flaky pass/fail that can't be trusted for regression
detection. So we run strictly one test at a time. */
fullyParallel: false,
workers: 1,
/* Fail the build on CI if you accidentally left test.only in the source */
forbidOnly: !!process.env.CI,
/* Retry on CI only */
retries: process.env.CI ? 2 : 0,
/* Reporter */
reporter: process.env.CI ? "github" : "list",
/* Shared settings for all the projects below */
use: {
baseURL: process.env.PLAYWRIGHT_BASE_URL ?? "http://localhost:3000",
trace: "on-first-retry",
screenshot: "only-on-failure",
},
projects: [
/* Run the auth setup before all other tests */
{
name: "setup",
testMatch: /auth\.setup\.ts/,
},
{
name: "chromium",
use: {
...devices["Desktop Chrome"],
storageState: "e2e/.auth/user.json",
},
dependencies: ["setup"],
},
],
/* Start the backend and the Next.js dev server when running locally */
webServer: process.env.CI
? undefined
: [
{
command: "npm run dev",
cwd: "backend",
url: "http://localhost:3001/health",
reuseExistingServer: true,
timeout: 120_000,
},
{
command: "npm run dev",
cwd: "frontend",
url: "http://localhost:3000",
reuseExistingServer: true,
timeout: 120_000,
},
],
});