Files
lingxi/playwright.config.ts
T
Stev_Wang 4825626bdf test(e2e): A6 任务中心端到端用例与本地 Playwright 通道
背景:A6-QA-01 要求验证幂等 / 取消 / 重试 / 断线续推 / 权限三态;同时本地无 ~/Library/Caches 写权限,需要可复现的浏览器安装方式。
改动:
- 新增 e2e/a6-tasks.spec.ts(A6_E2E=1 门控):6 条用例覆盖提交 → 列表 → 详情 SSE → 部分失败 → 仅重试失败项、立即取消、同 Idempotency-Key 复用与 40902、Last-Event-ID 断点续推、只读不渲染写操作、无 material:read → 403;beforeAll 用 Prisma 建临时超管 / 只读 / 无权限账号与角色,afterAll 清理任务、幂等键、outbox 与账号角色(审计 append-only 保留)。
- playwright.config.ts 支持 PLAYWRIGHT_CHANNEL:未设置时本地用系统 Chrome,显式空串(CI)用 Playwright 自带 Chromium。
- eslint.config.mjs 忽略本地 .dev(Playwright 浏览器与临时脚本)。
- e2e/README.md 补充 A6 用例与运行方式。
影响面:默认(无 A6_E2E=1)仍 skip,CI pnpm test:e2e 行为不变;仅本地 e2e 配置增加环境变量支持。
回滚:撤销提交,删除 spec 与 channel 逻辑即可。
验证:A6_E2E=1 pnpm exec playwright test e2e/a6-tasks.spec.ts 6/6(约 39s,连跑多次稳定);pnpm test:e2e 默认套件不受影响。
2026-11-05 11:41:14 +08:00

35 lines
961 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { defineConfig, devices } from '@playwright/test';
// 本地默认用系统 Chrome;CI / 显式 PLAYWRIGHT_CHANNEL='' 时使用 Playwright 自带 Chromium
const channel =
process.env.PLAYWRIGHT_CHANNEL === undefined
? process.env.CI
? undefined
: 'chrome'
: process.env.PLAYWRIGHT_CHANNEL || undefined;
export default defineConfig({
testDir: './e2e',
timeout: 60_000,
expect: { timeout: 10_000 },
fullyParallel: false,
workers: 1,
forbidOnly: Boolean(process.env.CI),
retries: process.env.CI ? 2 : 0,
reporter: process.env.CI
? [['list'], ['html', { open: 'never' }], ['junit', { outputFile: 'test-results/e2e.xml' }]]
: [['list'], ['html', { open: 'never' }]],
use: {
baseURL: 'http://127.0.0.1:4173',
trace: 'on-first-retry',
screenshot: 'only-on-failure',
channel,
},
projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'], channel },
},
],
});