Skip to content

Conversation

@Artur-
Copy link
Member

@Artur- Artur- commented Jan 22, 2026

Fixes #1729

The first() method can lead to flaky tests when multiple matching
elements exist, as it arbitrarily selects the first one without
validation. Users should use single() instead, which asserts exactly
one element matches and fails immediately if multiple are found,
making tests more reliable and failures easier to diagnose.

For intentional selection from multiple elements, get(int) or
atIndex(int) should be used with an explicit index.

Deprecated methods:
- ElementQuery.first()
- ElementQuery.waitForFirst()
- ElementQuery.waitForFirst(long)
- ComponentQuery.first()

Fixes #1729
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

first() is fundamentally broken

2 participants