Skip to content

BREAKING CHANGE: use extension commands for deprecated endpoints #939

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

Merged
merged 49 commits into from
May 28, 2025

Conversation

KazuCocoa
Copy link
Member

@KazuCocoa KazuCocoa commented May 5, 2025

List of changes

This will be a breaking change PR to clarify the change.

BREAKING CHANGES:

  • Removed
    • ToggleAirplaneMode, ToggleData, ToggleWifi, SetConnectionType
      • Use mobile:setConnectivity to turn on or off the desired connectivity preference
    • GetConnectionType
      • Use mobile:getConnectivity to get network connectivity status
    • EndTestCoverage
      • No longer exists in the appium uia2 driver. Please use mobile:shell to build shell command by yourself
    • StartActivityWithIntent, StartActivity
      • Please use mobile:startActivity * to build expected arguments to start an activity
    • strategy in HideKeyboard for iOS UiAutomation which is deprecated so long

This PR removes redundant while spaces in some files as well.

This has method removals also, so I'd expect this PR will bump a major version.

Types of changes

What types of changes are you proposing/introducing to the .NET client?
Put an x in the boxes that apply

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change that adds functionality or value)
  • Breaking change (fix or feature that would cause existing functionality not to work as expected)
  • Test fix (non-breaking change that improves test stability or correctness)

Documentation

  • Have you proposed a file change/ PR with Appium to update documentation?

This can be done by navigating to the documentation section on http://appium.io selecting the appropriate command/endpoint and clicking the 'Edit this doc' link to update the C# example

Integration tests

  • Have you provided integration tests for your changes? (required for Bugfix, New feature, or Test fix)

Details

Please provide more details about changes if necessary. You can provide code samples showing how they work and possible use cases if there are new features. Also, you can create gists with pasted C# code samples or put them here using markdown.
About markdown please read Mastering markdown and Writing on GitHub

@KazuCocoa KazuCocoa requested a review from Copilot May 17, 2025 22:43
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

A breaking change to replace deprecated Appium endpoints with mobile: extension commands across drivers, helpers, and tests.

  • Swap out old network, activity, and device methods for ExecuteScript("mobile:…") implementations
  • Remove obsolete interface and command constants, add new GetAppState, DeviceTime, and updated clipboard/biometric scripts
  • Update integration tests to call ExecuteScript and remove direct use of removed methods

Reviewed Changes

Copilot reviewed 28 out of 28 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
test/integration/Android/Device/SystemTests.cs Add CanGetSystemTimeTest using new DeviceTime property
test/integration/Android/Device/NetworkTests.cs Replace toggles for data/airplane/wifi with mobile:toggleGps
test/integration/Android/Device/Keys/KeyboardTests.cs Introduce startCustomTitleActivity helper via mobile:startActivity
test/integration/Android/Device/App/AppTests.cs Change driver to AndroidDriver and assert on GetAppState
test/integration/Android/ConnectionTest.cs Remove legacy ConnectionType test
test/integration/Android/AppStringsTest.cs Update language code from "en" to "ja" in string fetch test
test/integration/Android/ActivityTest.cs Swap StartActivity calls for mobile:startActivity + explicit wait
src/Appium.Net/Appium/iOS/IOSDriver.cs Add GetAppState via mobile:queryAppState
src/Appium.Net/Appium/iOS/IOSCommandExecutionHelper.cs Migrate iOS commands (shake, TouchID, clipboard) to mobile:
src/Appium.Net/Appium/Interfaces/INetworkActions.cs Remove deprecated toggle methods
src/Appium.Net/Appium/Interfaces/IInteractsWithApps.cs Prune old GetAppState signature
src/Appium.Net/Appium/AppiumDriverCommand.cs Drop obsolete JSONWP command constants
src/Appium.Net/Appium/AppiumDriver.cs Refactor to use ExecuteScript("mobile:…"), add DeviceTime
src/Appium.Net/Appium/AppiumCommandExecutionHelper.cs Convert helpers to DriverCommand.ExecuteScript for mobile:
src/Appium.Net/Appium/AppiumCommand.cs Remove legacy HTTP endpoint definitions
src/Appium.Net/Appium/Android/Interfaces/IStartsActivity.cs Delete old StartActivity method signatures
src/Appium.Net/Appium/Android/AndroidDriver.cs Remove deprecated methods, add GetAppState
src/Appium.Net/Appium/Android/AndroidCommandExecutionHelper.cs Refactor all Android commands to use mobile: script calls
Comments suppressed due to low confidence (5)

test/integration/Android/Device/Keys/KeyboardTests.cs:83

  • Method names in C# should use PascalCase. Rename startCustomTitleActivity to StartCustomTitleActivity.
private void startCustomTitleActivity() {

src/Appium.Net/Appium/Interfaces/IInteractsWithApps.cs:71

  • Drivers now implement GetAppState(string appId). Reintroduce this method in the IInteractsWithApps interface for a consistent API.
}

src/Appium.Net/Appium/iOS/IOSCommandExecutionHelper.cs:73

  • This method still calls AppiumCommandExecutionHelper.SetClipboard. It should call MobileSetClipboard to match the new mobile script API.
public static void SetClipboardImage(IExecuteMethod executeMethod, Image image)

src/Appium.Net/Appium/iOS/IOSCommandExecutionHelper.cs:80

  • Similarly, update this overload to use MobileSetClipboard instead of the old SetClipboard helper.
public static void SetClipboardImage(IExecuteMethod executeMethod, string base64EncodeImage)

src/Appium.Net/Appium/AppiumCommandExecutionHelper.cs:88

  • The HideKeyboard helper ignores the strategy parameter and uses keys instead of the expected keyName or key. Update to include both strategy and keyName according to the mobile:hideKeyboard spec.
parameters.Add("keys", new List<string>([key]));

@KazuCocoa KazuCocoa changed the title feat: use extension commands BREAKING CHANGE: feat: use extension commands May 25, 2025
@KazuCocoa KazuCocoa marked this pull request as ready for review May 25, 2025 06:01
@KazuCocoa KazuCocoa requested a review from Copilot May 25, 2025 06:23
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 PR introduces breaking changes by deprecating several legacy mobile commands and updating implementations to use extension commands (mobile: commands) across iOS, Android, and Windows drivers, while also cleaning up redundant whitespace and code. Key changes include:

  • Removal of deprecated methods such as ToggleAirplaneMode, ToggleData, ToggleWifi, GetConnectionType, EndTestCoverage, and dual overloads of HideKeyboard.
  • Updates in command execution helpers to use new mobile: endpoints (e.g. mobile:hideKeyboard, mobile:queryAppState, mobile:startActivity) and refactoring of related tests.
  • Adjustments in the .NET client API and README documentation to reflect these breaking changes.

Reviewed Changes

Copilot reviewed 34 out of 34 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
test/integration/Android/AppStringsTest.cs Changed language code from "en" to "ja" to verify localized string retrieval.
test/integration/Android/ActivityTest.cs Updated test method name and activity start implementation using mobile:startActivity with added wait logic.
src/Appium.Net/Appium/iOS/IOSDriver.cs Updated HideKeyboard signature (removing strategy), and switched clipboard commands to MobileSetClipboard/MobileGetClipboard; added GetAppState method.
src/Appium.Net/Appium/IOSCommandExecutionHelper.cs Revised mobile command implementations for shake, biometric, clipboard, and fingerprint commands.
src/Appium.Net/Appium/Windows/WindowsDriver.cs Updated HideKeyboard and app management commands to use ExecuteScript with mobile commands.
src/Appium.Net/Appium/AppiumDriverCommand.cs Removed legacy/deprecated command definitions.
Other interface and Android driver files Removed deprecated networking methods and updated activity/clipboard implementations.
README.md Updated documentation and migration table details for v8 breaking changes.
Comments suppressed due to low confidence (3)

test/integration/Android/ActivityTest.cs:55

  • [nitpick] Consider refactoring the hardcoded activity name ".ApiDemos" into a constant or configuration variable to improve maintainability.
wait.Until(drv => { return ((AndroidDriver) drv).CurrentActivity == ".ApiDemos"; });

src/Appium.Net/Appium/iOS/IOSDriver.cs:187

  • The removal of the strategy parameter in HideKeyboard is a breaking change; confirm that the interface and documentation are updated to reflect the new method signature.
public new void HideKeyboard(string key) =>

src/Appium.Net/Appium/AppiumDriver.cs:238

  • [nitpick] Ensure that passing 'null' as the sole argument in HideKeyboard properly triggers the default behavior after the breaking change in its signature.
=> AppiumCommandExecutionHelper.HideKeyboard(this, null);

@KazuCocoa KazuCocoa requested a review from Copilot May 25, 2025 06:50
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 PR introduces a breaking change that replaces numerous deprecated Appium endpoint methods with mobile extension commands, removes obsolete interface members and enums, and updates integration tests and documentation to match the new APIs.

  • Swap out legacy commands (e.g., ToggleWifi, StartActivity) for mobile:* extension commands across Android, iOS, and Windows drivers
  • Remove old interfaces, enums, and constants tied to deprecated methods
  • Revise integration tests and README to reflect the new mobile extension usage

Reviewed Changes

Copilot reviewed 34 out of 34 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
test/integration/Android/AppStringsTest.cs Changed test to retrieve Japanese app strings ("ja")
test/integration/Android/ActivityTest.cs Replaced multiple StartActivity tests with a single mobile:startActivity scenario
src/Appium.Net/Appium/iOS/IOSDriver.cs Added ShakeDevice, updated HideKeyboard, clipboard, and GetAppState methods
src/Appium.Net/Appium/iOS/IOSCommandExecutionHelper.cs Refactored to use ExecuteScript for shake, TouchID, clipboard, etc.
src/Appium.Net/Appium/iOS/Enums/HideKeyboardStrategy.cs Removed obsolete HideKeyboardStrategy enum file
src/Appium.Net/Appium/Windows/WindowsDriver.cs Switched HideKeyboard, CloseApp, and LaunchApp to extension calls
src/Appium.Net/Appium/Interfaces/INetworkActions.cs Stripped out deprecated network toggle methods
src/Appium.Net/Appium/Interfaces/IInteractsWithApps.cs Removed GetAppState from the interface
src/Appium.Net/Appium/Interfaces/IHidesKeyboard*.cs Normalized HideKeyboard overloads and removed strategy parameter
src/Appium.Net/Appium/AppiumDriverCommand.cs Deleted constants for removed commands
src/Appium.Net/Appium/AppiumDriver.cs Redirected built-in methods to mobile:* extension via ExecuteScript
src/Appium.Net/Appium/AppiumCommandExecutionHelper.cs Overhauled to consolidate mobile:pressKey, mobile:hideKeyboard, clipboard, performance, etc.
src/Appium.Net/Appium/AppiumCommand.cs Cleared out legacy AppiumCommand entries for removed endpoints
src/Appium.Net/Appium/Android/Interfaces/*.cs Removed old StartActivity, network-connection interfaces
src/Appium.Net/Appium/Android/AndroidDriver.cs Dropped legacy activity and network methods, added GetAppState
src/Appium.Net/Appium/Android/AndroidCommandExecutionHelper.cs Refactored all Android helper calls to mobile:* scripts
README.md Updated v8 section with removed methods and extension command links
Comments suppressed due to low confidence (5)

test/integration/Android/ActivityTest.cs:43

  • [nitpick] The test name CurrentActivityTest doesn’t reflect that it’s covering the mobile:startActivity behavior; consider renaming it to StartActivityTest or similar for clarity.
public void CurrentActivityTest()

README.md:42

  • The link URL is missing the 'r' in uiautomator2-driver; it currently points to uiautomator2-drive and will 404.
| `StartActivityWithIntent()`, `StartActivity()` | Use [mobile:startActivity](https://github.com/appium/appium-uiautomator2-drive#mobile-startactivity) to build an expected activity |

test/integration/Android/ActivityTest.cs:43

  • The previous tests for various StartActivity variants (waiting, new app, no close) were removed, leaving only the default case; consider adding tests for all variants to maintain coverage.
public void CurrentActivityTest()

src/Appium.Net/Appium/iOS/IOSDriver.cs:294

  • [nitpick] The parameter is named bundleId on iOS but appId in the Android variant; consider standardizing the parameter name for consistency across platforms.
public AppState GetAppState(string bundleId) =>

src/Appium.Net/Appium/AppiumDriver.cs:228

  • Previously, when no parameters were provided args was omitted; now an empty dictionary is always sent. This changes the RPC payload and may alter server behavior—consider omitting the args entry when parameters.Count == 0.
return Execute(DriverCommand.ExecuteScript, new Dictionary<string, object> {

Co-authored-by: Copilot <[email protected]>
@KazuCocoa KazuCocoa requested a review from Copilot May 25, 2025 06:57
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

A breaking-change update replacing legacy Appium commands with unified extension (mobile:) scripts, removing deprecated methods/interfaces, and updating tests to use the new patterns.

  • Remove legacy network, activity, keyboard, clipboard, and coverage methods/interfaces
  • Replace direct command calls with DriverCommand.ExecuteScript + mobile: scripts
  • Update integration tests and README to reflect the new extension-command usage

Reviewed Changes

Copilot reviewed 34 out of 34 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
test/integration/Android/AppStringsTest.cs Changed test language parameter from "en" to "ja" to align with updated usage
test/integration/Android/ActivityTest.cs Refactored tests to call mobile:startActivity and use WebDriverWait for assertions
src/Appium.Net/Appium/iOS/IOSDriver.cs Added new extension-method callers (e.g. ShakeDevice, GetAppState), adjusted HideKeyboard/clipboard methods
src/Appium.Net/Appium/iOS/IOSCommandExecutionHelper.cs Overhauled helper to use DriverCommand.ExecuteScript and mobile: scripts
src/Appium.Net/Appium/iOS/Enums/HideKeyboardStrategy.cs Removed deprecated strategy enum
src/Appium.Net/Appium/Windows/WindowsDriver.cs Updated HideKeyboard, CloseApp, LaunchApp to extension commands
src/Appium.Net/Appium/Interfaces/INetworkActions.cs Removed deprecated network toggles
src/Appium.Net/Appium/Interfaces/IInteractsWithApps.cs Removed GetAppState signature
src/Appium.Net/Appium/Interfaces/IHidesKeyboardWithKeyName.cs Dropped obsolete strategy parameter
src/Appium.Net/Appium/Interfaces/IHidesKeyboard.cs Removed old overload for hiding keyboard
src/Appium.Net/Appium/AppiumDriverCommand.cs Deleted constants for removed commands
src/Appium.Net/Appium/AppiumDriver.cs Replaced command implementations with ExecuteScript
src/Appium.Net/Appium/AppiumCommandExecutionHelper.cs Massive refactor to use mobile: extension commands
src/Appium.Net/Appium/AppiumCommand.cs Purged legacy HTTP endpoints in favor of mobile:
src/Appium.Net/Appium/Android/Interfaces/IStartsActivity.cs Removed legacy StartActivity methods
src/Appium.Net/Appium/Android/Interfaces/IHasNetworkConnection.cs Deleted network connection interface
src/Appium.Net/Appium/Android/AndroidDriver.cs Dropped old network/activity methods; added mobile: calls
src/Appium.Net/Appium/Android/AndroidCommandExecutionHelper.cs Refactored to extension scripts, removed deprecated code
README.md Documented v8 breaking changes and extension-command mappings
Comments suppressed due to low confidence (3)

src/Appium.Net/Appium/AppiumCommandExecutionHelper.cs:53

  • This call recursively invokes MobileSetClipboard, causing infinite recursion for URL clipboard content. Replace it with a direct executeMethod.Execute(DriverCommand.ExecuteScript, ...) invocation for the URL case.
AppiumCommandExecutionHelper.MobileSetClipboard(executeMethod,ClipboardContentType.Url, Convert.ToBase64String(base64UrlBytes));

src/Appium.Net/Appium/iOS/IOSDriver.cs:294

  • [nitpick] Indentation of this method is off by one space compared to surrounding methods. Align it with the class’s standard formatting.
         public AppState GetAppState(string bundleId) =>

src/Appium.Net/Appium/Android/AndroidDriver.cs:425

  • [nitpick] The key name here (appId) differs from the iOS helper (bundleId). Consider verifying that mobile:queryAppState expects appId on Android and maintain clear naming for cross-platform consistency.
["appId"] = appId

@KazuCocoa KazuCocoa requested a review from Dor-bl May 25, 2025 07:17
@KazuCocoa KazuCocoa changed the title BREAKING CHANGE: feat: use extension commands BREAKING CHANGE: feat: use extension commands for deprecated endpoints May 25, 2025
@Dor-bl Dor-bl changed the title BREAKING CHANGE: feat: use extension commands for deprecated endpoints BREAKING CHANGE: use extension commands for deprecated endpoints May 25, 2025
README.md Outdated
| `GetConnectionType()` | Get connection state with [mobile:getConnectivity](https://github.com/appium/appium-uiautomator2-driver#mobile-getconnectivity) |
| `EndTestCoverage()` | Already deprecated. |
| `StartActivityWithIntent()`, `StartActivity()` | Use [mobile:startActivity](https://github.com/appium/appium-uiautomator2-drive#mobile-startactivity) to start an expected activity |
| `strategy` argument in `HideKeyboard()` | It worked only deprecated [old ios driver](https://github.com/appium-boneyard/appium-ios-driver) |
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not sure I understand that part.

Copy link
Member Author

Choose a reason for hiding this comment

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

That was a removal which worked only for outdated appium-ios-driver. I'll exclude this from the table.

Copy link
Member Author

Choose a reason for hiding this comment

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

@KazuCocoa KazuCocoa requested review from Dor-bl and Copilot May 28, 2025 07:22
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 PR introduces breaking changes by deprecating legacy endpoint methods and replacing them with new extension commands, while also cleaning up extraneous whitespaces.

  • Deprecated methods such as ToggleAirplaneMode, ToggleData, ToggleWifi, GetConnectionType, EndTestCoverage, and StartActivityWithIntent/StartActivity have been removed.
  • The PR updates tests and driver implementations to use the new mobile: commands and adjusts documentation in the README accordingly.

Reviewed Changes

Copilot reviewed 34 out of 34 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
test/integration/Android/AppStringsTest.cs Updates language parameter used when getting app strings.
test/integration/Android/ActivityTest.cs Modifies test cases to use extension commands and updates the test method naming.
src/Appium.Net/Appium/iOS/IOSDriver.cs Removes the deprecated strategy parameter in HideKeyboard and adds new commands (e.g., ShakeDevice).
src/Appium.Net/Appium/AppiumDriver.cs Reworks BackgroundApp and HideKeyboard implementations to use mobile: commands.
src/Appium.Net/Appium/AppiumCommandExecutionHelper.cs Updates command methods to use ExecuteScript with mobile: commands and refines documentation.
README.md Updates documentation to indicate the removal of deprecated endpoints and details the new usage.

Copy link
Collaborator

@Dor-bl Dor-bl left a comment

Choose a reason for hiding this comment

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

Awesome work!

@KazuCocoa KazuCocoa merged commit d7e6af7 into main May 28, 2025
3 checks passed
@KazuCocoa KazuCocoa deleted the extention-commands branch May 28, 2025 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants