Search code examples
calabashcalabash-ios

How to tell Calabash to NOT timeout while the simulator... slowly... grinds into motion?


Context

I have a Mac Mini running Xcode, and a series of Cucumber tests ran with Calabash.

Issue

They fail because the simulator takes very long (possibly 50 seconds) to get up and running. I've tried to pass timeout launch options (by passing them in front of my call as per the documentation) but I'm still failing, and I haven't either understood yet how to use launch options in calabash-ios console mode.

I'm reading through the source in the hope of finding something not documented here.

I actually get no progress from this question:

calabash-ios console
> Running irb...
> irb(main):001:0> start_test_server_in_background(:timeout => 6000)
> RunLoop::Xcrun::TimeoutError: Xcrun timed out after 30.30 seconds executing
> xcrun instruments -s templates
> with a timeout of 30

Can I disable the launch timeout entirely, and how would I do that (save editing the calabash source...)?


Solution

  • It's not quite obvious, but there is a way. From xcrun.rb (which is actually in the run_loop gem),

    # You can override these values if they do not work in your environment.
    #
    # For cucumber users, the best place to override would be in your
    # features/support/env.rb.
    #
    # For example:
    #
    # RunLoop::Xcrun::DEFAULT_OPTIONS[:timeout] = 60
    

    Let me know if that doesn't work for you.

    As far as disabling it altogether, I think it's easier to just use a huge value for the timeout. Keep in mind though, the timeouts are there for a reason. If your simulator is actually stuck and unable to launch for some reason, it's reasonable to have some timeout to bail.