Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: replace duplicated commands/endpoint with mobile extentions #600

Open
wants to merge 20 commits into
base: master
Choose a base branch
from

Conversation

KazuCocoa
Copy link
Member

@KazuCocoa KazuCocoa commented Mar 16, 2025

  • Remove deprecated marked commands
    • get_network_connection / set_network_connection, toggle_wifi, toggle_data, toggle_airplane_mode -> Please use mobile: setConnectivity / mobile: getConnectivity instead
    • start_activity -> Please use mobile: startActivity instead
  • Use mobile command for existing methods (the backend method call has changed. Old appium such as Appium v1 or before may have an issue as no matched command)
    • toggle_location_services, get_performance_data, get_performance_data_types, finger_print, open_notifications, current_activity, current_package, get_system_bars, system_bars, toggle_location_services, hide_keyboard, background_app, set_clipboard, get_clipboard, send_sms, gsm_call, gsm_signal, gsm_voice, set_network_speed, set_power_capacity, set_power_ac, get_display_density, lock, unlock, locked?, hide_keyboard, press_keycode, long_press_keycode, app_strings, app_state, shake, device_time

@KazuCocoa KazuCocoa requested a review from Copilot March 16, 2025 23:21

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 29 out of 29 changed files in this pull request and generated no comments.

@KazuCocoa KazuCocoa changed the title Mobile commands feat: replace duplicated commands/endpoint with mobile extentions Mar 17, 2025
@KazuCocoa KazuCocoa marked this pull request as ready for review March 17, 2025 06:20
@KazuCocoa KazuCocoa requested a review from Copilot March 17, 2025 06:20
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request replaces several deprecated endpoints in favor of mobile extension commands to simplify the API and reduce duplication. Key changes include switching from execute to execute_script calls, updating command names to their mobile equivalents, and removing old network connection endpoints.

Reviewed Changes

Copilot reviewed 33 out of 33 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
lib/appium_lib_core/android/device/screen.rb Replaced deprecation warning and execute call for display density
lib/appium_lib_core/common/device/app_state.rb Updated to use mobile:queryAppState and refined comments
lib/appium_lib_core/ios/device/clipboard.rb Updated clipboard methods to use mobile commands
lib/appium_lib_core/android/device/emulator.rb Updated SMS, GSM, network speed, and power methods to mobile commands
lib/appium_lib_core/common/base/driver.rb Removed deprecation warnings and updated hide_keyboard methods
lib/appium_lib_core/common/device/keyboard.rb Removed the strategy parameter for hide_keyboard in favor of mobile command
lib/appium_lib_core/android/device/auth_finger_print.rb Switched to mobile:fingerprint command
lib/appium_lib_core/common/device/app_management.rb Replaced app_strings to use mobile:getAppStrings
lib/appium_lib_core/ios/device.rb Updated biometric and notification methods to utilize mobile commands
lib/appium_lib_core/android/device/performance.rb Updated performance data endpoints, removing the data_read_timeout parameter
lib/appium_lib_core/android/device.rb Updated several Android device methods to use mobile commands; removed deprecated methods and unused endpoints
lib/appium_lib_core/common/device/device.rb Simplified shake and device_time commands with mobile alternatives
lib/appium_lib_core/common/device/device_lock.rb Updated locking methods to new mobile commands
lib/appium_lib_core/ios/xcuitest/device.rb Revised hide_keyboard and background_app methods for mobile commands
lib/appium_lib_core/common/base/bridge.rb Removed obsolete network connection methods
lib/appium_lib_core/common/device/keyevent.rb Updated key event methods to use mobile:pressKey command
lib/appium_lib_core/common/command.rb Removed deprecated commands and IOS-specific endpoints
lib/appium_lib_core/android/device/network.rb Removed entire file as it’s now deprecated
lib/appium_lib_core/common/base/has_network_connection.rb Removed entire file as network connection functionality is replaced
Comments suppressed due to low confidence (1)

lib/appium_lib_core/android/device/performance.rb:28

  • [nitpick] The data_read_timeout parameter was removed from the get_performance_data method signature; ensure that this change is intentional as it may affect performance data retrieval behavior.
def get_performance_data(package_name:, data_type:)

@KazuCocoa KazuCocoa requested a review from Copilot March 17, 2025 06:34

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@KazuCocoa KazuCocoa requested a review from Copilot March 17, 2025 06:39

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR replaces multiple deprecated commands with their corresponding mobile extensions and removes duplicate implementations. Key changes include:

  • Replacing all execute calls for deprecated commands with execute_script calls using mobile endpoints.
  • Removing network connection related files and methods, and streamlining legacy deprecation warnings.
  • Updating method implementations across both Android and iOS specific files to reflect the new mobile command conventions.

Reviewed Changes

Copilot reviewed 33 out of 33 changed files in this pull request and generated no comments.

Show a summary per file
File Description
lib/appium_lib_core/android/device/screen.rb Updated get_display_density to use mobile endpoint
lib/appium_lib_core/common/device/app_state.rb Changed app_state to use mobile:queryAppState
lib/appium_lib_core/android/device/emulator.rb Updated several emulator commands to use mobile endpoints
lib/appium_lib_core/ios/device/clipboard.rb Replaced clipboard commands with mobile endpoints
lib/appium_lib_core/common/device/keyboard.rb Updated keyboard methods to use mobile endpoints
lib/appium_lib_core/common/base/driver.rb Removed deprecated network and device locking commands
lib/appium_lib_core/android/device/auth_finger_print.rb Updated finger_print to use mobile:fingerprint
lib/appium_lib_core/common/device/app_management.rb Replaced app_strings command with mobile:getAppStrings
lib/appium_lib_core/android/device/clipboard.rb Updated clipboard commands to use mobile endpoints
lib/appium_lib_core/android/device/performance.rb Removed deprecation warnings and updated performance calls
lib/appium_lib_core/ios/device.rb Updated touch_id and toggle_touch_id_enrollment methods
lib/appium_lib_core/android/device.rb Removed deprecated endpoints and removed network commands
lib/appium_lib_core/common/device/device.rb Updated device methods to use mobile endpoints
lib/appium_lib_core/common/device/device_lock.rb Updated device lock methods to use mobile endpoints
lib/appium_lib_core/ios/xcuitest/device.rb Updated hide_keyboard and background_app methods
lib/appium_lib_core/common/base/bridge.rb Removed network connection interface methods
lib/appium_lib_core/common/device/keyevent.rb Updated key event methods to use mobile:pressKey
lib/appium_lib_core/common/command.rb Removed several deprecated command mappings
lib/appium_lib_core/common/base/has_network_connection.rb Removed obsolete network connection module
lib/appium_lib_core/android/device/network.rb Removed deprecated Android network commands
Comments suppressed due to low confidence (1)

lib/appium_lib_core/android/device.rb:285

  • The 'start_activity' method incorrectly calls 'mobile:toggleGps' instead of the expected 'mobile:startActivity'. Please update the endpoint call to 'mobile:startActivity'.
execute_script 'mobile:toggleGps', {}
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