Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def scroll_till_visible(
scroll_direction (ScrollDirection): The direction to scroll up or down. Defaults to `ScrollDirection.DOWN`.

KeywordArgs:
scrollView (str): The view of the scroll. Default value is 'Scrollable'
scrollView (FlutterFinder | dict): Finder of the scrollable view. Defaults to the first `Scrollable` widget
delta (int): delta for the scroll. Default value is 64
maxScrolls (int): Max times to scroll. Default value is 15
settleBetweenScrollsTimeout (float): settle timeout in milliseconds. Default value is 5000
Expand All @@ -142,6 +142,8 @@ def scroll_till_visible(
"""
opts['finder'] = scroll_to.to_dict()
opts['scrollDirection'] = scroll_direction.value
if isinstance(opts.get('scrollView'), FlutterFinder):
opts['scrollView'] = opts['scrollView'].to_dict()
return self.execute_flutter_command('scrollTillVisible', opts)

def inject_mock_image(self, value: str) -> str:
Expand Down
22 changes: 22 additions & 0 deletions test/unit/webdriver/flutter_integration/flutter_actions_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,28 @@ def test_scroll_till_visible_with_kwargs(self):
}
assert arguments == expected_arguments

@httpretty.activate
def test_scroll_till_visible_with_scroll_view_finder(self):
driver = flutter_w3c_driver()
flutter = FlutterCommand(driver)

httpretty.register_uri(
httpretty.POST,
appium_command('/session/1234567890/execute/sync'),
)

finder = FlutterFinder.by_key('message_field')
flutter.scroll_till_visible(finder, scrollView=FlutterFinder.by_key('message_list'))

request_body = get_httpretty_request_body(httpretty.last_request())
arguments = request_body['args'][0]
assert request_body['script'] == 'flutter: scrollTillVisible'
assert arguments == {
'finder': {'using': '-flutter key', 'value': 'message_field'},
'scrollView': {'using': '-flutter key', 'value': 'message_list'},
'scrollDirection': 'down',
}

@httpretty.activate
def test_inject_mock_image_with_file(self):
driver = flutter_w3c_driver()
Expand Down
Loading