diff --git a/e2e/navigation.spec.ts b/e2e/navigation.spec.ts index c178df5..371d26d 100644 --- a/e2e/navigation.spec.ts +++ b/e2e/navigation.spec.ts @@ -37,7 +37,7 @@ test.describe('Header navigation', () => { test('back button shows on sub-pages and navigates to /welcome', async ({ page }) => { await page.route('**/api/tasks**', (route) => { - if (route.request().url().endsWith('.ts')) return route.continue(); + if (route.request().url().includes('/src/')) return route.continue(); route.fulfill({ status: 200, contentType: 'application/json', body: JSON.stringify(mockTasks) }); }); await page.route('**/api/review/feed**', (route) => diff --git a/e2e/study.spec.ts b/e2e/study.spec.ts index cce4fa5..a2a1bd9 100644 --- a/e2e/study.spec.ts +++ b/e2e/study.spec.ts @@ -38,7 +38,8 @@ test.describe('Study page', () => { await page.route('**/api/tasks**', (route) => { const url = route.request().url(); // 排除 Vite 模块加载请求(.ts 文件),只拦截真正的 API 请求 - if (url.endsWith('.ts')) return route.continue(); + // Vite 模块请求都走 /src/ 路径,跳过它们只拦截真正的 API 请求 + if (url.includes('/src/')) return route.continue(); if (url.includes('/tasks') && !url.includes('/tasks/')) { return route.fulfill({ status: 200, @@ -87,7 +88,8 @@ test.describe('Study page', () => { test('delete task removes it from the list', async ({ page }) => { await page.route('**/api/tasks/1', (route) => { const url = route.request().url(); - if (url.endsWith('.ts')) return route.continue(); + // Vite 模块请求都走 /src/ 路径,跳过它们只拦截真正的 API 请求 + if (url.includes('/src/')) return route.continue(); route.fulfill({ status: 200, contentType: 'application/json', @@ -102,7 +104,8 @@ test.describe('Study page', () => { test('shows empty state when no tasks', async ({ page }) => { await page.route('**/api/tasks**', (route) => { const url = route.request().url(); - if (url.endsWith('.ts')) return route.continue(); + // Vite 模块请求都走 /src/ 路径,跳过它们只拦截真正的 API 请求 + if (url.includes('/src/')) return route.continue(); route.fulfill({ status: 200, contentType: 'application/json', diff --git a/package.json b/package.json index 9c67b6e..8055a39 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "type-check": "vue-tsc --build --force", "test": "vitest run", "test:watch": "vitest", - "test:e2e": "playwright test", + "test:e2e": "npx playwright test", "test:e2e:ui": "playwright test --ui" }, "dependencies": { diff --git a/src/components/MindMapViewer.vue b/src/components/MindMapViewer.vue index 2e04c54..3b8c56d 100644 --- a/src/components/MindMapViewer.vue +++ b/src/components/MindMapViewer.vue @@ -119,9 +119,9 @@ const render = () => { }); } - instance.bus.addListener("selectNode", (node: any) => { + instance.bus.addListener("selectNewNode", (node: any) => { if (node?.sourceType && node?.sourceId != null) { - emit("node-click", { sourceType: node.sourceType, sourceId: node.sourceId }); + emit("node-click", { sourceType: String(node.sourceType), sourceId: Number(node.sourceId) }); } }); }; diff --git a/src/components/Study.vue b/src/components/Study.vue index 78be29a..a90e947 100644 --- a/src/components/Study.vue +++ b/src/components/Study.vue @@ -255,6 +255,7 @@ onMounted(() => { +