Files
voicebox/e2e/playwright.config.ts
Jamie Pine 37b7110e52 test: Playwright E2E with real backend + fake TTS engine
e2e/ drives the web build (vite preview) against a per-worker uvicorn:
each Playwright worker boots its own backend on its own port with a
temp cwd, so SQLite and audio files are fully isolated and parallel-
safe. The page fixture seeds the persisted voicebox-server store with
the worker's URL before any script runs.

VOICEBOX_FAKE_TTS=1 short-circuits get_tts_backend_for_engine to a
backend that synthesizes a sine tone sized to the text — the real task
queue, SSE progress, history rows, and audio serving all run, only
inference is fake. backend/requirements-ci.txt is the slim dependency
set validated to boot the app on a CPU-only runner.

Specs: startup, settings layout, seeded profile in /voices, and
generate-to-completed-audio through the full pipeline.
2026-08-08 15:40:36 -07:00

37 lines
1.1 KiB
TypeScript

import { defineConfig, devices } from '@playwright/test';
/**
* E2E suite driving the web build (same app as Tauri, browser platform)
* against a real CPU backend with the fake TTS engine. Each worker gets
* its own uvicorn on its own port with its own data dir — see fixtures.ts.
*
* PW_DEV=1 targets `bun run dev:web` (port 5173) instead of the preview
* build for faster local iteration.
*/
const DEV = !!process.env.PW_DEV;
const PORT = DEV ? 5173 : 4173;
export default defineConfig({
testDir: './specs',
fullyParallel: true,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 1 : 0,
reporter: process.env.CI ? [['html', { open: 'never' }], ['github']] : 'list',
use: {
baseURL: `http://localhost:${PORT}`,
trace: 'on-first-retry',
video: 'retain-on-failure',
screenshot: 'only-on-failure',
},
projects: [{ name: 'chromium', use: { ...devices['Desktop Chrome'] } }],
webServer: {
command: DEV
? 'bun run dev:web'
: 'bun run build:web && cd web && bunx vite preview --port 4173 --strictPort',
cwd: '..',
port: PORT,
reuseExistingServer: !process.env.CI,
timeout: 120_000,
},
});