iOS Simulator doesn't launch with Calabash
-
21-12-2019 - |
Question
I have Calabash installed as a pod in my project. The gem itself is installed using bundler. When I try to run cucumber for my Calabash target, the first features starts but just hangs and the simulator never launches:
$ bundle exec cucumber
Feature: Ensure Login and Oauth Screen Functionality
Scenario: Verify Welcome Page # features/Sign_in.feature:3
More details from my install:
# xcode installation location
$ xcode-select --print-path
/Applications/Xcode.app/Contents/Developer
# xcode version
$ xcodebuild -version
Xcode 5.1.1
Build version 5B1008
# calabash version
$ bundle exec calabash-ios version
0.9.168
# calabash < 0.9.169 or Xamarin IDE users
# start your app manually in the simulator or from Xcode and then launch a console
$ bundle exec calabash-ios console
> server_version
{
"outcome" => "SUCCESS",
"app_id" => "[REDACTED]",
"simulator_device" => "iPhone",
"version" => "0.9.168",
"app_name" => "[REDACTED]",
"iphone_app_emulated_on_ipad" => false,
"4inch" => true,
"git" => {
"remote_origin" => "git@github.com:jmoody/calabash-ios-server.git",
"branch" => "master",
"revision" => "adde106"
},
"app_version" => "2.0.1",
"iOS_version" => "7.1",
"system" => "x86_64",
"simulator" => "iPhone Simulator 463.9.41, iPhone OS 7.1 (iPhone Retina (4-inch)/11D167)"
}
Solution
Ok,that means calabash cannot locate the your app.
Try this first,
- Comment out the APP_BUNDLE_PATH definition on
YourProject/features/support/01_launch.rb like
#APP_BUNDLE_PATH = "~/..../../myApp-cal.app"
so The calabash gem can locate the app automatically. - Open a console go to the project folder from it. Then enter
gem install calabash-cucumber
this will install the calabash gem its ok to run again even if you installed it previously there's no harm. Then entercalabash-ios setup
in that terminal, this will create a calabash target and add the calabash framework to your iOS project. more details about the setup process is mentioned in here. - Now open the project file in xcode editor (You can see the calabash.framework added to your project's framework group successfully.) select the yourApp-cal target and the simulator you want clean, build and run the yourApp-cal target on your simulator.
- Then stop it and come back to that console enter
calabash-ios console
console will start a ruby console that you can work with the app. now (while simulator is on your screen but your app is backbround on that simulator) typestart_test_server_in_background
your app must come to foreground. If that works the calabash can find and run your app on simulator. - Remember only if you create an app build on a separate folder using a xcodebuild command or script or something, thats the time to set the APP_BUNDLE_PATH variable.
OTHER TIPS
Chathura's answer worked for one of my colleagues, but a couple of us had to find another solution.
The issue for us occurred after introducing CocoaPods. In Xcode, I opened Organizer and noticed we had a derived data folder for the BP (before Pods) project and another for the workspace with Pods. I deleted the derived data folder for the BP project and then everything worked.
I had re-setup calabash before doing this, so the solution in my case may have been a combination of Chathura's answer and mine.