Skip to content

Commit fb64716

Browse files
committed
test(console): read the drawn record page by its accessible name
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jTtndxBXWfjH1SiQ6w
1 parent 8282d7a commit fb64716

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

‎ui/packages/app-shell/src/views/RecordDetailView.appScopedPage-29592.test.tsx‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,15 +81,19 @@ function makeDataSource() {
8181
};
8282
}
8383

84-
/** A full record page of the user object whose body names the page, so the drawn page is readable. */
84+
/**
85+
* A full record page of the user object. Its accessible name (`aria.ariaLabel`,
86+
* stamped on the page root) names the page, so the drawn page is readable.
87+
*/
8588
function userPage(name: string, extra: Record<string, unknown> = {}) {
8689
return {
8790
name,
8891
label: name,
8992
type: 'record',
9093
object: OBJECT,
94+
aria: { ariaLabel: name },
9195
...extra,
92-
regions: [{ name: 'main', components: [{ type: 'text', value: `drawn page: ${name}` }] }],
96+
regions: [{ name: 'main', components: [] }],
9397
};
9498
}
9599

@@ -133,10 +137,10 @@ async function drawnPage(url: string, pages: unknown[], drawer = false): Promise
133137
</MemoryRouter>,
134138
);
135139
await waitFor(() => expect(ds.findOne).toHaveBeenCalled());
136-
await waitFor(() => expect(utils.container.textContent).toMatch(/drawn page: \w+/));
137-
const text = utils.container.textContent ?? '';
140+
await waitFor(() => expect(utils.container.querySelector('[data-page-type="record"][aria-label]')).not.toBeNull());
141+
const drawn = utils.container.querySelector('[data-page-type="record"][aria-label]')?.getAttribute('aria-label') ?? undefined;
138142
cleanup();
139-
return /drawn page: (\w+)/.exec(text)?.[1];
143+
return drawn;
140144
}
141145

142146
const recordUrl = (segment: string) => `/apps/${segment}/${OBJECT}/record/${REC}`;

0 commit comments

Comments
 (0)