docs: add ui page testing checklist

This commit is contained in:
2026-02-02 20:15:09 +08:00
parent 3ab1434821
commit bb90bef02e
3 changed files with 105 additions and 120 deletions

View File

@@ -1,105 +1,58 @@
# Seed Verification Guide (Staging)
# Seed Verification & UI Test Guide (Staging)
## Service Startup (Local)
- Backend: `go run ./backend/main.go serve` (default `http://localhost:8080`).
- Portal frontend: `npm -C frontend/portal install` then `npm -C frontend/portal run dev` (default `http://localhost:5174`, remote use `http://10.1.1.104:5174`).
- Superadmin frontend: `npm -C frontend/superadmin install` then `npm -C frontend/superadmin run dev` (default `http://localhost:5173`, remote use `http://10.1.1.104:5173`).
- Portal dev server proxies `/v1` to `http://localhost:8080` (`frontend/portal/vite.config.js`).
- Superadmin dev server proxies `/super/v1` and `/v1` to `http://localhost:8080` (`frontend/superadmin/vite.config.mjs`).
- Portal: `npm -C frontend/portal install && npm -C frontend/portal run dev` (default `http://localhost:5174`, remote `http://10.1.1.104:5174`).
- Superadmin: `npm -C frontend/superadmin install && npm -C frontend/superadmin run dev` (default `http://localhost:5173`, remote `http://10.1.1.104:5173`).
- Proxies: portal `/v1` → backend `8080`; superadmin `/super/v1` & `/v1` → backend `8080`.
## Chrome DevTools MCP
- Chrome remote debugging已由远程机器启动无需本机手动启动浏览器
- Use MCP to connect at `http://10.1.1.104:9222` (SSH forwarded DevTools port).
- Open target URLs via MCP and run page-level assertions (no API-level calls required).
- Remote Chrome 已启动;连接 `http://10.1.1.104:9222`
- 仅页面操作,无需 API 直接调用
## AI Auto-Handling Prereqs
- Seed 检查:`SELECT COUNT(*) FROM tenants;` 为 0 则 `go run ./backend/main.go seed`
- tenantCode`SELECT code FROM tenants ORDER BY id DESC LIMIT 1;``/t/:tenantCode`
- 清理存储:`localStorage.clear(); sessionStorage.clear();` + 清除 cookies。
- **Seed 检查/执行**
- DB 查询(示例):`SELECT COUNT(*) FROM tenants;`
- 若结果为 0执行 `go run ./backend/main.go seed` 后再继续
- **tenantCode 获取**
- DB 查询:`SELECT code FROM tenants ORDER BY id DESC LIMIT 1;`
- 将结果注入到 Portal URL `/t/:tenantCode`
- **清理浏览器存储**
- 在 MCP 中执行脚本:清理 `localStorage` / `sessionStorage`,并清除 cookies
- 示例:`chrome-devtools_evaluate_script``() => { localStorage.clear(); sessionStorage.clear(); document.cookie.split(';').forEach(c => document.cookie = c.replace(/^ +/, '').replace(/=.*/, '=;expires=' + new Date().toUTCString() + ';path=/')); }`
## Portal Test Checklist (tenantCode from DB)
1) **Login** `/auth/login` → 手机 `13800138000` + OTP `1234`,勾选条款;断言“登录成功”。
2) **Home** `/t/:tenantCode` → 有内容/导航无报错
3) **Content Detail** `/t/:tenantCode/contents/1` → 封面/正文/评论可见。
4) **Orders** `/t/:tenantCode/me/orders` → 列表非空。
5) **Library** `/t/:tenantCode/me/library` → 列表非空
6) **Favorites** `/t/:tenantCode/me/favorites` → 列表非空,可见“取消收藏”。
7) **Likes** `/t/:tenantCode/me/likes` → 列表非空,可见“取消点赞”
8) **Notifications** `/t/:tenantCode/me/notifications` → 页面无错误。
9) **Creator entry** `/t/:tenantCode/creator` → 页面可加载。
- 每页:调用 `chrome-devtools_list_console_messages``error`
### MCP Example Flow (AI Guidance)
1. **Open Portal Home**
- `chrome-devtools_new_page``http://10.1.1.104:5174/t/:tenantCode`
- `chrome-devtools_wait_for` text: `探索戏曲` or page title
2. **Portal Login**
- Navigate to `/t/:tenantCode/auth/login`
- Tick checkbox `#terms` (required)
- `chrome-devtools_fill` phone input with `13800138000`
- Click `获取验证码`, wait for OTP step
- `chrome-devtools_fill` OTP input with `1234`
- Click `登录 / 注册`
- `chrome-devtools_wait_for` text: `个人中心` or user nickname
3. **Verify Orders & Library**
- Navigate to `/t/:tenantCode/me/orders` and assert at least 1 row
- Navigate to `/t/:tenantCode/me/library` and assert at least 1 item
4. **Open Content Detail**
- From home list, click the first content card
- Assert detail page loads and cover/media is visible
5. **Superadmin Login**
- `chrome-devtools_new_page``http://10.1.1.104:5173/super/auth/login`
- Fill `#username` with `superadmin` and `#password1` with `superadmin123`
- Click `Sign In`
- Wait for dashboard cards or `Dashboard` text
6. **Superadmin Lists**
- `/super/superadmin/orders` → verify flagged order badge
- `/super/superadmin/finance` → verify ledger table row
- `/super/superadmin/notifications` → verify template rows
7. **Console/Error Checks**
- After each page, call `chrome-devtools_list_console_messages` and fail on `error` entries.
- Use `chrome-devtools_take_snapshot` to locate table rows by text.
## Run Seed
- Execute `go run ./backend/main.go seed`.
- Ensure no panics; capture console output for troubleshooting.
## Data Validation (DB/Logs)
- Users: verify `creator`, `test`, `superadmin`, `negative` exist in `users.username`.
- Tenant: read `tenants.code` to obtain `tenantCode` (example: `SELECT code FROM tenants ORDER BY id DESC LIMIT 1;`).
- Memberships: `tenant_users` includes `creator` as `tenant_admin`, `test` as `member`.
- Orders: `orders` has `content_purchase` + `withdrawal`, plus flagged/reconciled records.
- Ledger: `tenant_ledgers` has at least one row.
- Templates: `notification_templates` contains order/audit/interaction types.
## Portal Smoke (Use tenantCode)
- Tenant code: query DB (`SELECT code FROM tenants ORDER BY id DESC LIMIT 1;`), then open `http://10.1.1.104:5174/t/:tenantCode`.- Login: OTP is fixed to `1234` (see `backend/app/services/user.go`).
- Home: `/t/:tenantCode` lists content.
- Detail: open any content detail; cover and main asset render.
- Login: sign in as `test` (phone `13800138000`, OTP `1234`) and open `/t/:tenantCode/me`.
- Orders & Library: `/t/:tenantCode/me/orders` and `/t/:tenantCode/me/library` show data.
- Likes/Favorites: content detail shows prefilled like/favorite; toggle to confirm.
- Notifications: `/t/:tenantCode/me/notifications` shows unread items.
## Superadmin Smoke
- Open `http://localhost:5173/super/auth/login`.
- Login: `superadmin` / `superadmin123`.
- Users: list includes `negative`; balance anomaly list returns result.
- Orders: list includes flagged/reconciled and refund orders.
- Withdrawals: list contains `created`/`paid`/`failed` statuses.
- Finance: ledger list has data; order anomaly list returns missing paid/refund items.
- Content/Reports: content list is populated; report list has pending item.
- Templates: order/audit/interaction templates present.
- System Configs: `site_name` and `support_email` present.
## Superadmin Test Checklist
1) **Login** `/super/auth/login``superadmin/superadmin123`,成功进入 Dashboard。
2) **Orders** `/super/superadmin/orders` → 有标记/对账数据。
3) **Finance** `/super/superadmin/finance` → 提现审核/流水/异常标签有数据。
4) **Users** `/super/superadmin/users` → 列表可见。
5) **Tenants** `/super/superadmin/tenants` → 列表可见。
6) **Notifications** `/super/superadmin/notifications` → 模板列表可见。
7) **System Configs** `/super/superadmin/system-configs``site_name/support_email` 可见。
8) **Audit Logs** `/super/superadmin/audit-logs` → 列表可见。
- 每页:检查 console 无 `error`;必要时截图。
## Manual-Only Coverage
- 上传链路init/part/complete需真实存储seed 仅提供素材记录。
- Upload flow (init/part/complete) requires real storage integration; seed only preloads assets.
## Seed Notes
- 执行 `go run ./backend/main.go seed` 会 TRUNCATE 全部业务表后重建。
- 用户:`creator(13800000001)`, `test(13800138000)`, `superadmin(13800009999)`, `negative(13800009998)`
- 租户:`meipai_<rand>`DB 查询获取)。
- Orders/likes/favorites/notifications 已预置示例数据。
## MCP Steps (Example)
- `chrome-devtools_new_page http://10.1.1.104:5174/auth/login`
- 填手机号+勾条款 → 获取验证码 → 填 `1234` → 登录
- 导航并断言:
- `/t/:tenantCode/me/orders` 有行
- `/t/:tenantCode/me/library` 有行
- `/t/:tenantCode/me/favorites` 有行
- `/t/:tenantCode/me/likes` 有行
- Superadmin打开登录 → 填账号密码 → 断言 Dashboard → 进入 Orders/Finance/Notifications/System Configs/Audit Logs每页检查 console `error`