Skip to content

fix(options): return Flutter timeout options as timedelta - #1343

Open
MattL1989 wants to merge 1 commit into
appium:masterfrom
MattL1989:fix/flutter-timeout-option-getters
Open

MattL1989 wants to merge 1 commit into
appium:masterfrom
MattL1989:fix/flutter-timeout-option-getters

Conversation

@MattL1989

Copy link
Copy Markdown
Contributor

Problem

FlutterOptions.flutter_element_wait_timeout and FlutterOptions.flutter_server_launch_timeout are annotated -> timedelta | None, and their docstrings say they return a timedelta. Their setters accept a timedelta and store it as milliseconds. The getters, however, returned the raw capability value:

options = FlutterOptions()
options.flutter_element_wait_timeout = timedelta(seconds=10)
options.flutter_element_wait_timeout  # 10000, expected timedelta(seconds=10)

Every other millisecond timeout option, such as adb_exec_timeout and wda_launch_timeout, converts the stored value back to a timedelta.

Fix

Return timedelta(milliseconds=value) from both getters, or None when the capability is not set, matching the other timeout options. What gets sent to the server does not change.

Tests

  • Added a unit test that sets one option as a timedelta and the other as an int, reads both back as timedelta, and checks that the capabilities sent are still in milliseconds. It fails without the fix with assert 10000 == datetime.timedelta(seconds=10).
  • ruff check, ruff format --check, mypy appium and the full unit test suite pass.

🤖 Generated with Claude Code

The flutter_element_wait_timeout and flutter_server_launch_timeout getters
are annotated and documented to return a timedelta, and their setters accept
one, but the getters returned the raw capability value in milliseconds. So
setting timedelta(seconds=10) and reading it back gave 10000.

Convert the stored milliseconds to a timedelta, like the other timeout
options do.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K6zVKi1DtwmmBpy16MQyfY
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