diff --git a/apps/desktop/e2e-budget.json b/apps/desktop/e2e-budget.json index 8bd366b228..ec47c1ae8d 100644 --- a/apps/desktop/e2e-budget.json +++ b/apps/desktop/e2e-budget.json @@ -70,8 +70,8 @@ "electron": "the perf budget is measured from CDP wheel input and the browser's own render skipping" }, "workhub-layout.spec.ts": { - "tests": 2, - "electron": "WorkHub model configuration and attachment sending cross the Host boundary; native floating preserves macOS Dock visibility and pointer dragging verifies model-wheel scrolling and release snapping; a held-open Host Turn verifies immediate prompt visibility, durable transcript handoff and persistence after renderer reload" + "tests": 3, + "electron": "WorkHub model configuration and attachment sending cross the Host boundary; the Project New task action must dismiss the native dock owned by a separate WebContentsView; native floating preserves macOS Dock visibility and pointer dragging verifies model-wheel scrolling and release snapping; a held-open Host Turn verifies immediate prompt visibility, durable transcript handoff and persistence after renderer reload" }, "workhub-reconstruction.spec.ts": { "tests": 1, diff --git a/apps/desktop/e2e/workhub-layout.spec.ts b/apps/desktop/e2e/workhub-layout.spec.ts index 48e45c0adb..e54a93faaa 100644 --- a/apps/desktop/e2e/workhub-layout.spec.ts +++ b/apps/desktop/e2e/workhub-layout.spec.ts @@ -399,3 +399,18 @@ test('WorkHub keeps the submitted prompt visible while its agent is still runnin await workhub.getByRole('button', { name: /发送|Send/, exact: true }).click(); await expect(workhub.getByText('Fake backend received: Reply after renderer recovery')).toBeVisible(); }); + +test('project menu exits WorkHub before starting a new task', async ({ projectSidebarWindow: page }) => { + await page.keyboard.press('Escape'); + await page.evaluate(() => window.maka.settings.updateClient({ workHub: { enabled: true } })); + await expect(page.locator('.workHubDock')).toBeVisible(); + + const sidebar = page.getByRole('navigation', { name: '任务列表' }); + await sidebar.getByRole('radio', { name: '按项目', exact: true }).click(); + await page.getByRole('button', { name: '示例项目 项目操作', exact: true }).click(); + await page.getByRole('menuitem', { name: '新建任务', exact: true }).click(); + + await expect(page.locator('.workHubDock')).toBeHidden(); + await expect(page.locator(COMPOSER_INPUT)).toBeFocused(); + await expect(page.locator('[data-turn-id]')).toHaveCount(0); +}); diff --git a/apps/desktop/src/renderer/features/session-navigation/ui/session-navigation-provider.tsx b/apps/desktop/src/renderer/features/session-navigation/ui/session-navigation-provider.tsx index f9e0799b89..ccee20a31b 100644 --- a/apps/desktop/src/renderer/features/session-navigation/ui/session-navigation-provider.tsx +++ b/apps/desktop/src/renderer/features/session-navigation/ui/session-navigation-provider.tsx @@ -135,7 +135,10 @@ export function SessionNavigationProvider(props: SessionNavigationProviderProps) () => hasProjectActions ? { - onNew: (projectId) => chromeRef.current.projectActions?.onNew(projectId), + onNew: (projectId) => { + chromeRef.current.onExitWorkHub(); + return chromeRef.current.projectActions?.onNew(projectId); + }, onRename: (projectId, name) => chromeRef.current.projectActions?.onRename(projectId, name), onArchive: (projectId) => chromeRef.current.projectActions?.onArchive(projectId),