clipwright/dashboard/e2e/playwright.config.js
pedro-bento 91a5465f81
All checks were successful
CI / unit (push) Successful in 45s
CI / backend-e2e (push) Successful in 1m16s
CI / dashboard-e2e (push) Successful in 2m29s
chore: drop watermark feature, CLI, docs, design.md; consolidate requirements (#6)
- Remove the watermark feature end to end (watermarked.py, apply_watermark/
  mark_delivery/watermark_filter, WATERMARK env, assets/) and its tests; self-host
  delivery is now unconditionally clean.
- Delete the unused cli/ package and .github/workflows/publish-cli.yml.
- Delete docs/ (compliance) and design.md; drop the dangling references in the
  legal page and the design-token/ui comments.
- Consolidate requirements: requirements.txt (runtime) + requirements-test.txt
  (unit + E2E); remove requirements-e2e.txt and requirements-ml-e2e.txt and
  point both CI jobs at the single test file. Add libgl1 to the unit job
  (scenedetect -> opencv-python links libGL).

Verified in the CI container: unit 701 passed; API E2E 209; pipeline E2E 127;
Playwright 19 passed / 1 skipped.

Reviewed-on: #6
Co-authored-by: pedro-bento <mail@pbento.pt>
Co-committed-by: pedro-bento <mail@pbento.pt>
2026-10-05 11:11:37 +01:00

94 lines
3.3 KiB
JavaScript

// Browser E2E config. Two projects:
// - `mock` (default): every network edge is intercepted, no retries, one
// worker. This is the lane that must stay green in CI.
// - `real`: drives the real backend (uvicorn + stub pipeline). Kept separate
// so the mocked lane never depends on Python.
//
// The `real` project and its backend webServer only exist when CW_E2E_REAL is
// set (CI sets it). A bare `npm run test:e2e` therefore stays mock-only and
// needs no Python deps.
/* global process */
import { defineConfig, devices } from '@playwright/test';
import { fileURLToPath } from 'node:url';
import path from 'node:path';
const dashboardDir = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
const repoRoot = path.resolve(dashboardDir, '..');
const realBackend = !!process.env.CW_E2E_REAL;
const webServers = [
{
command: 'npm run build && npx vite preview --port 4173 --strictPort --host 127.0.0.1',
cwd: dashboardDir,
url: 'http://127.0.0.1:4173',
reuseExistingServer: !process.env.CI,
timeout: 120_000,
stdout: 'ignore',
stderr: 'pipe',
},
];
if (realBackend) {
// Real `uvicorn clipwright.api.app:app` with the pipeline's stub_env on
// PYTHONPATH: sitecustomize stubs the ML/network edges so the real CLI runs
// with real ffmpeg, no model downloads and no outbound requests. The env
// values mirror tests/e2e/pipeline's deterministic, no-ML configuration.
webServers.push({
command: 'python -m uvicorn clipwright.api.app:app --host 127.0.0.1 --port 8000 --log-level warning',
cwd: repoRoot,
url: 'http://127.0.0.1:8000/health',
reuseExistingServer: !process.env.CI,
timeout: 120_000,
stdout: 'ignore',
stderr: 'pipe',
env: {
PYTHONPATH: ['tests/e2e/pipeline/stub_env', '.'].join(path.delimiter),
GEMINI_API_KEY: 'test',
MIN_SOURCE_SECONDS: '0',
QUALITY_GATE_MIN_HEIGHT: '0',
AUTO_LAYOUT: '0',
SCENE_ENGINE: 'pyscenedetect',
ASR_HOST_SLOTS: '0',
FFMPEG_ENCODER: 'x264',
TZ: 'UTC',
},
});
}
export default defineConfig({
testDir: './specs',
// No retries anywhere: a flaky test is a bug, not a coin flip.
retries: 0,
// One worker keeps the shared preview server and the deterministic fixtures
// predictable.
workers: 1,
fullyParallel: false,
timeout: 30_000,
expect: { timeout: 5_000 },
reporter: [['list']],
outputDir: './.test-results',
globalSetup: './fixtures/global-setup.js',
use: {
baseURL: 'http://127.0.0.1:4173',
trace: 'retain-on-failure',
screenshot: 'only-on-failure',
video: 'retain-on-failure',
},
projects: [
{
name: 'mock',
testIgnore: /real-backend\.spec\.js/,
use: { ...devices['Desktop Chrome'] },
},
// The real lane runs the full pipeline, which needs more than the 30s
// default. Gated so a mock-only run never tries to boot Python.
...(realBackend ? [{
name: 'real',
testMatch: /real-backend\.spec\.js/,
timeout: 120_000,
use: { ...devices['Desktop Chrome'] },
}] : []),
],
webServer: webServers,
});