Search code examples
calabashcalabash-ios

iOS Simulator doesn't launch with Calabash


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" => "[email protected]: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,

    1. 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.
    2. 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 enter calabash-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.
    3. 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.
    4. 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) type start_test_server_in_background your app must come to foreground. If that works the calabash can find and run your app on simulator.
    5. 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.