1.6 KiB
1.6 KiB
Changelog — Playwright E2E 35/35 + worker 会话复用
日期: 2026-06-08
摘要
修复并行 E2E 登录锁号与 SPA 导航不稳定,全量 35 passed / 0 failed。
动机
- 35 个 Playwright 用例并行跑时每个都走 UI 登录,触发
login_attempts锁定(429)。 - Refresh token 轮换后静态
storageState文件失效,后续用例落在#/login或#/。 - Hash-only
page.goto与 Vue keep-alive 组合下,部分用例无法离开仪表盘。
涉及文件
| 路径 | 变更 |
|---|---|
frontend/e2e/fixtures.mjs |
新增:worker 级 API 登录 + 上下文结束写回 cookie |
frontend/e2e/helpers.mjs |
login 仅恢复会话;nav 侧栏点击导航 |
frontend/e2e/pages/*.spec.mjs |
认证用例改 import fixtures.mjs;auth/login 空 storageState |
frontend/e2e/pages/credentials.spec.mjs |
凭据对话框经「凭据」按钮打开 |
frontend/e2e/full-acceptance.spec.mjs |
凭据/命令日志选择器对齐 |
frontend/playwright.config.mjs |
移除全局 storageState(改由 fixture) |
.gitignore |
忽略 frontend/e2e/.auth/ |
docs/reports/2026-06-08-playwright-e2e-full-run.md |
35/35 证据 |
迁移 / 重启
- 无需 DB 迁移。
- E2E 前若 admin 已锁定,需清理
login_attempts或等待 15 分钟。 - 改前端后需
cd frontend && npx vite build再跑 E2E(测的是web/app/)。
验证
cd frontend && NEXUS_E2E_BASE=http://127.0.0.1:8600 NEXUS_E2E_PASSWORD=*** npm run test:e2e
# → 35 passed
.venv/bin/pytest tests/integration tests/chain -q
# → 27 passed