import path from "node:path"; import { fileURLToPath } from "node:url"; import base from './playwright.config'; /* Clip suite: MovieClip engine read, frame decode, missing source and * save/reopen, demonstrated on the upstream tripod-motion tracking fixture. * The specs instantiate WebEngineClient directly, so they run against the Vite * dev server (same convention as tracking-mask-production) rather than a built * bundle where `/src/...` module URLs do not exist. CLIP_SERVED_ROOT points the * server at a frozen snapshot (run-clip-headed.mjs --freeze); without it the * live web/app tree is served. */ const port = Number(process.env.WEB_TEST_PORT ?? 5314); const jsonOutput = process.env.PLAYWRIGHT_JSON_OUTPUT_FILE; const servedRoot = process.env.CLIP_SERVED_ROOT; const viteBin = path.join(path.dirname(fileURLToPath(import.meta.url)), "node_modules/vite/bin/vite.js"); export default { ...base, testMatch: ['clip-*-production.spec.ts'], timeout: 420_000, ...(jsonOutput ? { reporter: [...(Array.isArray(base.reporter) ? base.reporter : []), ['json', { outputFile: jsonOutput }] as const] } : {}), use: { ...base.use, baseURL: `http://127.0.0.1:${port}`, viewport: { width: 1440, height: 900 }, headless: process.env.WEB_TEST_HEADLESS === '1' ? true : base.use?.headless }, webServer: servedRoot ? { command: `node "${viteBin}" --config app/vite.config.ts --host 127.0.0.1 --port ${port} --strictPort`, cwd: servedRoot, url: `http://127.0.0.1:${port}`, reuseExistingServer: false, timeout: 30_000 } : { command: `npm run dev -- --host 127.0.0.1 --port ${port} --strictPort`, url: `http://127.0.0.1:${port}`, reuseExistingServer: false, timeout: 30_000 }, };