XCTest / Xcode UI Test - Simulator Error Causing Test Failures

testing
xcode
#1

Hello,

Starting on 10/20/17, did something change regarding the iOS simulators that are used for the Xcode Test step? All of my test jobs suddenly started failing with this error:

“Neither element nor any descendant has keyboard focus”

This error occurs when XCTest / simulator cannot access the keyboard when attempting to type some value into a text field element. Until now (for around 6 months or so). In order to prevent this from happening, you must go to (iOS Simulator menu) Hardware > Keyboard > then disable “Connect Hardware Keyboard”.

As this is a CI service , I was accomplishing this remotely by running a script before running the Xcode Test step:

defaults write com.apple.iphonesimulator ConnectHardwareKeyboard -bool false

This was working beautifully, but for some reason this is no longer accomplishing the desired effect. I honestly have no idea how other people have been getting around this without running this pre-test script, when using Xcode UI Tests.

Any expedient help would be really appreciated. Thanks a lot.

1 Like

#2

Hi @juliancmg,

Which stack?

In general, on Oct 20 nothing changed. We did roll out the usual weekly updates on 21st, you can find the details here: Weekly Virtual Machine / Stack updates - 2017.10.21

0 Likes

#3

Hi @viktorbenei, thanks for the reply, this is on the Xcode 9.0.x stack. It looks like Xcode was updated to 9.0.1 on this stack a couple of days ago? (From Apple release notes: Updated Simulator to use the iOS runtime used on iPhone X.) I will try updating locally to 9.0.1 to see if I can reproduce the issue I outlined above.

I’m trying the same workflow on the 9.1 stack to see if I get any different results.

Have you guys encountered anyone else running into issues with their iOS UI tests running properly?

0 Likes

#4

Not that I’m aware of, no.

Let us know how it goes! :slight_smile:

0 Likes

#5

Did you try it on the Xcode 9.1 final stack @juliancmg? Did that help?

0 Likes