Files
Jog/e2e/README.md
nojava 6c8b31e38a feat: AI 助手模型管理(CRUD、会话绑定、自动化验收)
- Flyway V6:模型表、默认种子、ai_chat_session.model_id 回填
- 管理端 /api/admin/ai/models;用户端选模与新会话绑定
- 禁用模型后会话只读(5009);chat 按会话 modelCode 调 DashScope
- 前端 AiModels 页、助手模型选择器与 localStorage
- 单测、AiModelManagementApiIT、Playwright E2E;e2e Profile 关闭注解限流
- 技术实施文档与验收报告;移除过期冲突分析文档

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-24 03:36:31 +08:00

63 lines
1.9 KiB
Markdown
Raw Permalink 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.
# Jog E2EPlaywright
## 前置条件
1. 线上 MySQL 已建库并授权(推荐隔离库):
```sql
CREATE DATABASE IF NOT EXISTS jog_test CHARACTER SET utf8mb4;
GRANT ALL PRIVILEGES ON jog_test.* TO 'jog'@'%';
FLUSH PRIVILEGES;
```
2. 启动测试前设置(可选):
```powershell
$env:MYSQL_DATABASE = "jog_test"
$env:DASHSCOPE_API_KEY = "你的百炼Key" # 浏览器 chat 已 Mock,可不设
```
若暂未建 `jog_test`,默认使用 `jog` 库(`application-e2e.yml`)。
3. 管理员密码:应用启动后会被重置为 `admin@123`(见 `DatabaseInitializationVerifier`)。
4. **首次或改过后端代码**:在仓库根目录执行 `mvn -pl jog-admin -am install -Dmaven.frontend.skip=true -DskipTests`,否则 `spring-boot:run` 可能加载 `.m2` 中旧版 `jog-module-blog`(表现为 `/api/admin/ai/models` 404)。
## 测试模型
- 模型编码:`qwen3-vl-32b-thinking`
- 展示名称:`Qwen3 VL 32B Thinking`
## 运行
```bash
cd e2e
npm install
npm run install:browsers
npm test
```
Playwright 会自动执行(首次较慢):
1. `mvn -pl jog-admin -am install …` + `mvn -pl jog-admin spring-boot:run -Dspring-boot.run.profiles=e2e`
2. `npm run dev`jog-frontend
本地已手动启动 8080/5173 时,会复用现有进程(`reuseExistingServer`,勿设置 `CI=true`)。
## 用例
| 编号 | 文件 | 说明 |
| :--- | :--- | :--- |
| TC-AI-MODEL-E2E-18 | `tests/ai-model-management.spec.js` | 管理端 UI 上架模型 → 助手选模型、新会话、Mock 对话 |
| TC-AI-MODEL-E2E-19 | 同上 | 禁用模型 → 旧会话只读 |
`e2e` Profile 下 `jog.rate-limit.enabled=false`,避免注册/登录全局限流影响联调。
## API 集成测试(Maven
```bash
mvn test -pl jog-admin -am -Dmaven.frontend.skip=true -Dtest=AiModelManagementApiIT
```
Docker 可用时也可使用 Testcontainers`application-test` + `IntegrationTestContainers`)。