Class: Calabash::Cucumber::SimulatorLauncher
- Inherits:
-
Object
- Object
- Calabash::Cucumber::SimulatorLauncher
- Includes:
- Logging
- Defined in:
- lib/calabash-cucumber/launch/simulator_launcher.rb
Overview
Acts as a bridge to the sim_launcher SimLauncher and SdkDetector classes.
Runtime Environmental Variables
-
‘PROJECT_DIR` (ENV) - the path to the .xcproject directory
-
‘DEVICE_ENDPOINT` (localhost:37265/) - the ip:port of the device under test
-
‘CALABASH_VERSION_PATH` (version) - the path to server version route
-
‘MAX_CONNECT_RETRY` (2) the number of times retry establishing a connection to the server.
-
‘CONNECT_TIMEOUT` (30) how long to wait for the server before timing out
Defined Under Namespace
Classes: TimeoutErr
Constant Summary collapse
- DEFAULT_SIM_RETRY =
If ‘MAX_CONNECT_RETRY` is not set, try to launch the app this many times in the simulator before giving up
2
Instance Method Summary collapse
-
#find_preferred_dir(sim_dirs) ⇒ String
!@visibility private Finds the preferred(?) directory.
-
#get_version ⇒ Object
deprecated
Deprecated.
0.9.169 Calabash::Cucumber::Launcher.launcher.device instance methods
-
#initialize ⇒ SimulatorLauncher
constructor
Creates a new instance an sets the :simulator and :sdk_detector attributes.
-
#ios_major_version ⇒ Object
deprecated
Deprecated.
0.9.169 use Calabash::Cucumber::Launcher.launcher.ios_major_version
-
#ios_version ⇒ Object
deprecated
Deprecated.
0.9.169 Calabash::Cucumber::Launcher.launcher.device instance methods
-
#ping_app ⇒ String
!@visibility private Ping the version route of the calabash server embedded in the app,.
-
#stop ⇒ Object
Stops (quits) the simulator.
-
#version_check(version) ⇒ Object
deprecated
Deprecated.
0.9.169 version checking is done in Launcher
Methods included from Logging
#calabash_info, #calabash_warn
Constructor Details
#initialize ⇒ SimulatorLauncher
Creates a new instance an sets the :simulator and :sdk_detector attributes.
68 69 70 71 |
# File 'lib/calabash-cucumber/launch/simulator_launcher.rb', line 68 def initialize @simulator = SimLauncher::Simulator.new @sdk_detector = SimLauncher::SdkDetector.new() end |
Instance Method Details
#find_preferred_dir(sim_dirs) ⇒ String
find_preferred_dir is a bad name - preferred for what?
sim_dirs arg is a bad name - we can be iterating over any directory
!@visibility private Finds the preferred(?) directory.
370 371 372 373 374 |
# File 'lib/calabash-cucumber/launch/simulator_launcher.rb', line 370 def find_preferred_dir(sim_dirs) sim_dirs.find do |d| linked_with_calabash?(d) end end |
#get_version ⇒ Object
0.9.169 Calabash::Cucumber::Launcher.launcher.device instance methods
537 538 539 540 |
# File 'lib/calabash-cucumber/launch/simulator_launcher.rb', line 537 def get_version _deprecated('0.9.169', 'use an instance Device class instead', :warn) raise(NotImplementedError, 'this method has been deprecated') end |
#ios_major_version ⇒ Object
0.9.169 use Calabash::Cucumber::Launcher.launcher.ios_major_version
551 552 553 554 |
# File 'lib/calabash-cucumber/launch/simulator_launcher.rb', line 551 def ios_major_version _deprecated('0.9.169', 'use an instance Device class instead', :warn) raise(NotImplementedError, 'this method has been deprecated') end |
#ios_version ⇒ Object
0.9.169 Calabash::Cucumber::Launcher.launcher.device instance methods
544 545 546 547 |
# File 'lib/calabash-cucumber/launch/simulator_launcher.rb', line 544 def ios_version _deprecated('0.9.169', 'use an instance Device class instead', :warn) raise(NotImplementedError, 'this method has been deprecated') end |
#ping_app ⇒ String
migrate DEVICE_ENDPOINT to environment_helpers
migrate CALABASH_VERSION_PATH to environment_helpers
this is an exact duplicate of Launcher ping method
Has the side effect of setting self.device attribute if successful.
!@visibility private Ping the version route of the calabash server embedded in the app,
386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 |
# File 'lib/calabash-cucumber/launch/simulator_launcher.rb', line 386 def ping_app url = URI.parse(ENV['DEVICE_ENDPOINT']|| 'http://localhost:37265/') if full_console_logging? puts "Ping #{url}..." end http = Net::HTTP.new(url.host, url.port) res = http.start do |sess| # noinspection RubyResolve sess.request Net::HTTP::Get.new(ENV['CALABASH_VERSION_PATH'] || 'version') end status = res.code begin http.finish if http and http.started? rescue # nop end if status == '200' version_body = JSON.parse(res.body) self.device = Calabash::Cucumber::Device.new(url, version_body) end if full_console_logging? puts "ping status = '#{status}'" end status end |
#stop ⇒ Object
Stops (quits) the simulator.
74 75 76 |
# File 'lib/calabash-cucumber/launch/simulator_launcher.rb', line 74 def stop RunLoop::SimControl.new.quit_sim end |
#version_check(version) ⇒ Object
0.9.169 version checking is done in Launcher
561 562 563 564 |
# File 'lib/calabash-cucumber/launch/simulator_launcher.rb', line 561 def version_check(version) _deprecated('0.9.169', 'check is now done in Launcher', :warn) raise(NotImplementedError, 'this method has been deprecated and will be removed') end |