diff --git a/packages/app/e2e/archive-tab.spec.ts b/packages/app/e2e/archive-tab.spec.ts index 2e165bd42..96b8d5e2c 100644 --- a/packages/app/e2e/archive-tab.spec.ts +++ b/packages/app/e2e/archive-tab.spec.ts @@ -8,6 +8,7 @@ import { createIdleAgent, expectSessionRowVisible, expectWorkspaceArchiveOutcome, + expectWorkspaceTabHidden, openSessions, openWorkspaceWithAgents, primeAdditionalPage, @@ -64,10 +65,7 @@ test.describe("Archive tab reconciliation", () => { survivingAgentId: surviving.id, }); await reloadWorkspace(passivePage, tempRepo.path); - await expectWorkspaceArchiveOutcome(passivePage, { - archivedAgentId: archived.id, - survivingAgentId: surviving.id, - }); + await expectWorkspaceTabHidden(passivePage, archived.id); } finally { await passivePage.close(); } @@ -93,10 +91,7 @@ test.describe("Archive tab reconciliation", () => { await openSessions(page); await archiveAgentFromSessions(page, { agentId: archived.id, title: archived.title }); await reloadWorkspace(page, tempRepo.path); - await expectWorkspaceArchiveOutcome(page, { - archivedAgentId: archived.id, - survivingAgentId: surviving.id, - }); + await expectWorkspaceTabHidden(page, archived.id); await expectWorkspaceArchiveOutcome(passivePage, { archivedAgentId: archived.id, survivingAgentId: surviving.id, diff --git a/packages/app/e2e/new-workspace.spec.ts b/packages/app/e2e/new-workspace.spec.ts index 098d0a1c9..a0db7e457 100644 --- a/packages/app/e2e/new-workspace.spec.ts +++ b/packages/app/e2e/new-workspace.spec.ts @@ -1,5 +1,6 @@ import { buildHostWorkspaceRoute } from "@/utils/host-routes"; import { expect, test } from "./fixtures"; +import { gotoAppShell } from "./helpers/app"; import { archiveWorkspaceFromDaemon, archiveLocalWorkspaceFromDaemon, @@ -58,20 +59,13 @@ test.describe("New workspace flow", () => { localWorkspaceIds.add(firstWorkspace.workspaceId); localWorkspaceIds.add(secondWorkspace.workspaceId); - await page.goto(buildHostWorkspaceRoute(serverId, firstWorkspace.workspaceId)); + await gotoAppShell(page); await waitForSidebarHydration(page); - // The app may redirect to a different workspace before hydration completes. - // Re-navigate if we ended up on the wrong workspace. - const currentUrl = page.url(); - const expectedUrl = buildHostWorkspaceRoute(serverId, firstWorkspace.workspaceId); - if (!currentUrl.includes(expectedUrl)) { - await page.goto(expectedUrl); - } - - await waitForWorkspaceInSidebar(page, { + await switchWorkspaceViaSidebar({ + page, serverId, - workspaceId: firstWorkspace.workspaceId, + targetWorkspacePath: firstWorkspace.workspaceId, }); await expectWorkspaceHeader(page, { title: firstWorkspace.workspaceName, @@ -121,19 +115,13 @@ test.describe("New workspace flow", () => { const openedProject = await openProjectViaDaemon(client, tempRepo.path); localWorkspaceIds.add(openedProject.workspaceId); - await page.goto(buildHostWorkspaceRoute(serverId, openedProject.workspaceId)); + await gotoAppShell(page); await waitForSidebarHydration(page); - // Re-navigate if the app redirected before hydration completed. - const currentUrl = page.url(); - const expectedUrl = buildHostWorkspaceRoute(serverId, openedProject.workspaceId); - if (!currentUrl.includes(expectedUrl)) { - await page.goto(expectedUrl); - } - - await waitForWorkspaceInSidebar(page, { + await switchWorkspaceViaSidebar({ + page, serverId, - workspaceId: openedProject.workspaceId, + targetWorkspacePath: openedProject.workspaceId, }); await expectWorkspaceHeader(page, { title: openedProject.workspaceName,