Skip to content

iOS runner: keyboard dismiss and keyboard enter wait for the app to idle and can trip the 30 s watchdog #4453

Open

Description

@sittingmongoose

Problem

keyboard dismiss and keyboard enter tap a keyboard control with a plain XCUIElement.tap(). They do
not run inside withBoundedInteractionIdleTimeoutIfSupported, which type, swipe and taps use, so
XCTest waits for the app to idle with its own timeout.

If the app keeps animating, the tap holds the runner main thread past the 30 s watchdog:

  • the command fails with COMMAND_FAILED: main thread execution timed out;
  • the next commands get "The iOS runner is still finishing a previous command that exceeded its
    execution watchdog" until XCTest's wait ends, about a minute later.

Seen

  • agent-device 0.21.36, Xcode 27.3, iPhone Duo simulator (iOS 27.3), Safari in front.
  • It happened right after fold open and orientation portrait, on 1 of the 6 keyboard dismiss
    calls in that run.
  • Upstream main (2deb909) has the same code.

Runner log for the failing command (trimmed):

Find the "Done" Button
Tap "Done" Button
    Wait for com.apple.mobilesafari to idle
AGENT_DEVICE_RUNNER_MAIN_THREAD_WORK_ABANDONED operation=command_execution slice=30.0
AGENT_DEVICE_RUNNER_COMMAND_FAILED command=keyboardDismiss ... main thread execution timed out
AGENT_DEVICE_RUNNER_BUSY command=appState ... abandonedForSeconds=0.7

Minimal repro

  1. Use an app that starts a repeating UIView animation when a text field with a Done accessory takes
    focus.
  2. Focus the field.
  3. Run agent-device keyboard dismiss.

The tap sits in "Wait for to idle" until the animation stops. If the animation never stops, the
watchdog fires at 30 s. keyboard enter behaves the same way with the return key.

Required behavior

Both commands bound XCTest's idle waits the same way type does, so a busy app does not delay the tap.
This is the keyboard counterpart of the busy-app alert case in #2546.

Done when

A runner unit test against a busy host-app fixture shows the Done accessory and the return key landing
while the app is still busy, and the same test fails without the change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions