尝试连接到物理设备上的服务器时,calabash-ios会一直超时

时间:2014-10-06 16:38:26

标签: calabash calabash-ios

  • xcode安装位置:/Applications/Xcode.app/Contents/Developer
  • xcode版本:6.0.1
  • calabash版本:0.11.0
  • calabash.framework版本:0.10.2
  • 我没有打开防火墙
  • 我在模拟器上运行它没有问题

控制台输出:

$ 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>'

我在设备上看到的内容:

  • 该应用程序完全启动。

我尝试过:

  • 多次重启机器和设备
  • 在多个USB端口中尝试设备
  • 尝试使用各种状态的xcode(连接到设备,未连接到设备等)
  • 将设备连接到我的机器托管的私人wifi

以上所有都给出了相同的结果。

据我所知,ping_app方法没有返回200,因此状态变为connected = true。当我使用端口37265上的rest客户端手动ping应用程序时,我得到了返回405的http状态。

我的机器/网络设置中是否存在一些阻止ping_app方法发出预期响应的内容?

4 个答案:

答案 0 :(得分:0)

您必须添加Calabash使用的端口号37265.还要确保您的设备和您的设备都在同一台路由器上并且没有防火墙。我使用Mac,所以我只需在我的机器上创建一个新网络并将其加入我的设备。希望这会有所帮助。

尝试查看此链接以确保您的设置正确无误。 https://github.com/calabash/calabash-ios#installation-details

答案 1 :(得分:0)

正确的格式是:

DEVICE_ENDPOINT=http://192.168.2.2:37265

您可以使用以下命令测试服务器是否正在运行:

$ curl http://192.168.2.2:37265/version

答案 2 :(得分:0)

要在真实设备上启动calabash iOs测试,您应该转到Settings--> Developer--> Enable UI Automation设置为ON

答案 3 :(得分:0)

一些有用的提示:

  • 设备端点:必须:37265(calabash服务器)

  • 如果您在iTunes中为设备命名:例如myPhone,您可以设置设备 端点= http://myPhone.local:37265。设备名称不能包含_或。的。

  • 确保您的Mac和设备位于同一个wifi上