Files
xiaoxia-saas/docs/agents/PLAYWRIGHT-E2E.md
T
2026-06-23 15:17:22 +08:00

49 lines
1.6 KiB
Markdown
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.
# Playwright E2E 门禁
## 目标
用真实浏览器替代人工反复点击,优先覆盖老大最常遇到问题的核心流程。
## 当前已覆盖
- 匿名访问工作空间/订阅页面会跳转登录。
- 登录页可渲染。
- 生产真实浏览器流程:注册测试用户 → 创建工作空间 → 创建项目 → 创建视频素材库 → UI 登录 → 打开项目素材页 → 通过上传控件上传 `.MOV` → 等待素材 `ready` → 页面显示素材且无“素材列表加载失败/上传失败”。
## 运行命令
### 生产公网 E2E
```powershell
$env:E2E_BASE_URL='https://saas.xiaoxiajianji.com'
npm --prefix apps/web run test:e2e -- --project=chromium
```
### 只跑核心上传 E2E
```powershell
$env:E2E_BASE_URL='https://saas.xiaoxiajianji.com'
npm --prefix apps/web run test:e2e -- --project=chromium e2e/core-upload.spec.ts
```
### 本地 E2E
不设置 `E2E_BASE_URL` 时,Playwright 会自动启动本地 Vite
```powershell
npm --prefix apps/web run test:e2e -- --project=chromium
```
## 浏览器策略
- 默认使用系统 Microsoft Edge`channel=msedge`,避免每台机器都必须下载 Playwright Chromium。
- 如需使用 Playwright Chromium,可设置:`E2E_BROWSER_CHANNEL=chrome` 或安装 Playwright 浏览器。
- 默认关闭 video,避免缺少 ffmpeg 时阻塞;需要失败录像时设置 `E2E_VIDEO=1`
- 失败时保留 screenshot 和 trace。
## 进入发布门禁的要求
- UI 相关改动必须跑核心 E2E。
- 上传、素材、生成、下载相关改动必须跑生产公网 E2E。
- E2E 失败时不能发版,必须先修复或明确记录阻塞原因。