Skip to content

fix(android): send the gsmVoice and powerAc execute method names - #1320

Open
theluckystrike wants to merge 1 commit into
appium:masterfrom
theluckystrike:fix/python-client-a3
Open

theluckystrike wants to merge 1 commit into
appium:masterfrom
theluckystrike:fix/python-client-a3

Conversation

@theluckystrike

Copy link
Copy Markdown

set_gsm_voice and set_power_ac never reach the driver.

  • set_gsm_voice sends mobile: gmsVoice (letters transposed).
  • set_power_ac sends mobile: powerAC.

appium-android-driver registers mobile: gsmVoice and mobile: powerAc in its executeMethodMap (UiAutomator2 and Espresso inherit it), and BaseDriver.executeMethod looks the name up exactly. Both calls fail with UnknownMethodException and the emulator state doesn't change.

This PR fixes both names in appium/webdriver/extensions/android/gsm.py and power.py, asserts the script name in test_set_gsm_voice and corrects the expected name in test_set_power_ac.

Test runs

gsm_test.py + power_test.py with the extensions from master 4a4c46b
  2 failed, 3 passed
  AssertionError: assert 'mobile: gmsVoice' == 'mobile: gsmVoice'
  AssertionError: assert 'mobile: powerAC' == 'mobile: powerAc'
pytest test/unit on this branch      202 passed
ruff check, ruff format check, mypy  clean

End to end, the client against AndroidDriver.execute() from appium-android-driver 14.2.3 behind a local HTTP shim (adb stubbed, no emulator)

master  set_power_ac   UnknownMethodException Unsupported execute method 'mobile: powerAC', did you mean 'mobile: powerAc'?
        set_gsm_voice  UnknownMethodException Unsupported execute method 'mobile: gmsVoice', did you mean 'mobile: gsmVoice'?
branch  set_power_ac   OK, the driver calls adb.powerAC(off)
        set_gsm_voice  OK, the driver calls adb.gsmVoice(roaming)

I compared every mobile: name in appium/ with the execute method maps of appium-android-driver, appium-uiautomator2-driver and appium-xcuitest-driver. These two were the only mismatches. The uiautomator2 README still documents mobile: powerAC, while the driver itself only accepts powerAc.

set_gsm_voice sent `mobile: gmsVoice` (letters transposed) and
set_power_ac sent `mobile: powerAC`. appium-android-driver registers
`mobile: gsmVoice` and `mobile: powerAc` in its executeMethodMap, which
UiAutomator2 and Espresso inherit, and BaseDriver.executeMethod looks the
name up exactly. Both calls failed with UnknownMethodException and the
emulator state didn't change.

I fixed both names in appium/webdriver/extensions/android/gsm.py and
power.py (plus the powerAc docstring), asserted the script name in
test_set_gsm_voice and corrected the expected name in test_set_power_ac.

Tests I ran

    $ uv run python -m pytest test/unit/webdriver/device/gsm_test.py test/unit/webdriver/device/power_test.py   (extensions from master 4a4c46b)
    E       AssertionError: assert 'mobile: gmsVoice' == 'mobile: gsmVoice'
    E       AssertionError: assert 'mobile: powerAC' == 'mobile: powerAc'
    2 failed, 3 passed

    $ uv run python -m pytest test/unit   (this branch)
    202 passed
    $ uv run ruff check .          All checks passed
    $ uv run ruff format (check mode)   394 files already formatted
    $ uv run mypy appium           Success, no issues found in 320 source files

End to end, the client against AndroidDriver.execute() from
appium-android-driver 14.2.3 behind a local HTTP shim (adb stubbed, no
emulator)

    master  set_power_ac   UnknownMethodException Unsupported execute method 'mobile: powerAC', did you mean 'mobile: powerAc'?
            set_gsm_voice  UnknownMethodException Unsupported execute method 'mobile: gmsVoice', did you mean 'mobile: gsmVoice'?
    branch  set_power_ac   OK, driver calls adb.powerAC(off)
            set_gsm_voice  OK, driver calls adb.gsmVoice(roaming)

Not run against a real emulator.
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