Skip to content

Commit 18e33d9

Browse files
tune caps
1 parent 1d497de commit 18e33d9

File tree

1 file changed

+26
-30
lines changed
  • test/functional/flutter_integration/helper

1 file changed

+26
-30
lines changed

test/functional/flutter_integration/helper/options.py

Lines changed: 26 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# limitations under the License.
1414

1515
import os
16-
from typing import Optional
16+
from typing import Any, Dict
1717

1818
from appium.options.flutter_integration.base import FlutterOptions
1919
from test.functional.test_helper import get_wda_port, get_worker_info
@@ -38,7 +38,7 @@ def get_flutter_system_port() -> int:
3838
return 9999 + (worker_info.worker_number or 0)
3939

4040

41-
def make_options(app: Optional[str] = None) -> FlutterOptions:
41+
def make_options() -> FlutterOptions:
4242
"""Get Flutter options configured for testing with parallel execution support."""
4343
options = FlutterOptions()
4444

@@ -48,34 +48,30 @@ def make_options(app: Optional[str] = None) -> FlutterOptions:
4848
options.flutter_element_wait_timeout = 10000
4949
options.flutter_server_launch_timeout = 120000
5050

51-
# Set platform-specific capabilities
52-
if is_platform_android():
53-
options.platform_name = 'Android'
54-
options.device_name = device_name()
55-
options.new_command_timeout = 120
56-
options.uiautomator2_server_install_timeout = 120000
57-
options.adb_exec_timeout = 120000
58-
options.auto_grant_permissions = True
59-
60-
if app is not None:
61-
options.app = PATH(os.path.join('..', '..', '..', 'apps', app))
62-
elif os.getenv('FLUTTER_ANDROID_APP'):
63-
options.app = os.getenv('FLUTTER_ANDROID_APP')
64-
else: # iOS
65-
options.platform_name = 'iOS'
66-
options.device_name = device_name()
67-
options.platform_version = os.getenv('IOS_VERSION') or '17.4'
68-
options.allow_touch_id_enroll = True
69-
options.wda_launch_timeout = 240000
70-
options.wda_local_port = get_wda_port()
71-
options.event_timings = True
72-
73-
if app is not None:
74-
options.app = PATH(os.path.join('..', '..', '..', 'apps', app))
75-
elif os.getenv('FLUTTER_IOS_APP'):
76-
options.app = os.getenv('FLUTTER_IOS_APP')
77-
78-
return options
51+
caps: Dict[str, Any] = (
52+
{
53+
'platformName': 'Android',
54+
'deviceName': device_name(),
55+
'newCommandTimeout': 120,
56+
'uiautomator2ServerInstallTimeout': 120000,
57+
'adbExecTimeout': 120000,
58+
'app': os.getenv('FLUTTER_ANDROID_APP'),
59+
'autoGrantPermissions': True,
60+
}
61+
if is_platform_android()
62+
else {
63+
'deviceName': device_name(),
64+
'platformName': 'iOS',
65+
'platformVersion': os.getenv('IOS_VERSION'),
66+
'allowTouchIdEnroll': True,
67+
'wdaLaunchTimeout': 240000,
68+
'wdaLocalPort': 8100,
69+
'eventTimings': True,
70+
'app': os.getenv('FLUTTER_IOS_APP'),
71+
}
72+
)
73+
74+
return options.load_capabilities(caps)
7975

8076

8177
def device_name() -> str:

0 commit comments

Comments
 (0)