microsoft / microsoft/playwright-java
[Feature]: Order-Insensitive Collection Assertions
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1.6k
- Forks
- 298
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 14
Description
🚀 Feature Request
The hasText(String[] expected) assertion is strictly order-dependent. However, many UI components (like tags, filter chips, or list items) might appear in a non-deterministic order or the order might be irrelevant to the test case.
Example
Add a param to HasTextOptions or a new method to ignore order: hasText(String[] expected, boolean ignoreOrder) or hasTextInAnyOrder(String[] expected).
Motivation
Resilience to Change: Tests won't fail due to minor UI sorting changes that do not affect business logic.
Cleaner Test Code: Developers won't need to manually fetch, sort, and compare lists, which often bypasses Playwright's automatic retries.
Implementation: This can be implemented by internally sorting both the actual and expected collections before comparison when the flag is set.
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
Start by locating the hasText(String[] expected) assertion and HasTextOptions, then review how collection values are compared and how existing assertion tests cover retries. Decide which proposed API fits the project conventions and add coverage showing that order-insensitive matching succeeds while preserving the current order-dependent behavior. Done means the new option or method handles nondeterministic collection order without bypassing automatic retries.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, playwright
- Domain
- testing
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100