[Feature]: Order-Insensitive Collection Assertions

未关闭
#1,876 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
48/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
冷清
技术栈
java, playwright
领域
testing

调研方向

首先定位 hasText(String[] expected) 断言和 HasTextOptions,然后检查集合值的比较方式,以及现有断言测试如何覆盖重试。确定哪个提议的 API 符合项目约定,并添加测试覆盖,证明忽略顺序的匹配能够成功,同时保留当前依赖顺序的行为。完成标准是新选项或方法能够处理集合的非确定性顺序,同时不绕过自动重试。

由索引模型根据 Issue 内容生成。

描述

🚀 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.

主要语言
Java
星标
1.6k
派生
298
平均合并
3 天 2 小时
30 天内合并 PR
14

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

microsoft/playwright-java 的其他 Issue

查看 microsoft/playwright-java 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。