参考 boot/ 仓库结构初始化, 同步到 gitea:3000/ssw/dacli (private). 包括: - src/ 8 父命令 (form/menu/dm/dict/di/apis/doc/workflow + login/status) + core (client/crypto/help/log/types/config) - src/schema/ FieldBuilder (从 JNPF web 源码提取, 避免 53 个手写 builder) - tests/ vitest 单元 + playwright E2E (含 workSystem/developSystem baseline regression) - scripts/ extract-all.mjs (从 jnpf-web 源码生成 schema) + seed-tds-baseline.ts - doc/ architecture/plan/api/extractors/baseline/RESUME/help-system + v0.6/v0.7 changelog - .claude/skills/dacli-ts/ Claude 集成 skill (SKILL.md + 5 references + 7 examples + 3 baseline) - CLAUDE.md (项目说明) + README.md + prompt.md (开发任务说明书) - 配置文件: package.json/lock, tsconfig, vitest.config, playwright.config
49 lines
1.4 KiB
TypeScript
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'],
|
|
},
|
|
],
|
|
})
|