Repository navigation
feat!: remove the deprecated APIs - #2467
mykola-mokhnach wants to merge 6 commits into
Conversation
BREAKING CHANGE: io.appium.java_client.functions.AppiumFunction is removed. Use java.util.function.Function instead. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The events of a failed upload have no success field, so the null Boolean cast threw and the error was wrapped into a generic exception with the raw payload as its message. Check it null-safely so that the error sent by the server is decoded. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
DesktopBrowserCompatibilityTest and TimeoutTest use the stub driver instead of headless Chrome, and TimeoutTest now asserts a lower bound of the waiting time and runs in 1.5s instead of about 12s. StorageTest runs against a fake of the storage plugin of the Appium server rather than a server at 127.0.0.1:4723, so it is not skipped on CI anymore. The selenium-chrome-driver and webdrivermanager dependencies of the unit test suite are removed, along with the deprecated timeout overloads of the stub driver. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The drivers call the `mobile:` extensions only, as the legacy endpoints were removed in Appium 3 or have extension replacements in the UiAutomator2, XCUITest and Windows drivers. The extension presence tracking served the fallbacks only, so it is removed as well. WindowsDriver keeps the driver-level file transfer commands, because the Windows driver has no extensions for them, and uses the `windows:` extensions to launch and close the app. The power AC extension is requested under its actual name, `mobile: powerAc`, so it is not routed to the removed endpoint anymore. BREAKING CHANGE: AndroidMobileCommandHelper, IOSMobileCommandHelper, CanRememberExtensionPresence and the deprecated MobileCommand constants and helper methods are removed. Android and iOS drivers require a server and drivers that support the corresponding `mobile:` extensions. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
KazuCocoa
left a comment
There was a problem hiding this comment.
Reviewed the changes and the replacement command contracts. The unit-test build passes (194 root-project tests, zero failures), but the Function migration introduces the Android test regression noted inline. The Android device tests were not run.
| public class AndroidFunctionTest extends BaseAndroidTest { | ||
|
|
||
| private final AppiumFunction<WebDriver, List<WebElement>> searchingFunction = input -> { | ||
| private final Function<WebDriver, List<WebElement>> searchingFunction = input -> { |
There was a problem hiding this comment.
[P2] Preserve null short-circuiting when migrating the wait functions
AppiumFunction.compose and andThen skipped the next function when the previous result was null; java.util.function.Function passes that null onward. Consequently, both nullPointerExceptionSafetyTestWithPrecondition and nullPointerExceptionSafetyTestWithPostConditions now fail: Fake_context makes contextFunction return null, searchingFunction dereferences it here, and FluentWait propagates NullPointerException instead of the asserted TimeoutException. The normal wait tests can also hit this while the webview is unavailable. Please make these compositions explicitly null-safe (or revise the tests if that behavior is intentionally being removed). This class is excluded from the default Android suite, so compilation and the passing unit tests do not catch it.
There was a problem hiding this comment.
Confirmed on an emulator. Both nullPointerExceptionSafety tests fail on this branch with NullPointerException and pass on master. The two complexWaiting tests also failed with the same NPE on the first poll.
There was a problem hiding this comment.
Agreed, and thanks for running it on the emulator. We are removing AppiumFunction on purpose, so I kept the Function semantics. The test steps handle null explicitly now (b7ab4e8), and the breaking-change note says that compose/andThen pass null on, so chains that relied on the old short-circuit have to check for it.
| @FunctionalInterface | ||
| public interface AppiumFunction<F, T> extends java.util.function.Function<F, T> { | ||
|
|
||
| @Override default <V> AppiumFunction<V, T> compose(java.util.function.Function<? super V, ? extends F> before) { |
There was a problem hiding this comment.
AppiumFunction.compose and andThen skip the next step when the previous one returns null. java.util.function.Function does not. Inside a FluentWait, null means keep polling. So chained waits used to retry and now throw NullPointerException on the first null.
The breaking change note says to use java.util.function.Function instead. That reads like a drop-in swap, but it is not one for code that chains compose or andThen.
There was a problem hiding this comment.
Agreed, and thanks for running it on the emulator. We are removing AppiumFunction on purpose, so I kept the Function semantics. The test steps handle null explicitly now (b7ab4e8), and the breaking-change note says that compose/andThen pass null on, so chains that relied on the old short-circuit have to check for it.
Function#compose and Function#andThen pass null on, unlike the removed AppiumFunction, which skipped the next step. FluentWait treats null as "keep polling", so the steps have to handle a null input themselves. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Summary
Removes the APIs that were deprecated in v10 and makes the page factory and storage tests independent of real servers.
The legacy commands were kept only as fallbacks for servers without the
mobile:extensions. Appium 3 removed most of thelegacy endpoints, and the UiAutomator2, XCUITest and Windows drivers have the
mobile:/windows:replacements(checked against Appium 3.8, UiAutomator2 8.7.0/9.0.0-beta.1, XCUITest 12.15.0/13.0.0-beta.1 and Windows 6.2.0).
Breaking changes
The footers for the squashed commit:
Not breaking
WindowsDriveroverridespullFile,pullFolderandpushFileto keep sending the driver-level commands, because the Windowsdriver has no extensions for them. The requests are the same as before.
START_RECORDING_SCREEN,STOP_RECORDING_SCREENandSET_SETTINGSare not deprecated anymore: the drivers still serve them and theyhave no replacements.
GET_SESSIONandGET_ALLSESSIONstay deprecated.setPowerACrequestedmobile: powerAC, but the driver registersmobile: powerAc, so it always used the legacy route. It uses theextension now.
StorageClient#addreports the error that the server sends for a failed upload instead of a generic exception that wraps aNullPointerException.TimeoutTest,DesktopBrowserCompatibilityTest) use the stub driver instead of headless Chrome, andTimeoutTesttakes 1.5s instead of about 12s.StorageTestruns against a fake of the storage plugin instead of a server at127.0.0.1:4723, so it is not skipped on CI anymore. Theselenium-chrome-driverandwebdrivermanagerdependencies of the unittest suite are removed.
Not covered
GET_LOCATIONandSET_LOCATION(/location, used bySupportsLocation) are not deprecated, but Appium 4 removes the route.They need a
mobile:path (getGeolocation/setGeolocationon Android,getSimulatedLocation/setSimulatedLocationon iOSsimulators) in a follow-up.
Verification
commands.jsongolden changes by removing the commands only.ExtensionCommandsOverHttpTestcoversmobile: powerAcand the Windows file, launch and close commands over a real HTTP server.🤖 Generated with Claude Code