Fix workspace reconnect playwright tests after toast move
Test #1 was asserting agent-reconnecting-toast on a workspace with no agents — but commit1daa1314moved the reconnect indicator from the workspace banner into the per-agent panel toast. Create an idle agent and navigate to it so the agent panel mounts before dropping the daemon gate. Test #2 regex still pinned the old "Connecting to localhost" copy; commitc534c857tightened it to just "Connecting" with the hostname in the description. Match the new title plus the existing offline copies.
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import { buildHostWorkspaceRoute } from "@/utils/host-routes";
|
import { buildHostAgentDetailRoute, buildHostWorkspaceRoute } from "@/utils/host-routes";
|
||||||
import type { WebSocketRoute } from "@playwright/test";
|
import type { WebSocketRoute } from "@playwright/test";
|
||||||
import { expect, test, type Page } from "./fixtures";
|
import { expect, test, type Page } from "./fixtures";
|
||||||
import { gotoAppShell } from "./helpers/app";
|
import { gotoAppShell } from "./helpers/app";
|
||||||
@@ -133,28 +133,34 @@ test.describe("Workspace navigation regression", () => {
|
|||||||
const daemonGate = await installDaemonWebSocketGate(page, daemonPort);
|
const daemonGate = await installDaemonWebSocketGate(page, daemonPort);
|
||||||
|
|
||||||
const workspaceClient = await connectNewWorkspaceDaemonClient();
|
const workspaceClient = await connectNewWorkspaceDaemonClient();
|
||||||
|
const archiveClient = await connectArchiveTabDaemonClient();
|
||||||
const workspaceIds = new Set<string>();
|
const workspaceIds = new Set<string>();
|
||||||
|
const agentIds: string[] = [];
|
||||||
const repo = await createTempGitRepo("workspace-reconnect-");
|
const repo = await createTempGitRepo("workspace-reconnect-");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const workspace = await openProjectViaDaemon(workspaceClient, repo.path);
|
const workspace = await openProjectViaDaemon(workspaceClient, repo.path);
|
||||||
workspaceIds.add(workspace.workspaceId);
|
workspaceIds.add(workspace.workspaceId);
|
||||||
|
|
||||||
|
const agent = await createIdleAgent(archiveClient, {
|
||||||
|
cwd: repo.path,
|
||||||
|
title: `workspace-reconnect-${Date.now()}`,
|
||||||
|
});
|
||||||
|
agentIds.push(agent.id);
|
||||||
|
|
||||||
await gotoAppShell(page);
|
await gotoAppShell(page);
|
||||||
await waitForSidebarHydration(page);
|
await waitForSidebarHydration(page);
|
||||||
await switchWorkspaceViaSidebar({
|
await page.goto(buildHostAgentDetailRoute(serverId, agent.id, agent.cwd));
|
||||||
page,
|
await page.waitForURL(
|
||||||
serverId,
|
(url) => url.pathname.includes("/workspace/") && !url.searchParams.has("open"),
|
||||||
targetWorkspacePath: workspace.workspaceId,
|
{ timeout: 60_000 },
|
||||||
});
|
);
|
||||||
await expectWorkspaceHeader(page, {
|
await expectWorkspaceHeader(page, {
|
||||||
title: workspace.workspaceName,
|
title: workspace.workspaceName,
|
||||||
subtitle: workspace.projectDisplayName,
|
subtitle: workspace.projectDisplayName,
|
||||||
});
|
});
|
||||||
await expect(page.getByTestId("workspace-tabs-row")).toBeVisible({ timeout: 30_000 });
|
await expect(page.getByTestId("workspace-tabs-row")).toBeVisible({ timeout: 30_000 });
|
||||||
await expect(page.getByRole("textbox", { name: "Message agent..." })).toBeVisible({
|
await expectWorkspaceTabVisible(page, agent.id);
|
||||||
timeout: 30_000,
|
|
||||||
});
|
|
||||||
|
|
||||||
await daemonGate.drop();
|
await daemonGate.drop();
|
||||||
await expect(page.getByTestId("agent-reconnecting-toast")).toBeVisible({
|
await expect(page.getByTestId("agent-reconnecting-toast")).toBeVisible({
|
||||||
@@ -184,9 +190,13 @@ test.describe("Workspace navigation regression", () => {
|
|||||||
await expect(page.getByRole("textbox", { name: "Message agent..." })).toBeVisible();
|
await expect(page.getByRole("textbox", { name: "Message agent..." })).toBeVisible();
|
||||||
} finally {
|
} finally {
|
||||||
daemonGate.restore();
|
daemonGate.restore();
|
||||||
|
for (const agentId of agentIds) {
|
||||||
|
await archiveAgentFromDaemon(archiveClient, agentId).catch(() => undefined);
|
||||||
|
}
|
||||||
for (const workspaceId of workspaceIds) {
|
for (const workspaceId of workspaceIds) {
|
||||||
await archiveLocalWorkspaceFromDaemon(workspaceClient, workspaceId).catch(() => undefined);
|
await archiveLocalWorkspaceFromDaemon(workspaceClient, workspaceId).catch(() => undefined);
|
||||||
}
|
}
|
||||||
|
await archiveClient.close().catch(() => undefined);
|
||||||
await workspaceClient.close().catch(() => undefined);
|
await workspaceClient.close().catch(() => undefined);
|
||||||
await repo.cleanup();
|
await repo.cleanup();
|
||||||
}
|
}
|
||||||
@@ -213,7 +223,7 @@ test.describe("Workspace navigation regression", () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
await expect(
|
await expect(
|
||||||
page.getByText(/Connecting to localhost|localhost is offline|Cannot reach localhost/i),
|
page.getByText(/^Connecting$|localhost is offline|Cannot reach localhost/i),
|
||||||
).toBeVisible({ timeout: 30_000 });
|
).toBeVisible({ timeout: 30_000 });
|
||||||
await expect(page.getByTestId("menu-button")).toBeVisible();
|
await expect(page.getByTestId("menu-button")).toBeVisible();
|
||||||
await expect(page.getByTestId("workspace-header-title")).toHaveCount(0);
|
await expect(page.getByTestId("workspace-header-title")).toHaveCount(0);
|
||||||
|
|||||||
Reference in New Issue
Block a user