Files
huike-e2e-moicen/README.md
T
weli 1e7337c239 test: guest onboarding, logged-in isolation, optional real_name
Add guest-onboarding and logged-in-and-isolation specs; remove moicen-unionid-chain;
MOICEN_E2E_EXPECTED_REAL_NAME for 欢迎回来+姓名; CI secret; workers=1; longer goto timeouts.

Made-with: Cursor
2026-04-26 17:22:41 +08:00

36 lines
1.8 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.
# huike-e2e-moicen
针对 **已部署**`music-room.moicen.com`(或任意 `HUIKE_FRONT_BASE_URL`)跑 **Playwright**,不 clone `huike-front`、不起 Postgres、不编译 Rust。全栈本地 E2E 见 **[alchemy-studio/huike-e2e](https://github.com/alchemy-studio/huike-e2e)**。
## 本机
```bash
npm ci
npx playwright install chromium
npx playwright test
```
走代理安装(默认 `http://localhost:7890`):`npm run install:with-proxy`
可选:复制 `.env.e2e.example``.env.e2e`,填写 **`MOICEN_E2E_UNIONID`**;若要断言首页展示 **本人姓名**,再加 **`MOICEN_E2E_EXPECTED_REAL_NAME`**(与库 `hty_users.real_name` 一致,如 `阿难`)。勿提交 `.env.e2e`
用例概览:
| 文件 | 内容 |
|------|------|
| `tests/guest-onboarding.spec.ts` | 未登录:仅见「请返回微信小程序完成登录」,不出现已登录工作台 |
| `tests/home-shell.spec.ts` | `#app`、伪造 unionid 不白屏、`page_path` 净化 |
| `tests/logged-in-and-isolation.spec.ts` | 需 Secret:登录后非访客态;URL 异主 unionid 剥离(串号防护);可选姓名断言 |
未配置 `MOICEN_E2E_UNIONID` 时,`logged-in-and-isolation` 内用例全部 skip。
## GitHub Actions
**Settings → Secrets → Actions** 配置 **`MOICEN_E2E_UNIONID`**(测试用户 `union_id`)。可选再配 **`MOICEN_E2E_EXPECTED_REAL_NAME`**,否则「欢迎回来 + 姓名」用例 skip。未配 unionid 时仅跑访客与壳层用例。
`workflow_dispatch` 可改目标 `base_url`**默认定时:每天 06:30 UTC**(见 `.github/workflows/playwright-music-room.yml`)。
## 与 moicen 运维文档
浏览器联调、在 UC 库查 `union_id` 等:见团队内 **`plan_skills/moicen/moicen-music-room-browser-test-runbook.md`**(与 huiwing-migration / 运维仓同路径即可)。