docs(e2e): 添加路由配置检查规则到文档
重要规则:在生成路由地址前必须检查 Vue Router 配置 - Hash 模式:/#/路由路径 - History 模式:/路由路径 - 本项目使用 Hash 模式,所有 URL 需要 /#/ 前缀
Showing
1 changed file
with
20 additions
and
0 deletions
| 1 | # E2E 测试快速入门 | 1 | # E2E 测试快速入门 |
| 2 | 2 | ||
| 3 | +## ⚠️ 重要:路由配置检查 | ||
| 4 | + | ||
| 5 | +**在编写任何测试前,必须先检查 Vue Router 的配置模式:** | ||
| 6 | + | ||
| 7 | +```bash | ||
| 8 | +# 查看 router 配置 | ||
| 9 | +cat src/router/index.js | grep "createWeb" | ||
| 10 | +``` | ||
| 11 | + | ||
| 12 | +本项目使用 **Hash 模式**: | ||
| 13 | + | ||
| 14 | +```javascript | ||
| 15 | +history: createWebHashHistory(import.meta.env.VITE_BASE || '/') | ||
| 16 | +``` | ||
| 17 | + | ||
| 18 | +因此所有路由 URL 必须添加 `/#/` 前缀: | ||
| 19 | + | ||
| 20 | +- ✅ 正确:`/#/login`, `/#/profile`, `/#/courses/123` | ||
| 21 | +- ❌ 错误:`/login`, `/profile`, `/courses/123` | ||
| 22 | + | ||
| 3 | ## 🚀 快速开始 | 23 | ## 🚀 快速开始 |
| 4 | 24 | ||
| 5 | ### 运行测试 | 25 | ### 运行测试 | ... | ... |
-
Please register or login to post a comment