lib/calabash-cucumber/launch/simulator_helper.rb in calabash-cucumber-0.9.68 vs lib/calabash-cucumber/launch/simulator_helper.rb in calabash-cucumber-0.9.70

- old
+ new

@@ -8,10 +8,12 @@ module SimulatorHelper DERIVED_DATA = File.expand_path("~/Library/Developer/Xcode/DerivedData") DEFAULT_DERIVED_DATA_INFO = File.expand_path("#{DERIVED_DATA}/*/info.plist") + DEFAULT_SIM_WAIT = "15" + MAX_PING_ATTEMPTS = 5 def self.relaunch(path, sdk = nil, version = 'iphone') app_bundle_path = app_bundle_or_raise(path) @@ -159,10 +161,11 @@ pref end def self.ensure_connectivity(app_bundle_path, sdk, version) begin - Timeout::timeout(15) do + timeout = (ENV['CONNECT_TIMEOUT'] || DEFAULT_SIM_WAIT).to_i + Timeout::timeout(timeout) do connected = false until connected simulator = launch(app_bundle_path, sdk, version) num_pings = 0 until connected or (num_pings == MAX_PING_ATTEMPTS)