From 64a42e645b2d6b3e2b8621329656d322a109e962 Mon Sep 17 00:00:00 2001 From: Cliff Hall Date: Wed, 29 Apr 2026 17:24:52 -0400 Subject: [PATCH] fix(stories): scope ResourceSelected click to URIs region (#1248) (#1255) The ResourceSelected story passed both sampleResources and sampleSubscriptions, each of which renders 'config.json' as text. The play helper's canvas.findByText('config.json') matched two nodes and rejected. Extends clickByText to accept an optional regionName regex; ResourceSelected now scopes the click to within the 'URIs' Accordion panel by aria-region name, so the subscriptions panel's matching label is filtered out without changing what the story demonstrates. Full storybook suite now green (273/273), unblocking #1251. Co-authored-by: Claude Opus 4.7 (1M context) --- .../ResourcesScreen/ResourcesScreen.stories.tsx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/clients/web/src/components/screens/ResourcesScreen/ResourcesScreen.stories.tsx b/clients/web/src/components/screens/ResourcesScreen/ResourcesScreen.stories.tsx index b8d21e08..72637d79 100644 --- a/clients/web/src/components/screens/ResourcesScreen/ResourcesScreen.stories.tsx +++ b/clients/web/src/components/screens/ResourcesScreen/ResourcesScreen.stories.tsx @@ -122,9 +122,16 @@ const readUserProfileState: ReadResourceState = { isSubscribed: false, }; -async function clickByText(canvasElement: HTMLElement, label: string) { +async function clickByText( + canvasElement: HTMLElement, + label: string, + regionName?: RegExp, +) { const canvas = within(canvasElement); - await userEvent.click(await canvas.findByText(label)); + const scope = regionName + ? within(await canvas.findByRole("region", { name: regionName })) + : canvas; + await userEvent.click(await scope.findByText(label)); } // The userId value typed below must match the `{userId}` segment in @@ -153,7 +160,7 @@ export const ResourceSelected: Story = { readState: readConfigState, }, play: async ({ canvasElement }) => { - await clickByText(canvasElement, "config.json"); + await clickByText(canvasElement, "config.json", /^URIs/); }, };