Closed SergiyBeno closed 7 years ago
+1 have the same issue
+1 for me too.
Terminal Output:
/Users/someuser/.rvm/gems/ruby-2.4.0/gems/edn-1.1.1/lib/edn/core_ext.rb:97: warning: constant ::Bignum is deprecated
Using the default, simulator and common profiles...
@keyboard
Feature: Typing on the Keyboard
In order to enter text like a user
As an app tester
I want Calabash to provide a Keyboard API
Background: Navigate to the controls tab # features/keyboard.feature:7
Could not connect to the DeviceAgent service.
device: #<Simulator: iPhone 7 (10.3) 159E9C46-D20B-415C-89D2-79447298F679 x86_64>
url: http://127.0.0.1:27753/
To diagnose the problem tail the launcher log file:
$ tail -1000 -F /Users/kutran/.calabash/iOSDeviceManager/logs/current.log
(RuntimeError)
./features/support/01_launch.rb:19:in `launch'
./features/support/01_launch.rb:279:in `Before'
Given I see the controls tab # features/step_definitions/shared_steps.rb:1
@travis
Scenario: I should be able to type something # features/keyboard.feature:11
Then I type "Hello" # features/step_definitions/keyboard_steps.rb:9
And the first responder text is "Hello" # features/step_definitions/keyboard_steps.rb:30
And I dismiss the keyboard by tapping the keyboard action key # features/step_definitions/keyboard_steps.rb:19
Version:
{"device_family":"iPhone","outcome":"SUCCESS","server_port":37265,"simulator_device":"","simulator":"CoreSimulator 375.20 - Device: iPhone 7 - Runtime: iOS 10.3 (14E269) - DeviceType: iPhone 7","app_name":"CalSmoke-cal","app_version":"0.20.4","screen_dimensions":{"native_scale":2,"sample":1,"height":1334,"width":750,"scale":2},"git":{"revision":"dc15597","remote_origin":"git@github.com:calabash\/calabash-ios-server.git","branch":"master"},"device_name":"computer","4inch":false,"app_id":"sh.calaba.CalSmoke-cal","form_factor":"iphone 6","system":"x86_64","version":"0.20.4","iOS_version":"10.3","short_version_string":"0.20.4","ios_version":"10.3","iphone_app_emulated_on_ipad":false,"model_identifier":"iPhone9,1","app_base_sdk":"iphonesimulator10.3"}
On the screen I can see that DeviceAgent has been launched 2 times instead of regular single launch but still application is not brought to the foreground and test fails.
I think the second launch is a result of the xcodebuild
process exiting. In 2.4.0, we had to fallback on using xcodebuild test-without-building
instead of an iOSDeviceManager (based on FBSimulatorControl) start_test
solution.
Try this.
Before("@reinstall") do |scenario|
RunLoop::CoreSimulator.quit_simulator
sleep(5)
RunLoop::CoreSimulator.quit_simulator
end
If that works, then we need to find a way of terminating the xcodebuild test-without-building
process in such a way that the DeviceAgent is not launched a second time. We would like to preserve the ability to run N
cucumber tests at once and not to go back to the only one instruments process
days.
Thank you @jmoody for helping upon this issue. Sure, pushing changes and will be right back with updates.
Hello @jmoody! The fix works for me(ruby 2.4.0, rbenv, run_loop (2.4.1), calabash-cucumber (0.20.4), not a jenkins, xcode 8.3.1 (8E1000a)) It restarts simulator twice then it proceeds. I will probably update run_loop later and will stick to using older xcode and run_loop 2.3.1 for now
Not sure if it's important, but in my case simulator is restarted each feature file rather then checking for tags
Thanks for that @jmoody , I've added it to my before hook for every scenario and it's given me a level of stability allowing me to proceed.
My before hook now looks like
Before do |scenario|
RunLoop::CoreSimulator.quit_simulator
sleep 3
RunLoop::CoreSimulator.quit_simulator
sleep 3
launcher = Calabash::Launcher.launcher
options = {
# Add launch options here.
}
launcher.relaunch(options)
end
So weird - fix works locally when launching tests manually but persists in case tests where started via Jenkins service.
Hmm seems like this fix doesn't give the solid reliability I require. It seems as though quitting the simulator sometimes gets it into a state where it's always seen to be Booted
but in reality it isn't.
I've seen this before when I manually terminate jobs on Jenkins - somehow the kill command from Jenkins gets the running simulator in a state where it can't be launched as it's always seen to be Booted
already.
The only resolution I've been able to find for this is to restart the machine.
+1
Regarding my comment that issue was actual for CI machine - once I have removed following instructions from our job:
xcrun simctl shutdown XXXXXXXX-XXXXX-XXXX-XXXX-XXXXXXXXXXXX
xcrun simctl erase XXXXXXXX-XXXXX-XXXX-XXXX-XXXXXXXXXXXX
I noticed that it became almost impossible to reproduce it.
This is happening for us with real devices. This happens during a test run every time we kick off a job in Jenkins and when we run tests locally. Restarting the machine isn't an option as this is happening in the middle of our tests. Is this specific to iOS 10? Or a version of run_loop?
Calabash version: 0.20.4 run_loop version: 2.4.0 Mac OS: El Capitan iOS: 10.2
I am seeing the same issue myself as reported in the link below, but I see I should have opened my issue in this project first: https://github.com/calabash/calabash-ios/issues/1313
I am also using both Jenkins and my local box. I am investigating how to make the tests more stable.
Hi, thanks for this post, I had the same error and DeviceAgent was successfully installed after upgrading run_loop
gem to version 2.4.1
I'm trying to run calabash on iPad device (not simulator) on Xcode Version 8.3.2 (8E2002), iOS 10.3.1, Calabash version 0.20.4
Getting the same error with the below configuration: OSX: Sierra 10.12.5 ruby 2.4.1 run_loop 2.4.1 xcode 8.3.2 Both Machine and device iPod (9.3.5) device are on same network Provided DEVICE_TARGET, DEVICE_ENDPOINT, BUNDLE_ID parms. Receiving below error: RuntimeError: Could not connect to the DeviceAgent service. device: #<Device: iPod touch (9.3.5) a6d7fffa06404f5c782cf2bb7538f5667bf54276> url: http://10.1.10.24:27753/ To diagnose the problem tail the launcher log file: $ tail -1000 -F /Users/automationtesting/.calabash/iOSDeviceManager/logs/current.log
Please suggest resolution. Thanks in advance.
run-loop now manages the xcodebuild processes to prevent DeviceAgent relaunches (and launching simulators after tests have completed).
You should be able to remove your work arounds.
If the problem remains, create a new issue.
Environment:
Calabash 0.20.4 run_loop 2.4.1 iPhone 7 (10.3) (Simulator) Sierra 10.12.4 xcode-select --print-path: /Applications/Xcode.app/Contents/Developer xcodebuild -version: Xcode 8.3 Build version 8E162
Steps to reproduce:
I have a feature file that contains 6 different scenarios and two @reinstall tags which I'm using simply to reinstall application under the test once at the beginning of the feature and the 2-nd time in the middle of that feature. Something like that:
Feature: test feature
@reinstall Scenario: 1st scenario GivenWhenThen
Scenario: 2nd scenario GWT
Scenario: 3rd scenario GWT
@reinstall Scenario: 4th scenario GWT
Scenario: 5th scenario GWT
Scenario: 6th scenario GWT
When I launch tests I see that simulator has been successfully launched and application is reinstalled. After that next 3 scenario are also successful passed. Problem appears when it comes to the 4th scenario and tries to reinstall application. I'm getting error like I have pasted below. On the screen I can see that DeviceAgent has been launched 2 times instead of regular single launch but still application is not brought to the foreground and test fails.
Terminal output:
Simulator logs:
support/01_launch.rb