feat(e2e): 核心全链路用例与辅助模块

新增 smoke-http、core-full-chain(访客深链守卫、登录黄金路径、可选健康 URL);抽出 music-room-session 辅助;Playwright 忽略本地 admin_debug;CI 注入可选 MOICEN_HEALTHCHECK_URL。

Made-with: Cursor
This commit is contained in:
2026-04-28 11:53:48 +08:00
parent b98785cda5
commit d85027a933
8 changed files with 309 additions and 182 deletions
+4
View File
@@ -18,6 +18,8 @@ npx playwright test
| 文件 | 内容 |
|------|------|
| `tests/smoke-http.spec.ts` | **request**`GET /` 返回 HTML(网关 / TLS / 静态入口底线,不启浏览器) |
| `tests/core-full-chain.spec.ts` | **访客**:未登录访问 `/course` 被送回 `/` 且见访客占位;**已登录**:黄金路径(会话→深链→课程体系壳层→JWT 与机构闭环);**可选** `MOICEN_HEALTHCHECK_URL` |
| `tests/guest-onboarding.spec.ts` | 未登录:仅见「请返回微信小程序完成登录」,不出现已登录工作台 |
| `tests/home-shell.spec.ts` | `#app`、伪造 unionid 不白屏、`page_path` 净化 |
| `tests/logged-in-and-isolation.spec.ts` | 需 Secret:登录后非访客态;异主 unionid 剥离;多角色选身份后见「欢迎回来」(不校验姓名) |
@@ -31,6 +33,8 @@ npx playwright test
**Settings → Secrets → Actions** 配置 **`MOICEN_E2E_UNIONID`** 即可。未配 unionid 时仅跑访客与壳层用例。
可选:在 **Settings → Secrets and variables → Actions → Variables** 配置 **`MOICEN_HEALTHCHECK_URL`**(完整 URL,返回 2xx),用于可选后端健康检查用例;未配置时该条自动 skip。
`workflow_dispatch` 可改目标 `base_url`**默认定时:每天 06:30 UTC**(见 `.github/workflows/playwright-music-room.yml`)。
## 与 moicen 运维文档