calabash / calabash-ios

Calabash for iOS
Other
1.81k stars 369 forks source link

Calabash should detect the current Simulator target from Xcode project settings #651

Open ghost opened 9 years ago

ghost commented 9 years ago

Xcode 6 enabled developers to configure multiple simulators and delete the defaults, which I've done in my case. I expected calabash to detect the simulator the current project is configured against, or to pick one from the available ones if this wasn't possible.

It seems to be the case that instead it simply times out if it can't find one with a hardcoded name.

See the below log:

Feature: Running a test
  As an iOS developer
  I want to have a sample feature file
  So I can begin testing quickly

  Scenario: Example steps                            # features/my_first.feature:6
Unable to start. Make sure you've set APP_BUNDLE_PATH to a build supported by this simulator version
  Calabash::Cucumber::Launcher::StartError: Time out waiting for UIAutomation run-loop to Start. 
   Logfile /var/folders/bf/ks8m1vls3054pvl4n2w0fssc0000gn/T/run_loop20141217-3762-ki42q9/run_loop.out 

   Instruments Usage Error : Unknown device specified: "iPhone 5 (8.1 Simulator)"
  Known Devices:
  lyptt's MacBook Pro [69B1B6A4-3645-5F0F-B447-F8362C7AD582]
  Sim1 (8.1 Simulator) [41E04385-D42D-49B3-B95C-E3CC4C8356FB]
  Sim2 (8.1 Simulator) [AB2A58CD-15F2-4EDC-9EFA-4C05B9DC8F53]
  Sim3 (8.1 Simulator) [37EC060A-48C0-47BF-9830-E47E01D72057]
  Sim4 (8.1 Simulator) [437291FE-7251-4855-8864-5C79DD649074]
  Sim5 (8.1 Simulator) [13007720-2F10-4712-BA96-DCC4AEEF24E6]
  Sim6 (8.1 Simulator) [C7EEEFF7-2E69-4701-93FC-4A74F87228BD]
  Sim7 (8.1 Simulator) [2F9A747B-3734-41FC-9718-AE619DA7E349]
  Sim8 (8.1 Simulator) [546C71A3-78E1-46B8-97EF-AC9AD547A332]
  Sim9 (8.1 Simulator) [275B4022-2798-424F-B23A-C3421387866A]
  Sim10 (8.1 Simulator) [DC160D2C-1B50-446F-8670-3FFAE6C7D175]
  Sim11 (8.1 Simulator) [9F9762D5-568A-44F1-9563-6DBED81016B6]
  Sim12 (8.1 Simulator) [9310523B-7A75-4D7C-9D08-0D1A14A11456]
  Sim13 (8.1 Simulator) [3272793E-14EC-4AE3-9D6B-7955DA0B0A37]

   (Calabash::Cucumber::Launcher::StartError)
  /Library/Ruby/Gems/2.0.0/gems/calabash-cucumber-0.11.4/lib/calabash-cucumber/launcher.rb:743:in `new_run_loop'
  /Library/Ruby/Gems/2.0.0/gems/calabash-cucumber-0.11.4/lib/calabash-cucumber/launcher.rb:605:in `relaunch'
  /Users/lyptt/Desktop/Proj13/features/support/01_launch.rb:27:in `Before'
    Given I am on the Welcome Screen                 # features/step_definitions/my_first_steps.rb:1
    Then I swipe left                                # calabash-cucumber-0.11.4/features/step_definitions/calabash_steps.rb:234
    And I wait until I don't see "Please swipe left" # calabash-cucumber-0.11.4/features/step_definitions/calabash_steps.rb:165
    And take picture                                 # calabash-cucumber-0.11.4/features/step_definitions/calabash_steps.rb:229

Failing Scenarios:
cucumber features/my_first.feature:6 # Scenario: Example steps

1 scenario (1 failed)
4 steps (4 skipped)
2m43.066s
jmoody commented 9 years ago

@lyptt

I expected calabash to detect the simulator the current project is configured against,

Calabash does not inspect the Xcode project file to find currently selected target. We might be able to do this, but a fair number of our users don't have an Xcode project; they have only an .ipa or an .app. Or they are Xamarin Studio users. It might also be confusing in CI environments.

or to pick one from the available ones if this wasn't possible.

The problem is which one to pick?

I think you probably already know this, but the way to specify a non-default simulator is to use the DEVICE_TARGET variable.

$ DEVICE_TARGET="Sim12 (8.1 Simulator)" cucumber

I am not sure what to do with this issue. I am going to change the title and label it as an enhancement.

I think this might have merit, but it will be a very low priority for us.

Pull-requests welcome.

ark-konopacki commented 8 years ago

@jmoody cannot we try default one and if such Simulator does not exist puts message like: "Cannot find default Simulator please define existing one with DEVICE_TARGET"? BTW for me it looks like run_loop issue not calabash like update method self.default_simulator in https://github.com/calabash/run_loop/blob/cbdfc9fb28a583c382df26f88b5e79667c149e18/lib/run_loop/core.rb#L286

jmoody commented 8 years ago

This user wants us to look at the Xcode project and find the currently selected simulator.

This change should be made in run-loop.