Module: Cukunity::IOS::Process

Extended by:
Utils, Utils
Defined in:
lib/cukunity/drivers/iOS/process.rb

Constant Summary

Constants included from Utils

Utils::MOBILE_DEVICE_DEFAULT_TIMEOUT

Class Method Summary collapse

Methods included from Utils

bundle_identifier, device_udid, mobile_device_cmd, uiautomation_cmd, unity_command

Methods included from Utils

check_timeout, merge_options, restrict_options, to_options, wait_connectivity

Class Method Details

.foreground?(path) ⇒ Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/cukunity/drivers/iOS/process.rb', line 19

def self.foreground?(path)
  running?(path)
end

.launch(path, max_time = 30) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/cukunity/drivers/iOS/process.rb', line 9

def self.launch(path, max_time = 30)
  unless App::installed?(path)
    App::install(path)
  end
  pipe = Cukunity::IOS::UIAutomation.instance.popen(bundle_identifier(path))
  raise Exception::LaunchTimeout.new if max_time > 0 and check_timeout(max_time) do
    foreground?(path)
  end
end

.relaunch(path, max_time = 30) ⇒ Object



34
35
36
37
38
39
# File 'lib/cukunity/drivers/iOS/process.rb', line 34

def self.relaunch(path, max_time = 30)
  Cukunity::IOS::Unity::Client.instance.close
  Cukunity::IOS::UIAutomationMaster.instance.close
  Cukunity::IOS::UIAutomation.instance.close
  launch(path, max_time)
end

.running?(path) ⇒ Boolean

Returns:

  • (Boolean)


23
24
25
26
27
28
29
30
31
32
# File 'lib/cukunity/drivers/iOS/process.rb', line 23

def self.running?(path)
  path_bundle_id = bundle_identifier(path)
  begin
    # it should be already running and polling
    res = uiautomation_cmd('bundleIdentifier', :max_time => 3)
    res['bundleIdentifier'] == path_bundle_id
  rescue Exception::UIAutomationSlaveTimeout
    false
  end
end