-
Notifications
You must be signed in to change notification settings - Fork 5.1k
test: use role based selectors in trace-viewer tests #36295
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: use role based selectors in trace-viewer tests #36295
Conversation
229eb3e to
e57d0af
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
e57d0af to
9afd65f
Compare
This comment has been minimized.
This comment has been minimized.
9afd65f to
77533e8
Compare
This comment has been minimized.
This comment has been minimized.
| @step | ||
| async selectAction(title: string, ordinal: number = 0) { | ||
| await this.page.locator(`.action-title:has-text("${title}")`).nth(ordinal).click(); | ||
| await this.actionsTree.getByTitle(title).nth(ordinal).click(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not getByRole('treeitem', { name: title }) as in previous method?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment has been minimized.
This comment has been minimized.
| } | ||
|
|
||
| stackFrames(selected?: boolean) { | ||
| const entry = this.page.getByRole('list', { name: 'Stack trace' }).getByRole('listitem'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally, we pass { selected } into getByRole. Perhaps we are missing aria-selected somewhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aria-selected is unfortunately not valid on listitems: https://www.w3.org/TR/wai-aria-1.2/#aria-selected
We then throw that its not valid (we add aria-listed on the listitem).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting 😄 I guess it should be aria-current then, but we don't have an option for this in getByRole().
Co-authored-by: Dmitry Gozman <dgozman@gmail.com> Signed-off-by: Max Schmitt <max@schmitt.mx>
This comment has been minimized.
This comment has been minimized.
Test results for "tests 1"2 flaky39405 passed, 822 skipped Merge workflow run. |
Signed-off-by: Max Schmitt <max@schmitt.mx> Co-authored-by: Dmitry Gozman <dgozman@gmail.com>

Addresses the comments from microsoft/playwright-python#2885 (review).