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

36 lines
1.2 KiB
TypeScript
Raw Normal View History

import { defineConfig, devices } from '@playwright/test'
// 同 apps/viewer 约定:webServer 先等 API(8080,仓库根 `pnpm dev:api` 构建+启动,
// 已在跑的实例直接复用),再等 admin dev(5176,/v1 代理 → 8080)。
// globalSetup 幂等种子管理员(services/api seed:ADMIN_ACCOUNT/ADMIN_PASSWORD,
// 账号已存在则跳过且不改写密码)。compose 基础设施需预先 `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 run dev',
url: 'http://127.0.0.1:5176',
reuseExistingServer: true,
timeout: 120_000 // 首次含依赖预构建
}
]
})