diff --git a/packages/insomnia-test/pages/mcp-client.page.ts b/packages/insomnia-test/pages/mcp-client.page.ts index 4ae84fdae9..8462fbb077 100644 --- a/packages/insomnia-test/pages/mcp-client.page.ts +++ b/packages/insomnia-test/pages/mcp-client.page.ts @@ -5,10 +5,6 @@ import { expect, type Locator } from "@playwright/test"; import { RequestPage } from "./request.page"; -/** Class the app adds to the selected sidebar row (the row has no selection attribute of its own). */ -const SELECTED_ROW_CLASS_NAME = 'bg-(--hl-sm)'; -const SELECTED_ROW_CLASS = /(^|\s)bg-\(--hl-sm\)(\s|$)/; - /** The error panel embedded in a capability item's row. */ export interface McpCapabilityError { title: string; @@ -227,7 +223,7 @@ export class McpClientPage extends RequestPage { // The sidebar is virtualized and re-renders while capabilities finish loading, which can swallow a click. await expect(async () => { await rows.nth(index).click(); - await expect(rows.nth(index)).toHaveClass(SELECTED_ROW_CLASS, { timeout: 2000 }); + await expect(rows.nth(index)).toHaveAttribute('data-active', 'true', { timeout: 2000 }); }).toPass({ timeout: DEFAULT_TIMEOUT }); } @@ -236,10 +232,10 @@ export class McpClientPage extends RequestPage { } /** - * Reads, per row of one primitive kind in sidebar order, whether the row is selected, from the highlight class the app adds to the selected row. + * Reads, per row of one primitive kind in sidebar order, whether the row is selected, from its data-active attribute (React Aria overwrites data-selected on these rows). */ async getPrimitiveSelection(type: McpPrimitiveType): Promise { - return this.primitiveRows(type).evaluateAll((rows, selectedClass) => rows.map(row => row.classList.contains(selectedClass)), SELECTED_ROW_CLASS_NAME); + return this.primitiveRows(type).evaluateAll(rows => rows.map(row => (row as HTMLElement).dataset.active === 'true')); } /** diff --git a/packages/insomnia/src/ui/components/mcp/mcp-pane.tsx b/packages/insomnia/src/ui/components/mcp/mcp-pane.tsx index be7f0dc162..24c2573535 100644 --- a/packages/insomnia/src/ui/components/mcp/mcp-pane.tsx +++ b/packages/insomnia/src/ui/components/mcp/mcp-pane.tsx @@ -594,6 +594,7 @@ const CollectionGridListItem = (props: { textValue={label} data-testid={`test-${uniqueId}`} data-selected={isSelected} + data-active={isSelected} style={style} >