test: use role based selectors in trace-viewer tests#36295
Merged
mxschmitt merged 4 commits intomicrosoft:mainfrom Jun 16, 2025
Merged
test: use role based selectors in trace-viewer tests#36295mxschmitt merged 4 commits intomicrosoft:mainfrom
mxschmitt merged 4 commits intomicrosoft:mainfrom
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.
dgozman
reviewed
Jun 13, 2025
| @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(); |
Contributor
There was a problem hiding this comment.
Why not getByRole('treeitem', { name: title }) as in previous method?
Contributor
Author
This comment has been minimized.
This comment has been minimized.
dgozman
approved these changes
Jun 15, 2025
| } | ||
|
|
||
| stackFrames(selected?: boolean) { | ||
| const entry = this.page.getByRole('list', { name: 'Stack trace' }).getByRole('listitem'); |
Contributor
There was a problem hiding this comment.
Ideally, we pass { selected } into getByRole. Perhaps we are missing aria-selected somewhere?
Contributor
Author
There was a problem hiding this comment.
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).
Contributor
There was a problem hiding this comment.
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.
Contributor
Test results for "tests 1"2 flaky39405 passed, 822 skipped Merge workflow run. |
whazor
pushed a commit
to whazor/playwright-trace-viewer-plus
that referenced
this pull request
Jan 10, 2026
Signed-off-by: Max Schmitt <max@schmitt.mx> Co-authored-by: Dmitry Gozman <dgozman@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

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