From aea391d28b5de9f29d04d1a161f5a21a9c8d37e9 Mon Sep 17 00:00:00 2001 From: Dor-bl <59066376+Dor-bl@users.noreply.github.com> Date: Mon, 10 Aug 2026 06:34:15 +0000 Subject: [PATCH 1/3] refactor: remove legacy fallback for device_time Removes the legacy fallback mechanism in the `device_time` extension that relied on `UnknownMethodException` and `GET_DEVICE_TIME_GET` / `GET_DEVICE_TIME_POST` commands. It now directly uses `execute_script('mobile: getDeviceTime')`. Cleans up unneeded imports, constants, and the `CanRememberExtensionPresence` mixin. Updated the associated tests to remove obsolete HTTP mocks. --- appium/webdriver/extensions/device_time.py | 31 +++---------------- appium/webdriver/mobilecommand.py | 2 -- .../unit/webdriver/device/device_time_test.py | 15 --------- 3 files changed, 4 insertions(+), 44 deletions(-) diff --git a/appium/webdriver/extensions/device_time.py b/appium/webdriver/extensions/device_time.py index 22ac3c25a..28cbce005 100644 --- a/appium/webdriver/extensions/device_time.py +++ b/appium/webdriver/extensions/device_time.py @@ -14,16 +14,11 @@ from typing import Optional -from selenium.common.exceptions import UnknownMethodException - from appium.protocols.webdriver.can_execute_commands import CanExecuteCommands from appium.protocols.webdriver.can_execute_scripts import CanExecuteScripts -from appium.protocols.webdriver.can_remember_extension_presence import CanRememberExtensionPresence - -from ..mobilecommand import MobileCommand as Command -class DeviceTime(CanExecuteCommands, CanExecuteScripts, CanRememberExtensionPresence): +class DeviceTime(CanExecuteCommands, CanExecuteScripts): @property def device_time(self) -> str: """Returns the date and time from the device. @@ -31,12 +26,7 @@ def device_time(self) -> str: Return: str: The date and time """ - ext_name = 'mobile: getDeviceTime' - try: - return self.assert_extension_exists(ext_name).execute_script(ext_name) - except UnknownMethodException: - # TODO: Remove the fallback - return self.mark_extension_absence(ext_name).execute(Command.GET_DEVICE_TIME_GET, {})['value'] + return self.execute_script('mobile: getDeviceTime') def get_device_time(self, format: Optional[str] = None) -> str: """Returns the date and time from the device. @@ -54,22 +44,9 @@ def get_device_time(self, format: Optional[str] = None) -> str: Return: str: The date and time """ - ext_name = 'mobile: getDeviceTime' if format is None: return self.device_time - try: - return self.assert_extension_exists(ext_name).execute_script(ext_name, {'format': format}) - except UnknownMethodException: - return self.mark_extension_absence(ext_name).execute(Command.GET_DEVICE_TIME_POST, {'format': format})['value'] + return self.execute_script('mobile: getDeviceTime', {'format': format}) def _add_commands(self) -> None: - self.command_executor.add_command( - Command.GET_DEVICE_TIME_GET, - 'GET', - '/session/$sessionId/appium/device/system_time', - ) - self.command_executor.add_command( - Command.GET_DEVICE_TIME_POST, - 'POST', - '/session/$sessionId/appium/device/system_time', - ) + pass diff --git a/appium/webdriver/mobilecommand.py b/appium/webdriver/mobilecommand.py index ed8dc6f80..ad65603dc 100644 --- a/appium/webdriver/mobilecommand.py +++ b/appium/webdriver/mobilecommand.py @@ -35,8 +35,6 @@ class MobileCommand: IS_LOCKED = 'isLocked' LOCK = 'lock' UNLOCK = 'unlock' - GET_DEVICE_TIME_GET = 'getDeviceTimeGet' - GET_DEVICE_TIME_POST = 'getDeviceTimePost' INSTALL_APP = 'installApp' REMOVE_APP = 'removeApp' IS_APP_INSTALLED = 'isAppInstalled' diff --git a/test/unit/webdriver/device/device_time_test.py b/test/unit/webdriver/device/device_time_test.py index 4d7e72110..979700949 100644 --- a/test/unit/webdriver/device/device_time_test.py +++ b/test/unit/webdriver/device/device_time_test.py @@ -21,11 +21,6 @@ class TestWebDriverDeviceTime: @httpretty.activate def test_device_time(self): driver = android_w3c_driver() - httpretty.register_uri( - httpretty.GET, - appium_command('/session/1234567890/appium/device/system_time'), - body='{"value": "2019-01-05T14:46:44+09:00"}', - ) httpretty.register_uri( httpretty.POST, appium_command('/session/1234567890/execute/sync'), @@ -36,11 +31,6 @@ def test_device_time(self): @httpretty.activate def test_get_device_time(self): driver = android_w3c_driver() - httpretty.register_uri( - httpretty.GET, - appium_command('/session/1234567890/appium/device/system_time'), - body='{"value": "2019-01-05T14:46:44+09:00"}', - ) httpretty.register_uri( httpretty.POST, appium_command('/session/1234567890/execute/sync'), @@ -51,11 +41,6 @@ def test_get_device_time(self): @httpretty.activate def test_get_formatted_device_time(self): driver = android_w3c_driver() - httpretty.register_uri( - httpretty.POST, - appium_command('/session/1234567890/appium/device/system_time'), - body='{"value": "2019-01-08"}', - ) httpretty.register_uri( httpretty.POST, appium_command('/session/1234567890/execute/sync'), From c3ef212342bb37e8131a2e56fff9615a83d764da Mon Sep 17 00:00:00 2001 From: Dor-bl <59066376+Dor-bl@users.noreply.github.com> Date: Mon, 10 Aug 2026 07:26:56 +0000 Subject: [PATCH 2/3] refactor: remove legacy fallback for device_time Removes the legacy fallback mechanism in the `device_time` extension that relied on `UnknownMethodException` and `GET_DEVICE_TIME_GET` / `GET_DEVICE_TIME_POST` commands. It now directly uses `execute_script('mobile: getDeviceTime')`. Cleans up unneeded imports, constants, and the `CanRememberExtensionPresence` mixin. Updated the associated tests to remove obsolete HTTP mocks. Additionally fixes CI failures by pinning the flutter test app urls to the 0.0.33 release. --- .github/workflows/functional-test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/functional-test.yml b/.github/workflows/functional-test.yml index fecd4b1b1..c4d81cd1c 100644 --- a/.github/workflows/functional-test.yml +++ b/.github/workflows/functional-test.yml @@ -245,8 +245,8 @@ jobs: XCODE_VERSION: 16.4 IOS_VERSION: 18.5 IPHONE_MODEL: iPhone 16 - FLUTTER_ANDROID_APP: "https://github.com/AppiumTestDistribution/appium-flutter-server/releases/latest/download/app-debug.apk" - FLUTTER_IOS_APP: "https://github.com/AppiumTestDistribution/appium-flutter-server/releases/latest/download/ios.zip" + FLUTTER_ANDROID_APP: "https://github.com/AppiumTestDistribution/appium-flutter-server/releases/download/0.0.33/app-debug.apk" + FLUTTER_IOS_APP: "https://github.com/AppiumTestDistribution/appium-flutter-server/releases/download/0.0.33/ios.zip" PREBUILT_WDA_PATH: ${{ github.workspace }}/wda/WebDriverAgentRunner-Runner.app steps: From 2f93bad0831f9b04148df741165a279ba2562778 Mon Sep 17 00:00:00 2001 From: Dor-bl <59066376+Dor-bl@users.noreply.github.com> Date: Mon, 10 Aug 2026 08:34:47 +0000 Subject: [PATCH 3/3] refactor: remove legacy fallback for device_time Removes the legacy fallback mechanism in the `device_time` extension that relied on `UnknownMethodException` and `GET_DEVICE_TIME_GET` / `GET_DEVICE_TIME_POST` commands. It now directly uses `execute_script('mobile: getDeviceTime')`. Cleans up unneeded imports, constants, and the `CanRememberExtensionPresence` mixin. Updated the associated tests to remove obsolete HTTP mocks. Additionally fixes CI failures by pinning the flutter test app urls to the 0.0.33 release and increasing `androidInstallTimeout` for flutter tests. --- test/functional/flutter_integration/helper/options.py | 1 + 1 file changed, 1 insertion(+) diff --git a/test/functional/flutter_integration/helper/options.py b/test/functional/flutter_integration/helper/options.py index 0a44f372b..c0d86ac5d 100644 --- a/test/functional/flutter_integration/helper/options.py +++ b/test/functional/flutter_integration/helper/options.py @@ -50,6 +50,7 @@ def make_options() -> FlutterOptions: 'newCommandTimeout': 120, 'uiautomator2ServerInstallTimeout': 120000, 'adbExecTimeout': 120000, + 'androidInstallTimeout': 240000, 'app': os.environ['FLUTTER_ANDROID_APP'], 'autoGrantPermissions': True, }