Files
photo-live/apps/viewer/playwright.config.ts
T

51 lines
1.8 KiB
TypeScript
Raw Normal View History

import { defineConfig, devices } from '@playwright/test';
// Task 6 起 e2e 打真实后端:webServer 先等 cn API(8080,仓库根 `pnpm dev:api`
// 构建+启动;已在跑的实例直接复用;journey 管理/上传腿与 flushSync 的
// bootstrap 触发仍走 cn),再等 ov API(8081,`pnpm dev:ov`——P2 Task 6 起
// viewer 观众腿全部切 ov 副本端点),再等 viewer dev(5175,直连
// VITE_API_BASE=ov 8081,无代理)。compose 基础设施(MySQL/MinIO/Redis×2)
// 需预先 `docker compose up -d`(计划约定)。Task 11 起跨端联调:第四个
// webServer 一并等 admin dev(5176,/v1 代理 → 8080,同样复用已在跑的实例)
// ——journey.spec.ts 以绝对 baseURL 驱动 admin 腿。
export default defineConfig({
testDir: './e2e',
timeout: 30_000,
fullyParallel: true,
reporter: [['list']],
use: {
baseURL: 'http://127.0.0.1:5175',
trace: 'on-first-retry',
},
projects: [{ name: 'chromium', use: { ...devices['Desktop Chrome'] } }],
webServer: [
{
command: 'pnpm dev:api',
cwd: '../..',
url: 'http://127.0.0.1:8080/v1/health',
reuseExistingServer: true,
timeout: 180_000, // 首次含 tsc 全量构建
},
{
command: 'pnpm dev:ov',
cwd: '../..',
url: 'http://127.0.0.1:8081/v1/health',
reuseExistingServer: true,
timeout: 180_000, // 复用同一构建产物,首次仍可能全量构建
},
{
command: 'pnpm run dev',
url: 'http://127.0.0.1:5175',
reuseExistingServer: true,
timeout: 60_000,
},
{
command: 'pnpm run dev',
cwd: '../admin',
url: 'http://127.0.0.1:5176',
reuseExistingServer: true,
timeout: 120_000, // 首次含模板依赖预构建
},
],
});