Skip to content

Commit 27197a7

Browse files
docs(ios): restore Simulator keyboard preference after tests
1 parent 90fcc5a commit 27197a7

1 file changed

Lines changed: 25 additions & 9 deletions

File tree

‎apple/runner/README.md‎

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,6 @@ 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-
4536
`AgentDeviceRunnerUITests/RunnerTests` is split into focused files to reduce context size for contributors and LLM agents.
4637

4738
- `RunnerTests.swift`: shared state/constants, `setUp()`, and `testCommand()` entry flow.
@@ -65,6 +56,31 @@ The Return test also asserts the keyboard visibility reported after submission.
6556
- `UnitTests/RunnerTests+<Source>Tests.swift`: the `AGENT_DEVICE_RUNNER_UNIT_TESTS` tests for each
6657
source file. The packaged runner source omits this directory.
6758

59+
### Busy keyboard regression tests
60+
61+
Run the two `testKeyboard*WhileTheAppIsBusy` tests with the simulator software keyboard enabled.
62+
Before you boot a throwaway simulator, save the current hardware-keyboard preference:
63+
64+
```sh
65+
keyboard_preference=$(defaults read com.apple.iphonesimulator ConnectHardwareKeyboard 2>/dev/null) || keyboard_preference=absent
66+
defaults write com.apple.iphonesimulator ConnectHardwareKeyboard -bool NO
67+
```
68+
69+
After the tests, restore the preference in the same shell, including when the tests fail.
70+
If the key was absent, delete it:
71+
72+
```sh
73+
if [ "$keyboard_preference" = absent ]; then
74+
defaults delete com.apple.iphonesimulator ConnectHardwareKeyboard
75+
else
76+
defaults write com.apple.iphonesimulator ConnectHardwareKeyboard -bool "$keyboard_preference"
77+
fi
78+
```
79+
80+
If the software keyboard does not appear, the tests fail instead of skipping.
81+
The tests assert command success and the fixture's `Done while busy` or `Return while busy` label.
82+
The Return test also asserts the keyboard visibility reported after submission.
83+
6884
## Snapshot Strategy
6985

7086
iOS snapshots have two explicit public capture modes:

0 commit comments

Comments
 (0)