Derive tab testIDs from the tab target
The tab testID was reading from tabId, which intentionally stays as the draft id after a draft -> agent handoff so the panel React key remains stable and the component does not remount. The data-testid was riding along on that identity and stayed workspace-tab-draft_xxx forever, even though the tab semantically became an agent. Tests that look for workspace-tab-agent_* timed out. Read testIDs from tab.target via buildDeterministicWorkspaceTabId so the testID reflects what the tab represents. React key is unchanged.
This commit is contained in:
@@ -82,7 +82,11 @@ import type { WorkspaceTab, WorkspaceTabTarget } from "@/stores/workspace-tabs-s
|
||||
import { useKeyboardActionHandler } from "@/hooks/use-keyboard-action-handler";
|
||||
import type { KeyboardActionDefinition } from "@/keyboard/keyboard-action-dispatcher";
|
||||
import { useCreateFlowStore } from "@/stores/create-flow-store";
|
||||
import { normalizeWorkspaceTabTarget, workspaceTabTargetsEqual } from "@/workspace-tabs/identity";
|
||||
import {
|
||||
buildDeterministicWorkspaceTabId,
|
||||
normalizeWorkspaceTabTarget,
|
||||
workspaceTabTargetsEqual,
|
||||
} from "@/workspace-tabs/identity";
|
||||
import {
|
||||
getHostRuntimeStore,
|
||||
useHostRuntimeClient,
|
||||
@@ -516,7 +520,7 @@ function MobileWorkspaceTabOption({
|
||||
onCloseTabsBelow: (tabId: string) => Promise<void> | void;
|
||||
onCloseOtherTabs: (tabId: string) => Promise<void> | void;
|
||||
}) {
|
||||
const menuTestIDBase = `workspace-tab-menu-${tab.key}`;
|
||||
const menuTestIDBase = `workspace-tab-menu-${buildDeterministicWorkspaceTabId(tab.target)}`;
|
||||
const menuEntries = buildWorkspaceTabMenuEntries({
|
||||
surface: "mobile",
|
||||
tab,
|
||||
|
||||
Reference in New Issue
Block a user