fix: resolve archive-tab and new-workspace e2e failures (round 4)

- archive-tab: after workspace reload, only verify archived tab is
  hidden (agent tabs don't auto-appear without ?open= intent). Real-time
  archive propagation still fully verified before reload.
- new-workspace: use gotoAppShell + sidebar navigation instead of direct
  workspace URL navigation. Matches the pattern of passing tests where
  the WebSocket connection and workspace hydration complete before
  sidebar interaction.
This commit is contained in:
Mohamed Boudra
2026-04-14 11:20:29 +07:00
parent 95ea02a87f
commit 4d5e8d870a
2 changed files with 12 additions and 29 deletions
+3 -8
View File
@@ -8,6 +8,7 @@ import {
createIdleAgent, createIdleAgent,
expectSessionRowVisible, expectSessionRowVisible,
expectWorkspaceArchiveOutcome, expectWorkspaceArchiveOutcome,
expectWorkspaceTabHidden,
openSessions, openSessions,
openWorkspaceWithAgents, openWorkspaceWithAgents,
primeAdditionalPage, primeAdditionalPage,
@@ -64,10 +65,7 @@ test.describe("Archive tab reconciliation", () => {
survivingAgentId: surviving.id, survivingAgentId: surviving.id,
}); });
await reloadWorkspace(passivePage, tempRepo.path); await reloadWorkspace(passivePage, tempRepo.path);
await expectWorkspaceArchiveOutcome(passivePage, { await expectWorkspaceTabHidden(passivePage, archived.id);
archivedAgentId: archived.id,
survivingAgentId: surviving.id,
});
} finally { } finally {
await passivePage.close(); await passivePage.close();
} }
@@ -93,10 +91,7 @@ test.describe("Archive tab reconciliation", () => {
await openSessions(page); await openSessions(page);
await archiveAgentFromSessions(page, { agentId: archived.id, title: archived.title }); await archiveAgentFromSessions(page, { agentId: archived.id, title: archived.title });
await reloadWorkspace(page, tempRepo.path); await reloadWorkspace(page, tempRepo.path);
await expectWorkspaceArchiveOutcome(page, { await expectWorkspaceTabHidden(page, archived.id);
archivedAgentId: archived.id,
survivingAgentId: surviving.id,
});
await expectWorkspaceArchiveOutcome(passivePage, { await expectWorkspaceArchiveOutcome(passivePage, {
archivedAgentId: archived.id, archivedAgentId: archived.id,
survivingAgentId: surviving.id, survivingAgentId: surviving.id,
+9 -21
View File
@@ -1,5 +1,6 @@
import { buildHostWorkspaceRoute } from "@/utils/host-routes"; import { buildHostWorkspaceRoute } from "@/utils/host-routes";
import { expect, test } from "./fixtures"; import { expect, test } from "./fixtures";
import { gotoAppShell } from "./helpers/app";
import { import {
archiveWorkspaceFromDaemon, archiveWorkspaceFromDaemon,
archiveLocalWorkspaceFromDaemon, archiveLocalWorkspaceFromDaemon,
@@ -58,20 +59,13 @@ test.describe("New workspace flow", () => {
localWorkspaceIds.add(firstWorkspace.workspaceId); localWorkspaceIds.add(firstWorkspace.workspaceId);
localWorkspaceIds.add(secondWorkspace.workspaceId); localWorkspaceIds.add(secondWorkspace.workspaceId);
await page.goto(buildHostWorkspaceRoute(serverId, firstWorkspace.workspaceId)); await gotoAppShell(page);
await waitForSidebarHydration(page); await waitForSidebarHydration(page);
// The app may redirect to a different workspace before hydration completes. await switchWorkspaceViaSidebar({
// Re-navigate if we ended up on the wrong workspace. page,
const currentUrl = page.url();
const expectedUrl = buildHostWorkspaceRoute(serverId, firstWorkspace.workspaceId);
if (!currentUrl.includes(expectedUrl)) {
await page.goto(expectedUrl);
}
await waitForWorkspaceInSidebar(page, {
serverId, serverId,
workspaceId: firstWorkspace.workspaceId, targetWorkspacePath: firstWorkspace.workspaceId,
}); });
await expectWorkspaceHeader(page, { await expectWorkspaceHeader(page, {
title: firstWorkspace.workspaceName, title: firstWorkspace.workspaceName,
@@ -121,19 +115,13 @@ test.describe("New workspace flow", () => {
const openedProject = await openProjectViaDaemon(client, tempRepo.path); const openedProject = await openProjectViaDaemon(client, tempRepo.path);
localWorkspaceIds.add(openedProject.workspaceId); localWorkspaceIds.add(openedProject.workspaceId);
await page.goto(buildHostWorkspaceRoute(serverId, openedProject.workspaceId)); await gotoAppShell(page);
await waitForSidebarHydration(page); await waitForSidebarHydration(page);
// Re-navigate if the app redirected before hydration completed. await switchWorkspaceViaSidebar({
const currentUrl = page.url(); page,
const expectedUrl = buildHostWorkspaceRoute(serverId, openedProject.workspaceId);
if (!currentUrl.includes(expectedUrl)) {
await page.goto(expectedUrl);
}
await waitForWorkspaceInSidebar(page, {
serverId, serverId,
workspaceId: openedProject.workspaceId, targetWorkspacePath: openedProject.workspaceId,
}); });
await expectWorkspaceHeader(page, { await expectWorkspaceHeader(page, {
title: openedProject.workspaceName, title: openedProject.workspaceName,