microsoft / microsoft/playwright
[Feature]: Add `busy` option to `getByRole` method
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 96.4k
- Forks
- 6.5k
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 180
Description
🚀 Feature Request
Hey folks 👋
Small request here - I'd love to contribute a busy option to the getByRole method to target elements with aria-busy.
Example
Example JSX:
<div role="row">
<div role="cell">Some text</div>
<div role="cell" aria-busy={loading}>
{loading ? <SkeletonText /> : <Text>Some text<Text>}
</div>
<div>
Example usage in targeting the element:
this.page
.getByRole('row')
.getByRole('cell', {busy: false})
Motivation
We have several elements that render as skeleton blocks while loading and are then replaced with text on load finish. The goal here would be to use a locator to identify an element with a particular role but wait for aria-busy to be false.
Playwright already supports numerous aria properties here - such as expanded, pressed, selected etc. The inclusion of busy would be super helpful.
Alternatively if there's a better way to approach targeting these elements, I'm happy to hear your feedback.
Thanks ✌️
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Use the TypeScript getByRole implementation as the entry point, then trace how existing expanded, pressed, and selected options are handled. Add focused coverage for aria-busy true and false, and verify that the resulting locator behavior matches the requested examples.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api, testing-qa
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 58/100