Files
ssw-mvp/dacli/playwright.config.ts
T
admin 4d096dd97e chore(dacli): 提交 dacli CLI 工具源码并过滤敏感/噪声文件
- dacli/ 整目录被 .gitignore 忽略,本次 force-add 其业务源码(766 文件)
- 排除 node_modules/.env(含 PGPASSWORD 等敏感信息)/.DS_Store/__pycache__/*.pyc
- 新增 dacli/.gitignore 长期管理内部噪声,新增文件仍需 git add -f
- 根 .gitignore 补充 .cache/ 与诊断脚本忽略,并加 dacli 段说明
2026-08-06 19:02:39 +08:00

49 lines
1.4 KiB
TypeScript

import { defineConfig } from '@playwright/test'
import { existsSync } from 'node:fs'
/**
* Playwright 配置 — baseline 0 视觉差验证基础设施。
*
* - testDir: tests/e2e
* - projects: setup (auth.setup.ts UI 登录一次) → chromium (复用 storageState)
* - baseURL: 默认 http://nginx/ (容器内, fallback http://127.0.0.1:30000)
*
* 跑法:
* npx playwright test --project=setup # 单独刷新登录态
* npx playwright test --project=chromium # 业务 spec (需先有 .auth/admin.json)
* npx playwright test # 全部 (setup 自动作为 chromium 依赖运行)
*
* 注: storageState 只有在 .auth/admin.json 存在时才装载 (首跑前为 undefined, setup 会创建)
*/
const AUTH_FILE = '.auth/admin.json'
export default defineConfig({
testDir: './tests/e2e',
fullyParallel: false,
workers: 1,
retries: 0,
timeout: 60_000,
reporter: [['list']],
use: {
baseURL: process.env.JNPF_BASE_URL || 'http://nginx/',
headless: true,
screenshot: 'only-on-failure',
trace: 'retain-on-failure',
},
projects: [
{
name: 'setup',
testMatch: /.*\.setup\.ts/,
},
{
name: 'chromium',
use: {
browserName: 'chromium',
...(existsSync(AUTH_FILE) ? { storageState: AUTH_FILE } : {}),
},
testIgnore: /.*\.setup\.ts/,
dependencies: ['setup'],
},
],
})