lib/calabash-cucumber/launch/simulator_helper.rb in calabash-cucumber-0.9.121 vs lib/calabash-cucumber/launch/simulator_helper.rb in calabash-cucumber-0.9.122

- old
+ new

@@ -16,14 +16,14 @@ DEFAULT_SIM_WAIT = 30 DEFAULT_SIM_RETRY = 2 - def self.relaunch(path, sdk = nil, version = 'iphone') + def self.relaunch(path, sdk = nil, version = 'iphone', args = nil) app_bundle_path = app_bundle_or_raise(path) - ensure_connectivity(app_bundle_path, sdk, version) + ensure_connectivity(app_bundle_path, sdk, version, args) end def self.stop simulator = SimLauncher::Simulator.new @@ -167,11 +167,11 @@ out = `otool "#{File.expand_path(d)}"/* -o 2> /dev/null | grep CalabashServer` /CalabashServer/.match(out) end end - def self.ensure_connectivity(app_bundle_path, sdk, version) + def self.ensure_connectivity(app_bundle_path, sdk, version, args = nil) begin max_retry_count = (ENV['MAX_CONNECT_RETRY'] || DEFAULT_SIM_RETRY).to_i timeout = (ENV['CONNECT_TIMEOUT'] || DEFAULT_SIM_WAIT).to_i retry_count = 0 connected = false @@ -181,11 +181,11 @@ raise "MAX_RETRIES" if retry_count == max_retry_count retry_count += 1 puts "(#{retry_count}.) Start Simulator #{sdk}, #{version}, for #{app_bundle_path}" begin Timeout::timeout(timeout, TimeoutErr) do - simulator = launch(app_bundle_path, sdk, version) + simulator = launch(app_bundle_path, sdk, version, args) until connected begin connected = (ping_app == '405') if ENV['POST_START_BREAK'] puts "Environment var POST_START_BREAK is deprecated and should no longer be necessary." @@ -193,10 +193,11 @@ sleep(post_connect_sleep) unless post_connect_sleep <= 0 end if connected server_version = get_version if server_version + p server_version unless version_check(server_version) msgs = ["You're running an older version of Calabash server with a newer client", "Client:#{Calabash::Cucumber::VERSION}", "Server:#{server_version}", "Minimum server version #{Calabash::Cucumber::FRAMEWORK_VERSION}", @@ -218,23 +219,24 @@ end rescue TimeoutErr => e puts "Timed out..." end end - rescue + rescue e + p e msg = "Unable to make connection to Calabash Server at #{ENV['DEVICE_ENDPOINT']|| "http://localhost:37265/"}\n" msg << "Make sure you've' linked correctly with calabash.framework and set Other Linker Flags.\n" msg << "Make sure you don't have a firewall blocking traffic to #{ENV['DEVICE_ENDPOINT']|| "http://localhost:37265/"}.\n" raise msg end end - def self.launch(app_bundle_path, sdk, version) + def self.launch(app_bundle_path, sdk, version, args = nil) simulator = SimLauncher::Simulator.new simulator.quit_simulator - simulator.launch_ios_app(app_bundle_path, sdk, version) + simulator.launch_ios_app(app_bundle_path, sdk, version) #, args wait for update to sim launcher simulator end def self.ping_app url = URI.parse(ENV['DEVICE_ENDPOINT']|| "http://localhost:37265/") @@ -262,12 +264,13 @@ body = Net::HTTP.get_response(url).body res = JSON.parse(body) if res['iOS_version'] @ios_version = res['iOS_version'] end + res rescue + nil end - nil end def self.ios_version unless @ios_version get_version