docs: refine ai ui testing guidance

This commit is contained in:
2026-01-26 11:49:32 +08:00
parent 6086b982f8
commit 8b44767f11
3 changed files with 91 additions and 32 deletions

View File

@@ -10,10 +10,48 @@
## Chrome DevTools MCP
- Start Chrome with remote debugging: `google-chrome --remote-debugging-port=9222`.
- Use MCP to connect at `http://127.0.0.1:9222`.
- 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).
### MCP Example Flow (AI Guidance)
1. **Open Portal Home**
- `chrome-devtools_new_page``http://localhost: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://localhost: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`.
@@ -22,7 +60,7 @@
## Data Validation (DB/Logs)
- Users: verify `creator`, `test`, `superadmin`, `negative` exist in `users.username`.
- Tenant: read `tenants.code` to obtain `tenantCode` (DB query or admin UI).
- 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.
@@ -30,8 +68,7 @@
## Portal Smoke (Use tenantCode)
- Tenant code: query DB, then open `http://localhost:5174/t/:tenantCode`.
- Login: OTP is fixed to `1234` (see `backend/app/services/user.go`).
- Tenant code: query DB (`SELECT code FROM tenants ORDER BY id DESC LIMIT 1;`), then open `http://localhost: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`.