class KrakenApp

Attributes

apk_path[RW]
scenarios_queue[RW]

Public Class Methods

new(apk_path:, properties_path: nil, config_path: nil) click to toggle source
# File lib/kraken_mobile.rb, line 17
def initialize(apk_path:, properties_path: nil, config_path: nil)
  @apk_path = apk_path
  @scenarios_queue = []
  save_path_in_environment_variable_with_name(
    name: K::PROPERTIES_PATH, path: properties_path
  )
  save_path_in_environment_variable_with_name(
    name: K::CONFIG_PATH, path: config_path
  )

  build_scenarios_queue
end

Public Instance Methods

on_test_scenario_finished() click to toggle source
# File lib/kraken_mobile.rb, line 33
def on_test_scenario_finished
  execute_next_scenario
end
save_path_in_environment_variable_with_name(name:, path:) click to toggle source
# File lib/kraken_mobile.rb, line 45
def save_path_in_environment_variable_with_name(name:, path:)
  return if path.nil?

  absolute_path = File.expand_path(path)
  save_value_in_environment_variable_with_name(
    name: name,
    value: absolute_path
  )
end
save_value_in_environment_variable_with_name(name:, value:) click to toggle source
# File lib/kraken_mobile.rb, line 55
def save_value_in_environment_variable_with_name(name:, value:)
  return if name.nil? || value.nil?

  ENV[name] = value
end
start() click to toggle source
# File lib/kraken_mobile.rb, line 41
def start
  execute_next_scenario
end

Private Instance Methods

build_scenarios_queue() click to toggle source
# File lib/kraken_mobile.rb, line 63
def build_scenarios_queue
  feature_files.each do |feature_path|
    scenarios_queue.unshift(
      TestScenario.new(
        kraken_app: self,
        feature_file_path: feature_path
      )
    )
  end
end
execute_next_scenario() click to toggle source
# File lib/kraken_mobile.rb, line 74
def execute_next_scenario
  return if scenarios_queue.count.zero?

  scenario = scenarios_queue.pop
  scenario.run
  scenario
end