Fix/wait for at#3062
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request replaces the standard finder.at(index) with a custom _PatrolIndexFinder implementation, enabling finders to wait for elements at specific indices to appear. Test cases have been updated to reflect that out-of-bounds indices now result in no widgets found rather than throwing an error. A critical bug was identified in the new filter logic where negative indices would cause a crash; it is recommended to handle these by returning early to ensure consistency with positive out-of-range indices.
pdenert
reviewed
May 14, 2026
Collaborator
pdenert
left a comment
There was a problem hiding this comment.
Please also add video of the demo run of this tests
pdenert
reviewed
May 14, 2026
pdenert
approved these changes
May 15, 2026
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.
Fixes issue #1938
Problem
first,last, andat()delegated directly to Flutter finders, which throw immediately for empty results (StateError/RangeError). That prevented Patrol’s normal waiting behavior intap()/waitUntilVisible()from kicking in when a widget appeared later.Fix
Replaced those selectors with a Patrol wrapper that returns an empty result instead of throwing when the selected element is not available yet. This lets waitUntilVisible() keep retrying until the widget appears or the regular timeout is reached.
Test plan
packages/patrol_finderscleanpackages/patrol_finders/test- 127/127 passed, including 7 new tests covering:dev/e2e_app/patrol_test/at_finder_test.dart- successfully waits for a second widget to appear without throwing.at._demo.mov
CI
test android emulator webview...expected to fail