Skip to content

fix(flutter): accept a FlutterFinder as scrollView in scroll_till_visible - #5

Draft
MattL1989 wants to merge 1 commit into
masterfrom
fix/flutter-scroll-view-finder
Draft

MattL1989 wants to merge 1 commit into
masterfrom
fix/flutter-scroll-view-finder

Conversation

@MattL1989

Copy link
Copy Markdown
Owner

Problem

The scroll_till_visible docstring describes the scrollView keyword argument as scrollView (str): The view of the scroll. Default value is 'Scrollable'. The client sends whatever it is given unchanged:

  • A string, as documented. The server rejects it. appium-flutter-server parses scrollView with FindElementModel.fromJson(json['scrollView'] as Map<String, dynamic>), so it must be a finder map.
  • A FlutterFinder, the type the other Flutter commands take. It fails on the client with TypeError: Object of type FlutterFinder is not JSON serializable.
  • A dict built with FlutterFinder.to_dict(). This is the only form that works, which is what the existing unit test uses.

Fix

  • If scrollView is a FlutterFinder, convert it with .to_dict(), the same way the target finder is converted.
  • Dicts keep working unchanged, so this is backward compatible.
  • Correct the docstring to scrollView (FlutterFinder | dict). When scrollView is omitted, the server uses the first Scrollable widget (find.byType(Scrollable)).

Tests

  • Added a unit test that passes scrollView=FlutterFinder.by_key(...) and checks the finder map that is sent. Without the fix it fails with TypeError: Object of type FlutterFinder is not JSON serializable.
  • ruff check, ruff format --check, mypy appium and the full unit test suite pass. Merged together with the horizontal-scroll fix (fix(flutter): support horizontal scrolling in scroll_till_visible #4) it also merges cleanly and passes.

Generated by Claude Code

…ible

The scroll_till_visible docstring described scrollView as a string with
the default 'Scrollable', but the Flutter integration server parses
scrollView as a finder map (FindElementModel), so a string fails on the
server. Passing a FlutterFinder, which is what the other Flutter commands
take, failed on the client with "Object of type FlutterFinder is not JSON
serializable"; only a hand-built dict from FlutterFinder.to_dict() worked.

Convert a FlutterFinder scrollView to its dict form, keep accepting dicts,
and document the argument correctly.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@MattL1989
MattL1989 force-pushed the fix/flutter-scroll-view-finder branch from f030e8e to 914dd84 Compare November 1, 2026 18:45
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.

1 participant