Skip to content

Commit 1b4c2e7

Browse files
fix(ios): require busy keyboard coverage and settle Return
1 parent a6229c0 commit 1b4c2e7

3 files changed

Lines changed: 20 additions & 5 deletions

File tree

‎apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+CommandExecution.swift‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,7 @@ extension RunnerTests {
620620
)
621621
case .keyboardReturn:
622622
var press: (wasVisible: Bool, pressed: Bool, visible: Bool)?
623-
withBoundedInteractionIdleTimeoutIfSupported(activeApp, waits: .bothSkipped) {
623+
withBoundedInteractionIdleTimeoutIfSupported(activeApp, waits: .preEventSkipped) {
624624
press = pressKeyboardReturn(app: activeApp)
625625
}
626626
guard let result = press else {

‎apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/UnitTests/RunnerTests+KeyboardTests.swift‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,9 @@ extension RunnerTests {
342342
let response = try execute(command: command)
343343

344344
XCTAssertTrue(response.ok, String(describing: response.error))
345-
XCTAssertEqual(app.staticTexts["agent-device-keyboard-busy-answer"].label, "Done while busy")
345+
let answer = app.staticTexts["agent-device-keyboard-busy-answer"].label
346+
XCTAssertEqual(answer, "Done while busy")
347+
NSLog("AGENT_DEVICE_KEYBOARD_BUSY command=dismiss response.ok=%@ answer=%@", response.ok ? "true" : "false", answer)
346348
}
347349
}
348350

@@ -353,7 +355,11 @@ extension RunnerTests {
353355
let response = try execute(command: command)
354356

355357
XCTAssertTrue(response.ok, String(describing: response.error))
356-
XCTAssertEqual(app.staticTexts["agent-device-keyboard-busy-answer"].label, "Return while busy")
358+
XCTAssertEqual(response.data?.wasVisible, true)
359+
XCTAssertEqual(response.data?.visible, false)
360+
let answer = app.staticTexts["agent-device-keyboard-busy-answer"].label
361+
XCTAssertEqual(answer, "Return while busy")
362+
NSLog("AGENT_DEVICE_KEYBOARD_BUSY command=enter response.ok=%@ visible=%@ answer=%@", response.ok ? "true" : "false", String(describing: response.data?.visible), answer)
357363
}
358364
}
359365

@@ -376,9 +382,9 @@ extension RunnerTests {
376382
while !isKeyboardVisible(app: app) && Date() < keyboardDeadline {
377383
sleepFor(0.2)
378384
}
379-
try XCTSkipUnless(
385+
XCTAssertTrue(
380386
isKeyboardVisible(app: app),
381-
"software keyboard is down: this simulator cannot exercise a keyboard control"
387+
"Enable the simulator software keyboard before running the busy keyboard tests; see apple/runner/README.md"
382388
)
383389
XCTAssertEqual(app.staticTexts["agent-device-keyboard-busy-answer"].label, "Unanswered")
384390
try body()

‎apple/runner/README.md‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,15 @@ Protocol and maintenance references:
3333

3434
## UITest Runner File Map
3535

36+
### Busy keyboard regression tests
37+
38+
Run the two `testKeyboard*WhileTheAppIsBusy` tests with the simulator software keyboard enabled.
39+
Before you boot a throwaway simulator, run `defaults write com.apple.iphonesimulator ConnectHardwareKeyboard -bool NO`.
40+
Restore the previous preference after the run.
41+
If the software keyboard does not appear, the tests fail instead of skipping.
42+
The tests assert command success and the fixture's `Done while busy` or `Return while busy` label.
43+
The Return test also asserts the keyboard visibility reported after submission.
44+
3645
`AgentDeviceRunnerUITests/RunnerTests` is split into focused files to reduce context size for contributors and LLM agents.
3746

3847
- `RunnerTests.swift`: shared state/constants, `setUp()`, and `testCommand()` entry flow.

0 commit comments

Comments
 (0)