- docs/dth/experiment-platform/web-design.md: T1 架构设计
- src/frontend/src/main.tsx + App.tsx: 入口 + 路由
- src/frontend/src/api/{auth,operators,runs,client}.ts: 4 文件
- src/frontend/src/components/{AuthContext,ProtectedRoute,OperatorCard,RunResult,Radar}.tsx: 5 组件(Radar SVG 自绘 139 行)
- src/frontend/src/views/{Login,Dashboard,OperatorList,Run}.tsx: 4 页
- src/frontend/src/styles.css: 159 行(< 200 预算,无 UI 库)
- src/frontend/vite.config.ts: proxy /api → :30000
- tests/e2e/dth_frontend.test.sh: 14 case (5 API + 4 routes + 2 static + 3 list)
- openspec/changes/chg_0004_experiment_platform_frontend/{5 工件}
- package-lock.json: +react/react-dom/react-router-dom/axios + vite/typescript
Co-Authored-By: Claude Opus 4.8 <[email protected]>
1.9 KiB
1.9 KiB
change_id, owner, status, spec_ref
| change_id | owner | status | spec_ref |
|---|---|---|---|
| chg_0004 | qa@dth | draft | spec.md |
Testcases
Cases
C1_curl_login_success_returns_token
- Scenario: S1, S2
- Type: integration
- Priority: P0
- Given: 后端在 30000 运行(admin seed 已加载)
- When: curl -X POST :30000/api/ssw/dth/auth/login -d '{"username":"admin","password":"123456"}'
- Then: data.token 非空字符串
- Bound Task: T8
C2_curl_login_wrong_password_returns_401
- Scenario: S3
- Type: integration
- Priority: P0
- Given: 后端运行
- When: curl ... login 错密码
- Then: code=401, msg 含"凭据"
- Bound Task: T8
C3_curl_list_operators_returns_three
- Scenario: S4
- Type: integration
- Priority: P0
- Given: admin token
- When: GET /api/ssw/dth/experiment/operators
- Then: data 数组长度 ≥ 3,每项含 code/name/version/schema
- Bound Task: T8
C4_curl_run_hello_mpc_returns_uuid
- Scenario: S5
- Type: integration
- Priority: P0
- Given: admin token
- When: POST /runs body={"operator":"hello-mpc","input":{"x":42}}
- Then: data.run_id 匹配 UUID 正则
- Bound Task: T8
C5_curl_get_run_returns_real_output
- Scenario: S6
- Type: integration
- Priority: P0
- Given: 已 run 的 run_id
- When: GET /runs/:id
- Then: data.output_json.ok == true AND echo.x == 42
- Bound Task: T8
C6_static_routes_resolve
- Scenario: S4, S5, S6
- Type: integration
- Priority: P1
- When: 前端 src/frontend/src/App.tsx 加载
- Then: 4 路由
/login/dashboard/operators/operators/:code/run全部有对应 view - Bound Task: T8
C7_test_runner_passes_all
- Scenario: 全部
- Type: e2e
- Priority: P0
- Given: 后端 + 前端就位
- When: bash tests/e2e/dth_frontend.test.sh
- Then: exit 0
- Bound Task: T8
C8_check_spec_coverage_gap_zero
- Scenario: 全部
- Type: e2e
- Priority: P0
- Given: chg 工件齐备
- When: PROJECT_ROOT=. bash openspec/scripts/check_spec_coverage.sh
- Then: stdout PASS gap=0
- Bound Task: T9