Josh Gafni
Josh Gafni

Reputation: 2881

Programmatically Set Xcode Simulator, Keyboard and Touch ID Settings, For UI Tests

My UI Tests fail with the iPhone simulator when its keyboard does not have the settings in the image below. Is it possible to programmatically set these settings in the setUp method of a UI test, or somewhere before the test is run? I would also like to do the same for the Touch ID enrollment settings.

I tried to see what code could be written by recording a UI test and then setting the keyboard, but unfortunately, simulator settings seem to be out of scope for the recording feature.

enter image description here

Upvotes: 3

Views: 1511

Answers (1)

charlyatwork
charlyatwork

Reputation: 1197

You can set the following parameters in a script before running your tests.

defaults write com.apple.iphonesimulator ConnectHardwareKeyboard 0

Run the UI Tests

#optional - reset it
defaults write com.apple.iphonesimulator ConnectHardwareKeyboard 1

Upvotes: 2

Related Questions