lib/calabash/ios/device/device_implementation.rb in calabash-1.9.9.pre3 vs lib/calabash/ios/device/device_implementation.rb in calabash-2.0.0.pre1

- old
+ new

@@ -20,12 +20,10 @@ include Calabash::IOS::TextMixin include Calabash::IOS::UIAMixin include Calabash::IOS::GesturesMixin - # @todo Should these be public? - # @todo If public, document! attr_reader :run_loop attr_reader :uia_strategy attr_reader :start_options # Returns the default simulator identifier. The string that is return @@ -290,10 +288,17 @@ # app has launched. expect_runtime_attributes_available(__method__) runtime_attributes.server_version end + # @!visibility private + # A dump of runtime details. + def runtime_details + expect_runtime_attributes_available(__method__) + @runtime_attributes.runtime_info + end + # Is this device a simulator? # @return [Boolean] Returns true if this device is a simulator. def simulator? # Can be obtain by asking for a device's run_loop_device. This does not # require the app to be launched, but it is expensive @@ -727,14 +732,21 @@ end end # @!visibility private def expect_runtime_attributes_available(method_name) + if runtime_attributes.nil? - logger.log("The method '#{method_name}' is not available to IOS::Device until", :info) - logger.log('the app has been launched with Calabash start_app.', :info) - raise "The method '#{method_name}' can only be called after the app has been launched" + begin + # Populates the @runtime_attributes + wait_for_server_to_start({:timeout => 1.0}) + rescue Calabash::Device::EnsureTestServerReadyTimeoutError => _ + logger.log("The method '#{method_name}' is not available to IOS::Device until", :info) + logger.log('the app has been launched with Calabash start_app.', :info) + raise "The method '#{method_name}' can only be called after the app has been launched" + end end + true end def instruments_pid pids = RunLoop::Instruments.new.instruments_pids