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:
Mohamed Boudra
2026-05-26 15:37:08 +07:00
parent 9c5f6007be
commit 81407c5ffc
3 changed files with 10 additions and 4 deletions
@@ -54,6 +54,7 @@ import {
WorkspaceTabIcon,
type WorkspaceTabPresentation,
} from "@/screens/workspace/workspace-tab-presentation";
import { buildDeterministicWorkspaceTabId } from "@/workspace-tabs/identity";
import {
buildWorkspaceDesktopTabActions,
type WorkspaceDesktopTabActions,
@@ -379,7 +380,7 @@ function TabChip({
<ContextMenuTrigger
{...(dragHandleProps?.attributes as object | undefined)}
{...(dragHandleProps?.listeners as object | undefined)}
testID={`workspace-tab-${tab.key}`}
testID={`workspace-tab-${buildDeterministicWorkspaceTabId(tab.target)}`}
triggerRef={dragHandleProps?.setActivatorNodeRef as unknown as undefined}
enabledOnMobile={false}
style={tabChipStyle}