Summary
On a real Android device, a Maestro flow with eraseText fails under agent-device test --maestro:
Replay failed at step 27 (eraseText): Android text input requires provider-native text injection or the bundled test IME helper for non-ASCII/control characters; the adb-shell fallback supports ASCII text only. On emulators the test IME activates automatically; on real devices pass `open --test-ime` to enable it
The same flow passes on an emulator. ASCII inputText works on the device.
Cause
eraseText types backspace characters:
|
eraseText: async (input, context) => |
|
await typeTextAndSettle( |
|
'\b'.repeat( |
|
input.charactersToErase ?? MAESTRO_RUNTIME_ADAPTER_POLICY.eraseTextMaxCharacters, |
Backspace is a control character, so it needs the test IME. On real devices the test IME is opt-in through open --test-ime:
|
// Default-on for emulators, opt-in via --test-ime on real devices; --no-test-ime forces off. |
|
function shouldActivateAndroidTestIme(device: DeviceInfo, req: DaemonRequest): boolean { |
|
if (device.platform !== 'android') return false; |
|
const flag = req.flags?.testIme; |
|
if (flag !== undefined) return flag; |
|
return device.kind === 'emulator'; |
|
} |
test and replay have no such flag, so a flow run on a real device never gets the test IME.
What I tried
open --test-ime --session <name>, then test --session <name>: fails at launchApp with android device <serial> is owned by session "<name>"
- same with
replay --maestro --session <name>: same error
{"testIme": true} in a config file passed through AGENT_DEVICE_CONFIG: test still fails with the error above
adb shell ime set to the helper before test: still fails with the error above
Check with the test IME on
Local patch: shouldActivateAndroidTestIme returns true for real devices. With it, a flow with eraseText passes on the device, and the device keyboard is restored after the run.
Request
An opt-in for flow runs. The real-device default stays off, as decided in #1198. For example:
--test-ime on test and replay
- or
testIme from agent-device.json for flow runs
Environment
- agent-device 0.21.14. Same gating in 0.21.15 and on
main at 16e0757
- Pixel 8, Android 17, USB
- macOS host
Summary
On a real Android device, a Maestro flow with
eraseTextfails underagent-device test --maestro:The same flow passes on an emulator. ASCII
inputTextworks on the device.Cause
eraseTexttypes backspace characters:agent-device/packages/maestro/src/daemon-port/daemon-runtime-port.ts
Lines 262 to 265 in 16e0757
Backspace is a control character, so it needs the test IME. On real devices the test IME is opt-in through
open --test-ime:agent-device/src/daemon/session-lifecycle/internal/session-open-execution.ts
Lines 128 to 134 in 16e0757
testandreplayhave no such flag, so a flow run on a real device never gets the test IME.What I tried
open --test-ime --session <name>, thentest --session <name>: fails atlaunchAppwithandroid device <serial> is owned by session "<name>"replay --maestro --session <name>: same error{"testIme": true}in a config file passed throughAGENT_DEVICE_CONFIG:teststill fails with the error aboveadb shell ime setto the helper beforetest: still fails with the error aboveCheck with the test IME on
Local patch:
shouldActivateAndroidTestImereturnstruefor real devices. With it, a flow witheraseTextpasses on the device, and the device keyboard is restored after the run.Request
An opt-in for flow runs. The real-device default stays off, as decided in #1198. For example:
--test-imeontestandreplaytestImefromagent-device.jsonfor flow runsEnvironment
mainat 16e0757