Module: Frank::Cucumber::Launcher
- Included in:
- Frank::Console
- Defined in:
- lib/frank-cucumber/launcher.rb
Instance Attribute Summary collapse
-
#application_path ⇒ Object
Returns the value of attribute application_path.
-
#sdk ⇒ Object
Returns the value of attribute sdk.
-
#version ⇒ Object
Returns the value of attribute version.
Instance Method Summary collapse
- #enforce(app_path, locator = Frank::Cucumber::AppBundleLocator.new) ⇒ Object
- #launch_app(app_path, sdk = nil, version = 'iphone') ⇒ Object
- #simulator_client ⇒ Object
- #simulator_direct_client ⇒ Object
Instance Attribute Details
#application_path ⇒ Object
Returns the value of attribute application_path.
7 8 9 |
# File 'lib/frank-cucumber/launcher.rb', line 7 def application_path @application_path end |
#sdk ⇒ Object
Returns the value of attribute sdk.
7 8 9 |
# File 'lib/frank-cucumber/launcher.rb', line 7 def sdk @sdk end |
#version ⇒ Object
Returns the value of attribute version.
7 8 9 |
# File 'lib/frank-cucumber/launcher.rb', line 7 def version @version end |
Instance Method Details
#enforce(app_path, locator = Frank::Cucumber::AppBundleLocator.new) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/frank-cucumber/launcher.rb', line 17 def enforce(app_path, locator = Frank::Cucumber::AppBundleLocator.new) if app_path.nil? = "APP_BUNDLE_PATH is not set. \n\nPlease set APP_BUNDLE_PATH (either an environment variable, or the ruby constant in support/env.rb) to the path of your Frankified target's iOS app bundle." possible_app_bundles = locator.guess_possible_app_bundles_for_dir( Dir.pwd ) if possible_app_bundles && !possible_app_bundles.empty? << "\n\nBased on your current directory, you probably want to use one of the following paths for your APP_BUNDLE_PATH:\n" << possible_app_bundles.join("\n") end raise "\n\n"+("="*80)+"\n"++"\n"+("="*80)+"\n\n" end if app_path_problem = SimLauncher.check_app_path(app_path) raise "\n\n"+("="*80)+"\n"+app_path_problem+"\n"+("="*80)+"\n\n" end end |
#launch_app(app_path, sdk = nil, version = 'iphone') ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/frank-cucumber/launcher.rb', line 33 def launch_app(app_path, sdk = nil, version = 'iphone') @application_path = app_path @sdk = sdk @version = version enforce(app_path) # kill the app if it's already running, just in case this helps # reduce simulator flakiness when relaunching the app. Use a timeout of 5 seconds to # prevent us hanging around for ages waiting for the ping to fail if the app isn't running begin Timeout::timeout(5) { press_home_on_simulator if frankly_ping } rescue Timeout::Error end if( ENV['USE_SIM_LAUNCHER_SERVER'] ) simulator = simulator_client else simulator = simulator_direct_client end num_timeouts = 0 begin simulator.relaunch wait_for_frank_to_come_up rescue Timeout::Error num_timeouts += 1 puts "Encountered #{num_timeouts} timeouts while launching the app." if num_timeouts > 3 raise "Encountered #{num_timeouts} timeouts in a row while trying to launch the app." end quit_double_simulator retry end end |
#simulator_client ⇒ Object
9 10 11 |
# File 'lib/frank-cucumber/launcher.rb', line 9 def simulator_client @simulator_client ||= SimLauncher::Client.new(@application_path, @sdk, @version) end |
#simulator_direct_client ⇒ Object
13 14 15 |
# File 'lib/frank-cucumber/launcher.rb', line 13 def simulator_direct_client @simulator_direct_client ||= SimLauncher::DirectClient.new(@application_path, @sdk, @version) end |