Files
hao-ai-lab-FastVideo/apps/dreamverse/web/playwright.config.ts
c2930b2aa1 [ci] Add additional Dreamverse UI tests (#1417)
Co-authored-by: SolitaryThinker <wlsaidhi@gmail.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2026-05-31 19:53:29 -07:00

64 lines
2.3 KiB
TypeScript

import { defineConfig, devices } from '@playwright/test';
const backendHost = process.env.BACKEND_HOST || '127.0.0.1';
const backendPort = process.env.BACKEND_PORT || '8009';
/**
* Playwright config for Dreamverse end-to-end tests.
*
* Tests assume the Dreamverse Python server is reachable at
* BACKEND_HOST:BACKEND_PORT (default 127.0.0.1:8009) and the Next.js frontend
* runs on port 5299. The webServer block boots the mock backend and
* `npm run dev` if no server is already listening so tests work both
* locally and in CI.
*/
export default defineConfig({
testDir: './e2e',
// Tests share a backend, so run sequentially to avoid contention on
// the single GPU pool slot during real-generation runs. Override per
// test via test.parallel if a test is safe to run alongside others.
fullyParallel: false,
workers: 1,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 0,
reporter: process.env.CI ? 'github' : 'list',
timeout: 120_000,
expect: { timeout: 30_000 },
use: {
baseURL: process.env.PLAYWRIGHT_BASE_URL ?? 'http://127.0.0.1:5299',
headless: true,
viewport: { width: 1280, height: 720 },
screenshot: 'only-on-failure',
trace: 'retain-on-failure',
video: process.env.CI ? 'retain-on-failure' : 'on',
},
projects: [
{ name: 'chromium', use: { ...devices['Desktop Chrome'] } },
{ name: 'webkit', use: { ...devices['Desktop Safari'] } },
{ name: 'firefox', use: { ...devices['Desktop Firefox'] } },
{ name: 'msedge', use: { ...devices['Desktop Edge'], channel: 'msedge' } },
{ name: 'mobile-safari', use: { ...devices['iPhone 14'] } },
{ name: 'mobile-chromium', use: { ...devices['Pixel 7'] } },
],
webServer: process.env.PLAYWRIGHT_SKIP_WEBSERVER
? undefined
: [
{
command: `PYTHONPATH=.. python3 -m uvicorn dreamverse.mock_server:app --host ${backendHost} --port ${backendPort}`,
url: `http://${backendHost}:${backendPort}/healthz`,
reuseExistingServer: true,
timeout: 120_000,
},
{
command: 'npm run dev',
url: 'http://127.0.0.1:5299',
reuseExistingServer: true,
timeout: 120_000,
env: {
BACKEND_HOST: backendHost,
BACKEND_PORT: backendPort,
},
},
],
});