Fix workspace-owned Playwright flows

This commit is contained in:
Mohamed Boudra
2026-06-16 18:57:00 +07:00
parent 3cf3a63423
commit 37de9ea796
9 changed files with 22 additions and 2 deletions
+4 -2
View File
@@ -2,7 +2,8 @@ import { expect, type Page } from "@playwright/test";
import { buildHostWorkspaceRoute } from "@/utils/host-routes";
import { createTempGitRepo } from "./workspace";
import { connectSeedClient, type SeedDaemonClient } from "./seed-client";
import { connectWorkspaceSetupClient, openHomeWithProject } from "./workspace-setup";
import { gotoAppShell } from "./app";
import { connectWorkspaceSetupClient } from "./workspace-setup";
import { selectWorkspaceInSidebar } from "./sidebar";
import { getServerId } from "./server-id";
import { waitForTabBar } from "./launcher";
@@ -164,6 +165,7 @@ export async function startRunningMockAgent(
const agent = await client.createAgent({
provider: "mock",
cwd: repo.path,
workspaceId: opened.workspace.id,
model: opts.model,
});
const agentUrl = `${buildHostWorkspaceRoute(serverId, opened.workspace.id)}?open=${encodeURIComponent(`agent:${agent.id}`)}`;
@@ -188,7 +190,7 @@ export async function openGithubWorkspace(
const client = await connectWorkspaceSetupClient();
const opened = await client.openProject(repoPath);
if (!opened.workspace) throw new Error(opened.error ?? `Failed to open project ${repoPath}`);
await openHomeWithProject(page, repoPath);
await gotoAppShell(page);
await selectWorkspaceInSidebar(page, opened.workspace.id);
await waitForTabBar(page);
return { cleanup: () => client.close().catch(() => undefined) };
+3
View File
@@ -12,6 +12,9 @@ function pinToggle(page: Page, target: PinnedTabTarget) {
}
function menuItemFor(page: Page, target: PinnedTabTarget) {
if (target.kind === "draft") {
return page.getByTestId("workspace-new-tab-menu-agent");
}
return page.getByTestId(`workspace-new-tab-menu-${target.kind}`);
}
+1
View File
@@ -178,6 +178,7 @@ export async function launchAgent(input: {
const agent = await client.createAgent({
...fullAccessConfig(input.provider),
cwd: input.cwd,
workspaceId: opened.workspace.id,
title: `rewind-flow-${input.provider}-${randomUUID()}`,
});
const handle = {
@@ -139,6 +139,7 @@ async function measureAppBurstEcho(input: {
: await input.harness.client.createAgent({
provider: "mock",
cwd: input.harness.tempRepo.path,
workspaceId: input.harness.workspaceId,
title: "Large WebSocket payload",
modeId: "load-test",
});
@@ -77,6 +77,7 @@ function buildHistoricalAgentDetail(agent: AggregatedAgent): Agent {
},
title: agent.title,
cwd: agent.cwd,
workspaceId: agent.workspaceId,
model: null,
thinkingOptionId: null,
requiresAttention: agent.requiresAttention,
@@ -101,6 +102,7 @@ function rememberArchivedAgentDetail(agent: AggregatedAgent) {
...existing,
archivedAt: existing?.archivedAt ?? agent.archivedAt,
cwd: existing?.cwd ?? agent.cwd,
workspaceId: existing?.workspaceId ?? agent.workspaceId,
});
return next;
});
@@ -60,6 +60,7 @@ export async function fetchAgentHistoryPage(input: {
status: agent.status,
lastActivityAt: agent.lastActivityAt,
cwd: agent.cwd,
workspaceId: agent.workspaceId,
provider: agent.provider,
pendingPermissionCount: agent.pendingPermissions.length,
requiresAttention: agent.requiresAttention,
@@ -78,6 +78,7 @@ export function useAggregatedAgents(options?: {
status: agent.status,
lastActivityAt: agent.lastActivityAt,
cwd: agent.cwd,
workspaceId: agent.workspaceId,
provider: agent.provider,
pendingPermissionCount: agent.pendingPermissions.length,
requiresAttention: agent.requiresAttention,
@@ -8,6 +8,7 @@ export type AgentDirectoryEntry = Pick<
| "status"
| "lastActivityAt"
| "cwd"
| "workspaceId"
| "provider"
| "requiresAttention"
| "attentionReason"
+8
View File
@@ -31,6 +31,14 @@ export const usePinnedTargetsStore = create<PinnedTargetsState>()(
{
name: "pinned-tab-targets",
version: 1,
merge: (persistedState, currentState) => {
const persisted = persistedState as Partial<PinnedTargetsState> | null;
return {
...currentState,
...persisted,
pinned: persisted?.pinned ?? applyDefaultPinnedTargets([]),
};
},
storage: createJSONStorage(() => AsyncStorage),
partialize: (state) => ({ pinned: state.pinned }),
migrate: (persistedState, version) => {