Skip to content

Commit 64a42e6

Browse files
cliffhallclaude
andauthored
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) <noreply@anthropic.com>
1 parent bcb5b64 commit 64a42e6

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

clients/web/src/components/screens/ResourcesScreen/ResourcesScreen.stories.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,16 @@ const readUserProfileState: ReadResourceState = {
122122
isSubscribed: false,
123123
};
124124

125-
async function clickByText(canvasElement: HTMLElement, label: string) {
125+
async function clickByText(
126+
canvasElement: HTMLElement,
127+
label: string,
128+
regionName?: RegExp,
129+
) {
126130
const canvas = within(canvasElement);
127-
await userEvent.click(await canvas.findByText(label));
131+
const scope = regionName
132+
? within(await canvas.findByRole("region", { name: regionName }))
133+
: canvas;
134+
await userEvent.click(await scope.findByText(label));
128135
}
129136

130137
// The userId value typed below must match the `{userId}` segment in
@@ -153,7 +160,7 @@ export const ResourceSelected: Story = {
153160
readState: readConfigState,
154161
},
155162
play: async ({ canvasElement }) => {
156-
await clickByText(canvasElement, "config.json");
163+
await clickByText(canvasElement, "config.json", /^URIs/);
157164
},
158165
};
159166

0 commit comments

Comments
 (0)