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

45 lines
1.6 KiB
TypeScript
Raw Normal View History

import { defineConfig, devices } from '@playwright/test'
// 同 apps/viewer 约定:webServer 先等 cn API(8080,仓库根 `pnpm dev:api` 构建+
// 启动,已在跑的实例直接复用),再等 ov API(8081,`pnpm dev:ov`——P4b Task 5
// 展示位 e2e 断言公开嵌入 feed 读 ov 副本端点),再等 admin dev(5176,
// /v1 代理 → 8080)。globalSetup 幂等种子管理员(services/api seed:
// ADMIN_ACCOUNT/ADMIN_PASSWORD,账号已存在则跳过且不改写密码)。compose 基础
// 设施(MySQL/MinIO/Redis×2)需预先 `docker compose up -d`。
export default defineConfig({
testDir: './e2e',
timeout: 60_000,
// dev server 首次按需编译 + 动态路由初始化较慢,放宽断言超时(默认 5s 偏紧)
expect: { timeout: 20_000 },
fullyParallel: true,
reporter: [['list']],
use: {
baseURL: 'http://127.0.0.1:5176',
trace: 'on-first-retry'
},
projects: [{ name: 'chromium', use: { ...devices['Desktop Chrome'] } }],
globalSetup: './e2e/global-setup.ts',
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:5176',
reuseExistingServer: true,
timeout: 120_000 // 首次含依赖预构建
}
]
})