Method: Repeater#validate_session

Defined in:
lib/xcmonkey/repeater.rb

#validate_session(session_path) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/xcmonkey/repeater.rb', line 20

def validate_session(session_path)
  Logger.error("Provided session can't be found: #{session_path}") unless File.exist?(session_path)

  session = JSON.parse(File.read(session_path))

  if session['params'].nil?
    Logger.error('Provided session is not valid: `params` should not be `nil`')
    return
  end

  self.actions = session['actions']
  Logger.error('Provided session is not valid: `actions` should not be `nil` or `empty`') if actions.nil? || actions.empty?

  self.udid = session['params']['udid']
  Logger.error('Provided session is not valid: `udid` should not be `nil`') if udid.nil?

  self.bundle_id = session['params']['bundle_id']
  Logger.error('Provided session is not valid: `bundle_id` should not be `nil`') if bundle_id.nil?

  self.throttle = session['params']['throttle']

  self.ignore_crashes = session['params']['ignore_crashes']

  self.disable_simulator_keyboard = session['params']['disable_simulator_keyboard']
end