SPB Git

Repository Public

playwright.config.ts 3.9 KB 46 lines typescript

1import { defineConfig, devices } from "@playwright/test";23/**4 * End-to-end tests run against four real production servers, headless (the fourth, 8844, serves slide decks):5 *   - 8841: the production build (.next), committed snapshot      → what the public would see today;6 *   - 8842: the preview build (.next-preview)                      → S01 in preview + the synthetic test capsule;7 *   - 8843: the production build on a throw-away data directory    → the studio journey (e2e/.tmp/studio), with8 *           a real media worker started by the global setup.9 * Build both first (pnpm build && pnpm media:test-capsule && pnpm build:preview).10 */11export const PROD = "http://127.0.0.1:8841", PREVIEW = "http://127.0.0.1:8842";12/** The studio is addressed as `localhost`: a WebAuthn relying-party identifier cannot be an IP address. */13export const STUDIO = { base: "http://localhost:8843", data: "e2e/.tmp/studio/data", repo: "e2e/.tmp/studio/course-repo", healthToken: "e2e-health-token-0123456789abcdef" };14/** A fourth server shows decks built from hand-made PDFs: two sessions with their slides online, one imported but not published. */15export const SLIDES = { base: "http://localhost:8844", data: "e2e/.tmp/slides/data" };16export const SLIDES_ENV = { NODE_ENV: "production", ATLAS_PUBLIC_URL: SLIDES.base, ATLAS_DATA_DIR: SLIDES.data, ATLAS_LOG_LEVEL: "silent" };17export const STUDIO_ENV = {18  NODE_ENV: "production", ATLAS_PUBLIC_URL: STUDIO.base, ATLAS_DATA_DIR: STUDIO.data, ATLAS_COURSE_REPO: STUDIO.repo, ATLAS_HEALTH_TOKEN: STUDIO.healthToken,19  ATLAS_X264_PRESET: "ultrafast", ATLAS_LOG_LEVEL: "info",20};21const server = (port: number, env: Record<string, string>) => ({22  command: `node_modules/.bin/next start -p ${port} -H 127.0.0.1`, url: `http://127.0.0.1:${port}/api/health`, reuseExistingServer: false, timeout: 60_000,23  // These two servers show the committed snapshot whatever a local studio database may hold.24  env: { NODE_ENV: "production", ATLAS_PUBLIC_URL: "https://atlas.spboucher.ai", ATLAS_CONTENT_SOURCE: "seed", ATLAS_LOG_LEVEL: "silent", ...env },25});2627export default defineConfig({28  testDir: "e2e", testIgnore: /shots\.spec/, timeout: 60_000, expect: { timeout: 10_000 }, fullyParallel: false, workers: 2, reporter: [["list"]],29  globalSetup: "./e2e/global-setup.ts", globalTeardown: "./e2e/global-teardown.ts",30  use: { trace: "retain-on-failure", locale: "fr-CA" },31  projects: [32    { name: "chromium", use: { ...devices["Desktop Chrome"], viewport: { width: 1440, height: 900 } }, testIgnore: /(mobile|shots|studio)\.spec/ },33    { name: "webkit", use: { ...devices["Desktop Safari"], viewport: { width: 1440, height: 900 } }, testMatch: /(journey|production|player|slides)\.spec/ },34    { name: "firefox", use: { ...devices["Desktop Firefox"], viewport: { width: 1440, height: 900 } }, testMatch: /(journey|player)\.spec/ },35    { name: "mobile", use: { ...devices["iPhone 13"], browserName: "chromium", defaultBrowserType: "chromium", viewport: { width: 375, height: 812 } }, testMatch: /(mobile|production|slides)\.spec/ },36    // The studio journey is one ordered story on one database: a single worker, Chromium (virtual WebAuthn authenticator through CDP).37    { name: "studio", use: { ...devices["Desktop Chrome"], viewport: { width: 1440, height: 900 }, baseURL: STUDIO.base }, testMatch: /studio.*\.spec/, fullyParallel: false },38  ],39  webServer: [40    server(8841, {}), server(8842, { ATLAS_PREVIEW: "1" }),41    // A fresh data directory at every run: the command wipes it before the server starts.42    { command: `rm -rf e2e/.tmp/slides && mkdir -p ${SLIDES.data} && node_modules/.bin/next start -p 8844 -H 127.0.0.1`, url: "http://127.0.0.1:8844/api/health", reuseExistingServer: false, timeout: 60_000, env: SLIDES_ENV },43    { command: `rm -rf e2e/.tmp/studio && mkdir -p ${STUDIO.data} && node_modules/.bin/next start -p 8843 -H 127.0.0.1`, url: "http://127.0.0.1:8843/api/health", reuseExistingServer: false, timeout: 60_000, env: STUDIO_ENV },44  ],45});46
Files main
Menu

Theme