fix(appium): replace deprecated setNetworkConnection/getNetworkConnection with mobile: setConnectivity/getConnectivity#5662
Open
mirao wants to merge 1 commit into
Conversation
…tion with mobile: setConnectivity/getConnectivity
WebdriverIO 9.27.2+ emits deprecation warnings for the legacy Android
network connection protocol commands. Appium's recommended replacement
is the mobile: setConnectivity / mobile: getConnectivity execute
commands.
grabNetworkConnection() keeps its original return shape
(value/inAirplaneMode/hasWifi/hasData) by re-encoding the new
{wifi, data, airplaneMode} response into the legacy bitmask, so
existing test code isn't broken.
Fixes codeceptjs#5619
Contributor
Author
|
The failed unit test in NodeJS 26.x (https://github.com/codeceptjs/CodeceptJS/actions/runs/29249150059/job/86813168615?pr=5662) doesn't seem to be related to my fix. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
getNetworkConnection/setNetworkConnectionprotocol calls inAppium.grabNetworkConnection()/Appium.setNetworkConnection()with the recommended Appiummobile: getConnectivity/mobile: setConnectivityexecute commands, removing the[WEBDRIVERIO DEPRECATION NOTICE]console warnings introduced by@wdio/protocols9.27.2+.grabNetworkConnection()keeps its original return shape (value/inAirplaneMode/hasWifi/hasData) by re-encoding the new{wifi, data, airplaneMode}response back into the legacy bitmask, so existing test code that inspects.valueisn't broken.appium-android-driversource (execute-method-map.ts,commands/network.ts).Known limitation
mobile: setConnectivity/mobile: getConnectivitywere added toappium-android-driverin April 2023. Users still running withappiumV2: false(Appium 1.x, unmaintained since 2022) will not have these commands available on the server side.Fixes #5619
Test plan
test/unit/helper/Appium_networkConnection_test.jscovering the bitmask encode/decode logic for both methods and the Android platform guardnpx mocha test/unit/helper/Appium_networkConnection_test.jspasses (8/8)npx prettier --check lib/helper/Appium.js test/unit/helper/Appium_networkConnection_test.jspassestest/helper/Appium_test.jscover this method but are not currently tagged@quick/@second, so they don't run in CI — pre-existing gap, unrelated to this change)