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>
This commit is contained in:
parent
bcb5b643ff
commit
64a42e645b
1 changed files with 10 additions and 3 deletions
|
|
@ -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/);
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue