11

It looks like Teamcity agent (TC version is 9.0 EAP) has issues with launching iOS Simulator via testing shell script.

I use Build Step: Command Line, which runs Custom Script and passes params to it. Teamcity agent is launched on Mac OS X Yosemite 10.10 from a shell script ../bin/mac.launchd.sh.

Error from Build Log:

[12:33:24][Step 2/2] 2014-11-20 11:33:25.421 xcodebuild[28083:289783]  iPhoneSimulator: Timed out waiting 120 seconds for simulator to boot, current state is 1.
[12:33:24][Step 2/2] 
[12:33:24][Step 2/2] Testing failed:
[12:33:24][Step 2/2] Test target app-tests encountered an error (Timed out waiting 120 seconds for simulator to boot, current state is 1. If you believe this error represents a bug, please attach the log file at /var/folders/sz/1lfcb1354xggcnd04_9j5kc40000gp/T/com.apple.dt.XCTest-status/Session-2014-11-20_11:31:25-P1Pjwd.log)
[12:33:24][Step 2/2] ** TEST FAILED **

Here is my shell script for testing:

xcodebuild \
    -sdk iphonesimulator8.1 \
    -destination "name=iPad Air,OS=8.1" \
    -configuration Debug \
    -project "$PROJECTPATH" \
    -scheme app-tests \
    CONFIGURATION_BUILD_DIR="$BUILDPATH" \
    clean test \
    | xcpretty -tc -r junit --output "$BUILDPATH/junit.xml"

I also tried solution from this question but it didn't help to fix the problem.

sig
  • 6,024
  • 2
  • 26
  • 31
  • When I am using **Build Step: Xcode Project** I receive the same error: `iPhoneSimulator: Could not launch simulator: -10810. Timed out waiting 120 seconds for simulator to boot, current state is 1. ** TEST FAILED **` – sig Nov 26 '14 at 11:32
  • I opened discussion on JetBrains Forum: https://devnet.jetbrains.com/message/5529292#5529292 – sig Nov 27 '14 at 11:10
  • 2
    My experience is that the agent **must** be started through a real desktop session (i.e. not via SSH, and I guess starting up via launchd could be similar to SSH). Otherwise, the interaction with the iOS Simulator won't work no matter what. – Leo Nov 27 '14 at 13:50

4 Answers4

0

This has been answered in the comments, and also here is a link to apple forums talking about it, AFAIK, its still the case that this isn't possible until apple changes it

https://devforums.apple.com/message/1040016#1040016

bolnad
  • 4,533
  • 3
  • 29
  • 41
0

In case someone still faces this error, you can set your desired timeout in the capabilities using simulatorStartupTimeout.

In java:

DesiredCapabilities caps = new DesiredCapabilities();
...
caps.setCapability("simulatorStartupTimeout", 5 * 60 * 1000); // 5mn
...

See https://github.com/appium/appium-xcuitest-driver#simulator

lezhumain
  • 387
  • 2
  • 8
0

For me restarting my Mac worked.

Samuel
  • 356
  • 2
  • 13
-2

It can happen that your custom scripts are taking too long to finish. I was able to replicate this issue by adding a custom script in build phase to sleep for 5000 seconds.

Tapan Thaker
  • 362
  • 5
  • 13
  • 1
    Did you get the exact same error message, that the simulator timed out while booting, `iPhoneSimulator: Timed out waiting 120 seconds for simulator to boot, current state is 1.` ? Or did you get a different timeout message? I'm getting the timeout error mentioned in the question and my tests don't take that long to run. – Roberto Feb 02 '16 at 07:56
  • Its not the tests that I am talking about, its custom scripts in build phases. – Tapan Thaker Feb 02 '16 at 18:25
  • I see. So when you added a build phase to run a script to sleep for 5000 your test was failing, even though the custom script is part of the build process and not of the test process? I'm having this issue on Jenkins, just for reference. – Roberto Feb 03 '16 at 10:05
  • Your test target has a dependency on app target. Thus when you run the tests the App is compiled first and once the app is launched the tests are executed. This can be one of the issues causing timeout. – Tapan Thaker Feb 05 '16 at 01:50
  • 1
    Maybe the new Xcode update (7.2.1) will fix the issue. In the update notes it says it fixes a command line tool issue: `"Command line tool 'xcodebuild test' will no longer time out waiting for Simulator.app to launch"` – Roberto Feb 06 '16 at 20:14