calabash / calabash-ios

Calabash for iOS
Other
1.81k stars 369 forks source link

Could not connect to DeviceAgent on real iOS device #1334

Closed cmdshepard closed 7 years ago

cmdshepard commented 7 years ago

xcode installation location /Applications/Xcode.app/Contents/Developer

xcode version 8.3.3

calabash version 0.21.1

calabash server

{
   "outcome":"SUCCESS",
   "ios_version":"10.3.3",
   "app_id":"ee.food.FleetFox",
   "app_name":"FleetFox",
   "app_base_sdk":"iphoneos10.3",
   "git":{
      "remote_origin":"git@github.com:calabash\/calabash-ios-server.git",
      "branch":"develop",
      "revision":"37d1c74"
   },
   "iOS_version":"10.3.3",
   "simulator_device":"",
   "version":"0.21.1",
   "server_port":37265,
   "model_identifier":"iPhone5,1",
   "form_factor":"iphone 4in",
   "app_version":"2.0",
   "simulator":"",
   "4inch":true,
   "iphone_app_emulated_on_ipad":false,
   "device_family":"iPhone",
   "screen_dimensions":{
      "scale":2,
      "width":640,
      "native_scale":2,
      "sample":1,
      "height":1136
   },
   "short_version_string":"2.0",
   "system":"iPhone5,1",
   "device_name":"TestIphone5"
}

I am using rbenv (ruby 2.3.1) I'm running the following command:

$ BUNDLE_ID=ee.food.FleetFox \
DEVICE_TARGET=xxxxxxxxxxxxxxxxxxxxxxxxxxxxx \
DEVICE_ENDPOINT=http://x.x.x.x:37265 \
bundle exec calabash-ios console

Getting this

Running irb...

#########################  Useful Methods  ##########################
     ids => List all the visible accessibility ids.
  labels => List all the visible accessibility labels.
    text => List all the visible texts.
   marks => List all the visible marks.
    tree => The app's visible view hierarchy.
   flash => flash(<query>); Disco effect for views matching <query>
 verbose => Turn debug logging on.
   quiet => Turn debug logging off.
    copy => Copy console commands to clipboard.
   clear => Clear the console.

Calabash says, "Take a deep breath."
calabash-ios 0.21.1> start_test_server_in_background
RuntimeError: 

Could not connect to the DeviceAgent service.

device: #<Device: TestIphone5 (10.3.3) 2927cc7166cea7400ada3509f6e75942af2aff83>
   url: http://10.0.11.164:27753/

To diagnose the problem tail the launcher log file:

$ tail -1000 -F /Users/mazahmadi/.calabash/iOSDeviceManager/logs/current.log

    from /Users/mazahmadi/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/run_loop-2.6.1/lib/run_loop/device_agent/client.rb:1389:in `rescue in launch_cbx_runner'
    from /Users/mazahmadi/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/run_loop-2.6.1/lib/run_loop/device_agent/client.rb:1380:in `launch_cbx_runner'
    from /Users/mazahmadi/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/run_loop-2.6.1/lib/run_loop/device_agent/client.rb:292:in `launch'
    from /Users/mazahmadi/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/run_loop-2.6.1/lib/run_loop/device_agent/client.rb:167:in `run'
    from /Users/mazahmadi/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/run_loop-2.6.1/lib/run_loop.rb:113:in `run'
    from /Users/mazahmadi/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/calabash-cucumber-0.21.1/lib/calabash-cucumber/launcher.rb:414:in `block in new_run_loop'
    from /Users/mazahmadi/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/calabash-cucumber-0.21.1/lib/calabash-cucumber/launcher.rb:412:in `times'
    from /Users/mazahmadi/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/calabash-cucumber-0.21.1/lib/calabash-cucumber/launcher.rb:412:in `new_run_loop'
    from /Users/mazahmadi/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/calabash-cucumber-0.21.1/lib/calabash-cucumber/launcher.rb:365:in `relaunch'
    from /Users/mazahmadi/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/calabash-cucumber-0.21.1/lib/calabash-cucumber/core.rb:1567:in `start_test_server_in_background'
    from (irb):1
    from /Users/mazahmadi/.rbenv/versions/2.3.1/bin/irb:11:in `<main>'

The device and my computer are on the same wifi network. I can access http://device_ip:37265/version from my browser.

cmdshepard commented 7 years ago

current.log output


2017-09-25 15:33:03.114 DEBUG FBControlCoreLogger:279 | Attempting to load: /Applications/Xcode.app/Contents/Frameworks/libswiftCore.dylib
2017-09-25 15:33:03.114 DEBUG FBControlCoreLogger:279 | Loaded libswiftCore.dylib
2017-09-25 15:33:03.115 DEBUG FBControlCoreLogger:279 | Attempting to load: /Applications/Xcode.app/Contents/Frameworks/libswiftDarwin.dylib
2017-09-25 15:33:03.115 DEBUG FBControlCoreLogger:279 | Loaded libswiftDarwin.dylib
2017-09-25 15:33:03.116 DEBUG FBControlCoreLogger:279 | Attempting to load: /Applications/Xcode.app/Contents/Frameworks/libswiftObjectiveC.dylib
2017-09-25 15:33:03.116 DEBUG FBControlCoreLogger:279 | Loaded libswiftObjectiveC.dylib
2017-09-25 15:33:03.117 DEBUG FBControlCoreLogger:279 | Attempting to load: /Applications/Xcode.app/Contents/Frameworks/libswiftDispatch.dylib
2017-09-25 15:33:03.117 DEBUG FBControlCoreLogger:279 | Loaded libswiftDispatch.dylib
2017-09-25 15:33:03.118 DEBUG FBControlCoreLogger:279 | Attempting to load: /Applications/Xcode.app/Contents/Frameworks/libswiftIOKit.dylib
2017-09-25 15:33:03.118 DEBUG FBControlCoreLogger:279 | Loaded libswiftIOKit.dylib
2017-09-25 15:33:03.118 DEBUG FBControlCoreLogger:279 | Attempting to load: /Applications/Xcode.app/Contents/Frameworks/libswiftCoreGraphics.dylib
2017-09-25 15:33:03.118 DEBUG FBControlCoreLogger:279 | Loaded libswiftCoreGraphics.dylib
2017-09-25 15:33:03.120 DEBUG FBControlCoreLogger:279 | Attempting to load: /Applications/Xcode.app/Contents/Frameworks/libswiftFoundation.dylib
2017-09-25 15:33:03.120 DEBUG FBControlCoreLogger:279 | Loaded libswiftFoundation.dylib
2017-09-25 15:33:03.120 DEBUG FBControlCoreLogger:279 | Attempting to load: /Applications/Xcode.app/Contents/Frameworks/libswiftXPC.dylib
2017-09-25 15:33:03.120 DEBUG FBControlCoreLogger:279 | Loaded libswiftXPC.dylib
2017-09-25 15:33:03.121 DEBUG FBControlCoreLogger:279 | Attempting to load: /Applications/Xcode.app/Contents/Frameworks/libswiftCoreImage.dylib
2017-09-25 15:33:03.121 DEBUG FBControlCoreLogger:279 | Loaded libswiftCoreImage.dylib
2017-09-25 15:33:03.122 DEBUG FBControlCoreLogger:279 | Attempting to load: /Applications/Xcode.app/Contents/Frameworks/libswiftQuartzCore.dylib
2017-09-25 15:33:03.122 DEBUG FBControlCoreLogger:279 | Loaded libswiftQuartzCore.dylib
2017-09-25 15:33:03.122 DEBUG FBControlCoreLogger:279 | Attempting to load: /Applications/Xcode.app/Contents/Frameworks/libswiftCoreData.dylib
2017-09-25 15:33:03.122 DEBUG FBControlCoreLogger:279 | Loaded libswiftCoreData.dylib
2017-09-25 15:33:03.123 DEBUG FBControlCoreLogger:279 | Attempting to load: /Applications/Xcode.app/Contents/Frameworks/libswiftAppKit.dylib
2017-09-25 15:33:03.123 DEBUG FBControlCoreLogger:279 | Loaded libswiftAppKit.dylib
2017-09-25 15:33:03.124 DEBUG FBControlCoreLogger:279 | MobileDevice: Loading from /System/Library/PrivateFrameworks/MobileDevice.framework 
2017-09-25 15:33:03.127 DEBUG FBControlCoreLogger:279 | MobileDevice: Successfully loaded
2017-09-25 15:33:03.127 DEBUG FBControlCoreLogger:279 | Loaded All Private Frameworks [MobileDevice]
2017-09-25 15:33:03.465 DEBUG FBControlCoreLogger:279 | DTXConnectionServices: Loading from /Applications/Xcode.app/Contents/SharedFrameworks/DTXConnectionServices.framework 
2017-09-25 15:33:03.467 DEBUG FBControlCoreLogger:279 | DTXConnectionServices: Successfully loaded
2017-09-25 15:33:03.468 DEBUG FBControlCoreLogger:279 | DTXConnectionServices: DTXConnection has correct path of /Applications/Xcode.app
2017-09-25 15:33:03.468 DEBUG FBControlCoreLogger:279 | DTXConnectionServices: DTXRemoteInvocationReceipt has correct path of /Applications/Xcode.app
2017-09-25 15:33:03.468 DEBUG FBControlCoreLogger:279 | IDEFoundation: Loading from /Applications/Xcode.app/Contents/Frameworks/IDEFoundation.framework 
2017-09-25 15:33:03.528 DEBUG FBControlCoreLogger:279 | IDEFoundation: Successfully loaded
2017-09-25 15:33:03.528 DEBUG FBControlCoreLogger:279 | IDEFoundation: IDEFoundationTestInitializer has correct path of /Applications/Xcode.app
2017-09-25 15:33:03.528 DEBUG FBControlCoreLogger:279 | DevToolsFoundation: Loading from /Applications/Xcode.app/Contents/PlugIns/Xcode3Core.ideplugin/Contents/Frameworks/DevToolsFoundation.framework 
2017-09-25 15:33:03.530 DEBUG FBControlCoreLogger:279 | DevToolsFoundation: Successfully loaded
2017-09-25 15:33:03.530 DEBUG FBControlCoreLogger:279 | DevToolsSupport: Loading from /Applications/Xcode.app/Contents/PlugIns/Xcode3Core.ideplugin/Contents/Frameworks/DevToolsSupport.framework 
2017-09-25 15:33:03.532 DEBUG FBControlCoreLogger:279 | DevToolsSupport: Successfully loaded
2017-09-25 15:33:03.532 DEBUG FBControlCoreLogger:279 | DevToolsCore: Loading from /Applications/Xcode.app/Contents/PlugIns/Xcode3Core.ideplugin/Contents/Frameworks/DevToolsCore.framework 
2017-09-25 15:33:03.538 DEBUG FBControlCoreLogger:279 | DevToolsCore: Successfully loaded
2017-09-25 15:33:03.539 DEBUG FBControlCoreLogger:279 | IDEiOSSupportCore: Loading from /Applications/Xcode.app/Contents/PlugIns/IDEiOSSupportCore.ideplugin 
2017-09-25 15:33:03.547 DEBUG FBControlCoreLogger:279 | IDEiOSSupportCore: Successfully loaded
2017-09-25 15:33:03.549 DEBUG FBControlCoreLogger:279 | IDEiOSSupportCore: DVTiPhoneSimulator has correct path of /Applications/Xcode.app
2017-09-25 15:33:03.549 DEBUG FBControlCoreLogger:279 | IBAutolayoutFoundation: Loading from /Applications/Xcode.app/Contents/Frameworks/IBAutolayoutFoundation.framework 
2017-09-25 15:33:03.551 DEBUG FBControlCoreLogger:279 | IBAutolayoutFoundation: Bundle could not be loaded from /Applications/Xcode.app/Contents/Frameworks/IBAutolayoutFoundation.framework, attempting to find the Framework name
2017-09-25 15:33:03.551 DEBUG FBControlCoreLogger:279 | Attempting to load missing framework IBFoundation.framework
2017-09-25 15:33:03.551 DEBUG FBControlCoreLogger:279 | IBFoundation: Loading from /Applications/Xcode.app/Contents/Frameworks/IBFoundation.framework 
2017-09-25 15:33:03.560 DEBUG FBControlCoreLogger:279 | IBFoundation: Successfully loaded
2017-09-25 15:33:03.561 DEBUG FBControlCoreLogger:279 | IBFoundation.framework has been loaded from fallback directory '/Applications/Xcode.app/Contents/Developer/../Frameworks', re-attempting to load IBAutolayoutFoundation
2017-09-25 15:33:03.563 DEBUG FBControlCoreLogger:279 | IBAutolayoutFoundation: Successfully loaded
2017-09-25 15:33:03.563 DEBUG FBControlCoreLogger:279 | IDEKit: Loading from /Applications/Xcode.app/Contents/Frameworks/IDEKit.framework 
2017-09-25 15:33:03.566 DEBUG FBControlCoreLogger:279 | IDEKit: Bundle could not be loaded from /Applications/Xcode.app/Contents/Frameworks/IDEKit.framework, attempting to find the Framework name
2017-09-25 15:33:03.566 DEBUG FBControlCoreLogger:279 | Attempting to load missing framework DVTProducts.framework
2017-09-25 15:33:03.567 DEBUG FBControlCoreLogger:279 | DVTProducts.framework could not be loaded from fallback directory /Applications/Xcode.app/Contents/Developer/../Frameworks
2017-09-25 15:33:03.567 DEBUG FBControlCoreLogger:279 | DVTProducts: Loading from /Applications/Xcode.app/Contents/SharedFrameworks/DVTProducts.framework 
2017-09-25 15:33:03.568 DEBUG FBControlCoreLogger:279 | DVTProducts: Successfully loaded
2017-09-25 15:33:03.568 DEBUG FBControlCoreLogger:279 | DVTProducts.framework has been loaded from fallback directory '/Applications/Xcode.app/Contents/Developer/../SharedFrameworks', re-attempting to load IDEKit
2017-09-25 15:33:03.570 DEBUG FBControlCoreLogger:279 | IDEKit: Bundle could not be loaded from /Applications/Xcode.app/Contents/Frameworks/IDEKit.framework, attempting to find the Framework name
2017-09-25 15:33:03.570 DEBUG FBControlCoreLogger:279 | Attempting to load missing framework DADocSetManagement.framework
2017-09-25 15:33:03.570 DEBUG FBControlCoreLogger:279 | DADocSetManagement.framework could not be loaded from fallback directory /Applications/Xcode.app/Contents/Developer/../Frameworks
2017-09-25 15:33:03.570 DEBUG FBControlCoreLogger:279 | DADocSetManagement: Loading from /Applications/Xcode.app/Contents/SharedFrameworks/DADocSetManagement.framework 
2017-09-25 15:33:03.571 DEBUG FBControlCoreLogger:279 | DADocSetManagement: Bundle could not be loaded from /Applications/Xcode.app/Contents/SharedFrameworks/DADocSetManagement.framework, attempting to find the Framework name
2017-09-25 15:33:03.571 DEBUG FBControlCoreLogger:279 | Attempting to load missing framework DADocSetAccess.framework
2017-09-25 15:33:03.571 DEBUG FBControlCoreLogger:279 | DADocSetAccess.framework could not be loaded from fallback directory /Applications/Xcode.app/Contents/Developer/../Frameworks
2017-09-25 15:33:03.571 DEBUG FBControlCoreLogger:279 | DADocSetAccess: Loading from /Applications/Xcode.app/Contents/SharedFrameworks/DADocSetAccess.framework 
2017-09-25 15:33:03.575 DEBUG FBControlCoreLogger:279 | DADocSetAccess: Successfully loaded
2017-09-25 15:33:03.575 DEBUG FBControlCoreLogger:279 | DADocSetAccess.framework has been loaded from fallback directory '/Applications/Xcode.app/Contents/Developer/../SharedFrameworks', re-attempting to load DADocSetManagement
2017-09-25 15:33:03.576 DEBUG FBControlCoreLogger:279 | DADocSetManagement: Successfully loaded
2017-09-25 15:33:03.576 DEBUG FBControlCoreLogger:279 | DADocSetManagement.framework has been loaded from fallback directory '/Applications/Xcode.app/Contents/Developer/../SharedFrameworks', re-attempting to load IDEKit
2017-09-25 15:33:03.578 DEBUG FBControlCoreLogger:279 | IDEKit: Bundle could not be loaded from /Applications/Xcode.app/Contents/Frameworks/IDEKit.framework, attempting to find the Framework name
2017-09-25 15:33:03.578 DEBUG FBControlCoreLogger:279 | Attempting to load missing framework DVTDeveloperModeHelper.framework
2017-09-25 15:33:03.578 DEBUG FBControlCoreLogger:279 | DVTDeveloperModeHelper.framework could not be loaded from fallback directory /Applications/Xcode.app/Contents/Developer/../Frameworks
2017-09-25 15:33:03.578 DEBUG FBControlCoreLogger:279 | DVTDeveloperModeHelper: Loading from /Applications/Xcode.app/Contents/SharedFrameworks/DVTDeveloperModeHelper.framework 
2017-09-25 15:33:03.579 DEBUG FBControlCoreLogger:279 | DVTDeveloperModeHelper: Successfully loaded
2017-09-25 15:33:03.579 DEBUG FBControlCoreLogger:279 | DVTDeveloperModeHelper.framework has been loaded from fallback directory '/Applications/Xcode.app/Contents/Developer/../SharedFrameworks', re-attempting to load IDEKit
2017-09-25 15:33:03.581 DEBUG FBControlCoreLogger:279 | IDEKit: Bundle could not be loaded from /Applications/Xcode.app/Contents/Frameworks/IDEKit.framework, attempting to find the Framework name
2017-09-25 15:33:03.581 DEBUG FBControlCoreLogger:279 | Attempting to load missing framework DTGraphKit.framework
2017-09-25 15:33:03.581 DEBUG FBControlCoreLogger:279 | DTGraphKit.framework could not be loaded from fallback directory /Applications/Xcode.app/Contents/Developer/../Frameworks
2017-09-25 15:33:03.581 DEBUG FBControlCoreLogger:279 | DTGraphKit: Loading from /Applications/Xcode.app/Contents/SharedFrameworks/DTGraphKit.framework 
2017-09-25 15:33:03.584 DEBUG FBControlCoreLogger:279 | DTGraphKit: Successfully loaded
2017-09-25 15:33:03.584 DEBUG FBControlCoreLogger:279 | DTGraphKit.framework has been loaded from fallback directory '/Applications/Xcode.app/Contents/Developer/../SharedFrameworks', re-attempting to load IDEKit
2017-09-25 15:33:03.598 DEBUG FBControlCoreLogger:279 | IDEKit: Successfully loaded
2017-09-25 15:33:03.598 DEBUG FBControlCoreLogger:279 | IDESourceEditor: Loading from /Applications/Xcode.app/Contents/PlugIns/IDESourceEditor.ideplugin 
2017-09-25 15:33:03.602 DEBUG FBControlCoreLogger:279 | IDESourceEditor: Successfully loaded
2017-09-25 15:33:03.602 DEBUG FBControlCoreLogger:279 | DFRSupportKit: Loading from /Applications/Xcode.app/Contents/Frameworks/DFRSupportKit.framework 
2017-09-25 15:33:03.603 DEBUG FBControlCoreLogger:279 | DFRSupportKit: Successfully loaded
2017-09-25 15:33:03.603 DEBUG FBControlCoreLogger:279 | DVTKit: Loading from /Applications/Xcode.app/Contents/SharedFrameworks/DVTKit.framework 
2017-09-25 15:33:03.603 DEBUG FBControlCoreLogger:279 | DVTKit: Successfully loaded
2017-09-25 15:33:03.604 DEBUG FBControlCoreLogger:279 | Loaded All Private Frameworks [DTXConnectionServices, IDEFoundation, IDEiOSSupportCore, IBAutolayoutFoundation, IDEKit, IDESourceEditor, DFRSupportKit, DVTKit]
2017-09-25 15:33:09.225 INFO ShellRunner:70 | EXEC: /usr/bin/xcrun codesign -d --entitlements :- /Users/mazahmadi/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/run_loop-2.6.1/lib/run_loop/device_agent/ipa/DeviceAgent-Runner.app
jmoody commented 7 years ago

Just back from vacation.

It looks like code signing the DeviceAgent is failing

# What is the output of:
$ /usr/bin/xcrun codesign -d --entitlements :- /Users/mazahmadi/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/run_loop-2.6.1/lib/run_loop/device_agent/ipa/DeviceAgent-Runner.app
asalvo commented 7 years ago

I had a similar problem where the signing of the DeviceAgent was failing. I narrowed it down to my login-keychain, where my certs are stored, was not unlocked. I had already made sure the access control on the private keys for the certs were set to allow all processes to access them, so you may want to check that as well.