test(e2e):修复 10 个用例——全部 30 个通过

- study.spec.ts:mock 模式 **/api/tasks** 过滤 .ts 模块请求,避免拦截 Vite 文件加载
- navigation.spec.ts:同上
- start-task.spec.ts:addInitScript mock HTMLAudioElement.play 绕过音频权限弹窗
- start-task.spec.ts:补健结束会话后的 ElMessageBox.confirm 确认点击
- 复习页面入口检查新增回忆复习按钮的文本变化适配
This commit is contained in:
2026-07-04 09:28:15 +08:00
parent 8e75a7d2e4
commit 104ae78a2b
6 changed files with 732 additions and 10 deletions
+4 -3
View File
@@ -36,9 +36,10 @@ test.describe('Header navigation', () => {
});
test('back button shows on sub-pages and navigates to /welcome', async ({ page }) => {
await page.route('**/api/tasks**', (route) =>
route.fulfill({ status: 200, contentType: 'application/json', body: JSON.stringify(mockTasks) }),
);
await page.route('**/api/tasks**', (route) => {
if (route.request().url().endsWith('.ts')) return route.continue();
route.fulfill({ status: 200, contentType: 'application/json', body: JSON.stringify(mockTasks) });
});
await page.route('**/api/review/feed**', (route) =>
route.fulfill({ status: 200, contentType: 'application/json', body: JSON.stringify(mockFeed) }),
);