1
0
Files
nex/openspec/changes/e2e-real-backend/tasks.md
lanyuanxiaoyao 59179094ed feat: E2E 测试集成真实后端
- Playwright 双 webServer 模式自动启动 Go 后端 + Vite 前端
- 后端使用临时 SQLite 数据库隔离,固定端口 19026
- vite.config.ts proxy target 动态读取环境变量
- 新增 sql.js 依赖用于 SQLite 统计数据 seed
- 新增 e2e/fixtures.ts 共享工具模块(API seed + SQLite seed)
- 拆分测试文件 5→7(providers/models/stats/navigation/validation)
- 删除旧文件 crud.spec.ts/sidebar.spec.ts/stats-cards.spec.ts
- E2E 测试尚有部分用例需调试修复
2026-04-22 00:31:35 +08:00

30 lines
2.0 KiB
Markdown
Raw 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.
## 1. 基础设施
- [x] 1.1 安装 sql.js 和 @types/sql.js 到 devDependencies`bun add -d sql.js @types/sql.js`
- [x] 1.2 修改 `vite.config.ts` proxy target 为动态读取 `process.env.NEX_BACKEND_PORT || '9826'`
- [x] 1.3 创建 `e2e/global-setup.ts`(空实现或验证临时目录存在)
- [x] 1.4 创建 `e2e/global-teardown.ts`,读取 `process.env.NEX_E2E_TEMP_DIR`,用 `fs.rm` 递归删除
- [x] 1.5 创建 `e2e/fixtures.ts`,导出 `API_BASE` 常量、`seedProvider``seedModel``seedUsageStats` 函数
- [x] 1.6 重写 `playwright.config.ts`,创建临时目录、设置环境变量、配置双 webServer 数组Go 后端 + Vite 前端)
## 2. E2E 测试重写
- [x] 2.1 重写 `e2e/providers.spec.ts`:空数据库开始,完整供应商 CRUD 验证(创建→验证→编辑→验证→删除→验证)
- [x] 2.2 创建 `e2e/models.spec.ts`beforeEach API seed 供应商,完整模型 CRUD 验证(展开行→创建模型→验证→编辑→验证→删除→验证)
- [x] 2.3 重写 `e2e/stats.spec.ts`beforeAll API seed 供应商+模型sql.js seed 多日统计数据,验证概览卡片、表格数据、筛选功能
- [x] 2.4 创建 `e2e/navigation.spec.ts`侧边栏渲染、页面切换、URL 持久化验证(合并 sidebar.spec.ts
- [x] 2.5 创建 `e2e/validation.spec.ts`供应商表单必填校验、URL 格式校验、对话框行为(取消重置、连续点击)
## 3. 清理旧文件
- [x] 3.1 删除 `e2e/crud.spec.ts`(内容已拆分到 providers/models/validation
- [x] 3.2 删除 `e2e/sidebar.spec.ts`(内容已合并到 navigation
- [x] 3.3 删除 `e2e/stats-cards.spec.ts`(内容已合并到 stats
## 4. 验证
- [ ] 4.1 运行 `bun run test:e2e` 确认所有 E2E 测试通过
- [ ] 4.2 确认临时目录在测试结束后被清理
- [ ] 4.3 运行 `bun run dev` 确认日常开发行为不受影响proxy 仍指向 9826
- [ ] 4.4 运行 `bun run test` 确认单元测试不受影响