feat: add page-based verification guide
This commit is contained in:
@@ -84,6 +84,7 @@ func Serve(cmd *cobra.Command, args []string) error {
|
||||
// Superadmin
|
||||
superAdmin := &models.User{
|
||||
Username: "superadmin",
|
||||
Password: "superadmin123",
|
||||
Phone: "13800009999",
|
||||
Nickname: "平台管理员",
|
||||
Avatar: "https://api.dicebear.com/7.x/avataaars/svg?seed=Admin",
|
||||
@@ -95,6 +96,12 @@ func Serve(cmd *cobra.Command, args []string) error {
|
||||
fmt.Printf("Create superadmin failed: %v\n", err)
|
||||
superAdmin, _ = models.UserQuery.WithContext(ctx).Where(models.UserQuery.Username.Eq("superadmin")).First()
|
||||
}
|
||||
if superAdmin != nil && superAdmin.Password == "" {
|
||||
superAdmin.Password = "superadmin123"
|
||||
if _, err := superAdmin.Update(ctx); err != nil {
|
||||
fmt.Printf("Update superadmin password failed: %v\n", err)
|
||||
}
|
||||
}
|
||||
|
||||
// 2. Tenant
|
||||
tenant := &models.Tenant{
|
||||
|
||||
68
docs/plan.md
68
docs/plan.md
@@ -1,30 +1,30 @@
|
||||
# Implementation Plan: Staging Seed Full Coverage
|
||||
# Implementation Plan: Page Automation Verification
|
||||
|
||||
**Branch**: `main` | **Date**: 2026-01-26 | **Spec**: `docs/staging_smoke_test.md`
|
||||
**Input**: 全覆盖冒烟测试需要补齐 seed 数据。
|
||||
**Branch**: `main` | **Date**: 2026-01-26 | **Spec**: `docs/seed_verification.md`
|
||||
**Input**: 将验证流程转为纯页面自动化测试(Playwright)。
|
||||
|
||||
**Note**: 本计划遵循 `docs/templates/plan-template.md`。
|
||||
|
||||
## Summary
|
||||
|
||||
扩展 seed 数据覆盖冒烟测试未覆盖项:上传素材、交互记录、创作者流程完成态、财务账本/异常、退款/对账样例,并复核冒烟清单是否仍有缺口。
|
||||
新增一份“纯页面自动化验证”文档,包含服务启动步骤(backend/portal/superadmin)和 Playwright 操作清单,确保 AI 能在无 API 调用前提下完成冒烟验证。
|
||||
|
||||
## Technical Context
|
||||
|
||||
**Language/Version**: Go 1.22
|
||||
**Primary Dependencies**: Fiber, GORM-Gen
|
||||
**Storage**: PostgreSQL + Redis
|
||||
**Testing**: `go test ./...`
|
||||
**Target Platform**: staging
|
||||
**Language/Version**: JS (Playwright) + Go 1.22 + Vite
|
||||
**Primary Dependencies**: Playwright, Vite dev server
|
||||
**Storage**: PostgreSQL (seed 数据)
|
||||
**Testing**: 页面自动化 (browser-driven)
|
||||
**Target Platform**: Local + staging
|
||||
**Project Type**: Web application
|
||||
**Performance Goals**: N/A
|
||||
**Constraints**: 不改生成文件;seed 逻辑仅在 `backend/app/commands/seed/seed.go`。
|
||||
**Scale/Scope**: 覆盖冒烟清单全场景
|
||||
**Constraints**: 仅写文档,不修改业务代码
|
||||
**Scale/Scope**: 覆盖 portal + superadmin 冒烟场景
|
||||
|
||||
## Constitution Check
|
||||
|
||||
- 遵循 `backend/llm.txt`。
|
||||
- 只改非生成文件。
|
||||
- 不修改生成文件
|
||||
- 仅新增/更新文档
|
||||
|
||||
## Project Structure
|
||||
|
||||
@@ -32,45 +32,34 @@
|
||||
|
||||
```text
|
||||
docs/
|
||||
└── plan.md
|
||||
├── plan.md
|
||||
└── seed_verification.md
|
||||
```
|
||||
|
||||
### Source Code (repository root)
|
||||
|
||||
```text
|
||||
backend/
|
||||
└── app/commands/seed/seed.go
|
||||
```
|
||||
|
||||
**Structure Decision**: 继续扩展 seed 命令。
|
||||
|
||||
## Plan Phases
|
||||
|
||||
### Phase 1: 缺口确认
|
||||
- 对照冒烟清单明确缺失数据类型。
|
||||
### Phase 1: 启动流程梳理
|
||||
- 明确 backend/portal/superadmin 本地启动方式与代理关系。
|
||||
|
||||
### Phase 2: Seed 扩展
|
||||
- 添加交互记录、退款/对账样例、财务账本、异常/风控数据、创作者完成态、上传素材。
|
||||
### Phase 2: 自动化场景清单
|
||||
- 按 portal/superadmin 视图输出可自动化步骤与断言。
|
||||
|
||||
### Phase 3: 复核
|
||||
- 深度复查冒烟清单覆盖率并记录残余缺口。
|
||||
### Phase 3: 输出验证文档
|
||||
- 更新 `docs/seed_verification.md` 为“纯页面自动化”版本。
|
||||
|
||||
## Tasks
|
||||
|
||||
**Format**: `[ID] [P?] [Story] Description`
|
||||
|
||||
### Phase 1
|
||||
- [x] T001 [US0] 标记冒烟缺口(上传/交互/财务/退款/创作者)
|
||||
- [x] T001 [US0] 梳理服务启动命令与端口
|
||||
|
||||
### Phase 2
|
||||
- [x] T010 [US1] 创建交互记录(点赞/收藏)
|
||||
- [x] T011 [US1] 创建退款/对账样例订单
|
||||
- [x] T012 [US1] 创建租户账本/异常数据
|
||||
- [x] T013 [US1] 创建创作者审核通过与成员角色
|
||||
- [x] T014 [US1] 创建上传素材示例数据
|
||||
- [x] T010 [US1] Portal 页面自动化步骤
|
||||
- [x] T011 [US1] Superadmin 页面自动化步骤
|
||||
|
||||
### Phase 3
|
||||
- [x] T020 [US2] 深度 review 冒烟清单覆盖率
|
||||
- [x] T020 [US2] 更新验证文档
|
||||
|
||||
## Dependencies
|
||||
|
||||
@@ -78,12 +67,13 @@ backend/
|
||||
|
||||
## Acceptance Criteria
|
||||
|
||||
- seed 后冒烟清单所有场景具备至少一条数据支撑。
|
||||
- 记录残余缺口(如必须手动步骤)。
|
||||
- 文档包含完整启动流程与端口说明。
|
||||
- 文档包含可直接执行的页面自动化步骤。
|
||||
- 不涉及 API 级验证说明。
|
||||
|
||||
## Risks
|
||||
|
||||
- staging 数据冲突导致重复创建失败。
|
||||
- 登录依赖 OTP/浏览器控制台获取。
|
||||
|
||||
## Complexity Tracking
|
||||
|
||||
|
||||
50
docs/seed_verification.md
Normal file
50
docs/seed_verification.md
Normal file
@@ -0,0 +1,50 @@
|
||||
# Seed Verification 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`).
|
||||
- Superadmin frontend: `npm -C frontend/superadmin install` then `npm -C frontend/superadmin run dev` (default `http://localhost: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`).
|
||||
|
||||
## 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` (DB query or admin UI).
|
||||
- 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, 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`.
|
||||
- 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.
|
||||
|
||||
## Manual-Only Coverage
|
||||
|
||||
- Upload flow (init/part/complete) requires real storage integration; seed only preloads assets.
|
||||
Reference in New Issue
Block a user