Skip to content

Commit 6509d0d

Browse files
committed
perf(ios): early-exit text-entry readiness when the keyboard is visible
The XCUITest text-entry focus/readiness loops keyed their fast-exit on focusedTextInput(), which is intentionally hardcoded to return nil on iOS (focus predicates are stale there). As a result stabilizeTextInputBeforeTyping always burned its full focusTimeout (0.4s) and waitForTextEntryReadiness burned its full readinessTimeout (2.0s) in the normal case where the software keyboard appears — ~2.4s of dead wait before a single keystroke on every type/fill. The software keyboard becoming visible is the reliable iOS readiness signal, so both loops now return as soon as isKeyboardVisible() is true. The warmup-first-char echo check and post-type verify/repair remain as drop safety nets. Measured on iPhone 17 sim (Settings search field), median type time: 25 chars: 3342ms -> 1379ms (2.4x) 52 chars: 3969ms -> 2190ms 313 chars: 10.3s -> 8.6s (remainder is genuine per-char XCUITest typing) Reliability unchanged: 64/65 trials exact (incl. a 50-word lorem ipsum, verified by read-back + screenshot); the lone miss triggered the existing verify/repair.
1 parent 3cb126e commit 6509d0d

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

ios-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Interaction.swift

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,12 @@ extension RunnerTests {
416416
if let focused = focusedTextInput(app: app) {
417417
return focused
418418
}
419+
// focusedTextInput is intentionally nil on iOS, so the software keyboard becoming
420+
// visible is the reliable readiness signal. Exit as soon as it is up instead of
421+
// always burning the full focusTimeout.
422+
if isKeyboardVisible(app: app) {
423+
return latest
424+
}
419425
sleepFor(TextEntryTiming.pollInterval)
420426
}
421427
return latest
@@ -878,6 +884,13 @@ extension RunnerTests {
878884
return focused
879885
}
880886
}
887+
// The software keyboard being visible is the reliable readiness signal on iOS
888+
// (focusedTextInput is intentionally nil there). Once it is up the field is accepting
889+
// input, so return immediately rather than burning the full readinessTimeout — the
890+
// warmup-first-char echo check and post-type verify/repair remain as drop safety nets.
891+
if isKeyboardVisible(app: app) {
892+
return latest
893+
}
881894
sawSoftwareKeyboard = sawSoftwareKeyboard || keyboardElementExists(app: app)
882895
if !sawSoftwareKeyboard && Date() >= hardwareKeyboardFallback && latest != nil {
883896
return latest

0 commit comments

Comments
 (0)