Search code examples
calabashcalabash-ios

calabash-ios consistently times out while attempting to connect to server on physical device


  • xcode installation location: /Applications/Xcode.app/Contents/Developer
  • xcode version: 6.0.1
  • calabash version: 0.11.0
  • calabash.framework version: 0.10.2
  • I do not have a firewall turned on
  • I have no problems running this on the simulator

Console output:

$ DEVICE_TARGET=xxxx DEVICE_ENDPOINT=192.168.2.2 BUNDLE_ID=xxxx CALABASH_FULL_CONSOLE_OUTPUT=1 DEBUG=1 MAX_CONNECT_RETRY=2  calabash-ios console
Running irb...
irb(main):001:0> start_test_server_in_background

INFO: Using uia strategy: 'preferences'
Sending 'QUIT' to instruments process '57313'
Waiting for instruments '57313' to terminate
Preparation took 1.071744 seconds
{
                    :app => "xxxx",
                   :args => [],
:bundle_dir_or_bundle_id => "xxxx",
              :bundle_id => "xxxx",
                 :device => "xxxx",
          :device_target => "xxxx",
          :launch_method => :instruments,
         :launch_retries => 5,
               :log_file => "/var/folders/gy/qpky9m857fxcvf_y35m30_s80000gp/T/run_loop20141006-57357-15h8el1/run_loop.out",
              :no_launch => false,
                :no_stop => false,
                  :reset => false,
            :results_dir => "/var/folders/gy/qpky9m857fxcvf_y35m30_s80000gp/T/run_loop20141006-57357-15h8el1",
      :results_dir_trace => "/var/folders/gy/qpky9m857fxcvf_y35m30_s80000gp/T/run_loop20141006-57357-15h8el1/trace",
                 :script => "/var/folders/gy/qpky9m857fxcvf_y35m30_s80000gp/T/run_loop20141006-57357-15h8el1/_run_loop.js",
            :sdk_version => nil,
                   :udid => "xxxx",
           :uia_strategy => :preferences,
                  :xcode => "6.0.1",
             :xcode_path => "/Applications/Xcode.app/Contents/Developer"
}

### Starting on xxxx App: xxxx ###
2014-10-06 16:56:06 +0100 xcrun instruments -w "xxxx" -D     "/var/folders/gy/qpky9m857fxcvf_y35m30_s80000gp/T/run_loop20141006-57357-15h8el1/trace" -t "Automation" "xxxx" -e UIARESULTSPATH /var/folders/gy/qpky9m857fxcvf_y35m30_s80000gp/T/run_loop20141006-57357-15h8el1 -e UIASCRIPT /var/folders/gy/qpky9m857fxcvf_y35m30_s80000gp/T/run_loop20141006-57357-15h8el1/_run_loop.js  &> /var/folders/gy/qpky9m857fxcvf_y35m30_s80000gp/T/run_loop20141006-57357-15h8el1/run_loop.out
Launching took 3.630218 seconds
Waiting for App to be ready
Timed out after 30 secs, trying to connect to Calabash server...
Will retry 1
Timed out after 30 secs, trying to connect to Calabash server...
Will retry 0
#<RuntimeError: Timed out connecting to Calabash server after 2 retries. Make sure it is  linked and App isn't crashing>
RuntimeError: Unable to make connection to Calabash Server at 192.168.2.2
Make sure you don't have a firewall blocking traffic to 192.168.2.2.

    from /Users/xxx/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/calabash-cucumber-0.11.0/lib/calabash-cucumber/launcher.rb:778:in `rescue in ensure_connectivity'
from /Users/xxx/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/calabash-cucumber-0.11.0/lib/calabash-cucumber/launcher.rb:740:in `ensure_connectivity'
from /Users/xxx/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/calabash-cucumber-0.11.0/lib/calabash-cucumber/launcher.rb:608:in `relaunch'
from /Users/xxx/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/calabash-cucumber-0.11.0/lib/calabash-cucumber/core.rb:838:in `start_test_server_in_background'
from (irb):1
from /Users/xxx/.rbenv/versions/2.0.0-p247/bin/irb:12:in `<main>'

What I see on the device:

  • The app boots up completely.

What I have tried:

  • Restarting machine and device multiple times
  • Trying device in multiple usb ports
  • Trying with xcode in various states (connected to device, not connected to device etc)
  • Connecting device to a private wifi hosted by my machine

All of the above give the same result.

As far as I can tell the ping_app method is not returning a 200 so that the status becomes connected=true. When I ping the app manually using a rest client over port 37265 I get http status of 405 returned.

Is there something I am missing on my machine/network set up that is preventing the ping_app method from giving the expected response?


Solution

  • The proper format is:

    DEVICE_ENDPOINT=http://192.168.2.2:37265
    

    You can test that the server is running using:

    $ curl http://192.168.2.2:37265/version