Files
dacli/playwright.config.ts
sushub f403a7e80e import: ssw/dacli@eea0ebc (2026-08-12) 起点版本
本仓 2026-08-12 从 ssw main (192.168.1.18:13300/ssw/ssw-mvp) 的
dacli/ subpath 抽取,作为独立仓托管到 gitea:3000/ssw/dacli.git。

- 工作树为 ssw main dacli subpath 最新版 (110 commit, 08-12)
- 历史未带 ssw main 整体历史(避免大仓污染)
- 此为新仓基线 commit,未来以本仓历史为主
2026-08-12 15:58:06 +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'],
},
],
})