Skip to content

fix(appium): replace deprecated setNetworkConnection/getNetworkConnection with mobile: setConnectivity/getConnectivity#5662

Open
mirao wants to merge 1 commit into
codeceptjs:4.xfrom
mirao:fix/5619-appium-network-connection-deprecation
Open

fix(appium): replace deprecated setNetworkConnection/getNetworkConnection with mobile: setConnectivity/getConnectivity#5662
mirao wants to merge 1 commit into
codeceptjs:4.xfrom
mirao:fix/5619-appium-network-connection-deprecation

Conversation

@mirao

@mirao mirao commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Replaces the deprecated WebdriverIO getNetworkConnection/setNetworkConnection protocol calls in Appium.grabNetworkConnection()/Appium.setNetworkConnection() with the recommended Appium mobile: getConnectivity/mobile: setConnectivity execute commands, removing the [WEBDRIVERIO DEPRECATION NOTICE] console warnings introduced by @wdio/protocols 9.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 .value isn't broken.
  • Command names and parameter shapes were verified against the actual appium-android-driver source (execute-method-map.ts, commands/network.ts).

Known limitation

mobile: setConnectivity/mobile: getConnectivity were added to appium-android-driver in April 2023. Users still running with appiumV2: false (Appium 1.x, unmaintained since 2022) will not have these commands available on the server side.

Fixes #5619

Test plan

  • Added test/unit/helper/Appium_networkConnection_test.js covering the bitmask encode/decode logic for both methods and the Android platform guard
  • npx mocha test/unit/helper/Appium_networkConnection_test.js passes (8/8)
  • npx prettier --check lib/helper/Appium.js test/unit/helper/Appium_networkConnection_test.js passes
  • Real-device verification against Sauce Labs Android (existing tests in test/helper/Appium_test.js cover this method but are not currently tagged @quick/@second, so they don't run in CI — pre-existing gap, unrelated to this change)

…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
@mirao

mirao commented Jul 13, 2026

Copy link
Copy Markdown
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.

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.

Appium helper: setNetworkConnection / grabNetworkConnection trigger WebDriverIO deprecation warnings

1 participant