Skip to content

fix(flutter): support horizontal scrolling in scroll_till_visible - #1351

Open
MattL1989 wants to merge 1 commit into
appium:masterfrom
MattL1989:fix/flutter-horizontal-scroll
Open

MattL1989 wants to merge 1 commit into
appium:masterfrom
MattL1989:fix/flutter-horizontal-scroll

Conversation

@MattL1989

Copy link
Copy Markdown
Contributor

Problem

ScrollDirection only defines UP and DOWN, so FlutterCommand.scroll_till_visible cannot scroll a horizontal list or carousel. Passing a string instead fails on the client:

flutter.scroll_till_visible(finder, 'left')
# AttributeError: 'str' object has no attribute 'value'

The Flutter integration server supports all four directions. appium-flutter-server's scroll_till_visible model maps AxisDirection.up/right/down/left to 'up', 'right', 'down' and 'left'. The driver's WebdriverIO service types scrollDirection as 'up' | 'right' | 'down' | 'left'.

Fix

Add ScrollDirection.LEFT = 'left' and ScrollDirection.RIGHT = 'right', and update the docstring, which said "up or down". The default stays DOWN, so existing calls are unchanged.

Tests

  • Added a parametrized unit test checking that LEFT and RIGHT are sent as 'left' and 'right'. It fails without the fix with AttributeError: type object 'ScrollDirection' has no attribute 'LEFT'.
  • ruff check, ruff format --check, mypy appium and the full unit test suite pass.

🤖 Generated with Claude Code

ScrollDirection only defined UP and DOWN, so scroll_till_visible could not
scroll a horizontal list, although the Flutter integration server accepts
'left' and 'right' as scrollDirection (AxisDirectionEnumMap in
appium-flutter-server's scroll_till_visible model).

Add the LEFT and RIGHT members. The default stays DOWN.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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