Module: Cukunity::IOS::Utils
Constant Summary
collapse
- MOBILE_DEVICE_DEFAULT_TIMEOUT =
60
Instance Method Summary
collapse
Methods included from Utils
#check_timeout, #merge_options, #restrict_options, #to_options, #wait_connectivity
Instance Method Details
#bundle_identifier(app_folder) ⇒ Object
37
38
39
|
# File 'lib/cukunity/drivers/iOS/utils.rb', line 37
def bundle_identifier(app_folder)
mobile_device_cmd(['get_bundle_id', app_folder]).first.chomp
end
|
#device_udid ⇒ Object
31
32
33
34
35
|
# File 'lib/cukunity/drivers/iOS/utils.rb', line 31
def device_udid
udid = mobile_device_cmd(['get_udid']).first.chomp
raise Exception::MobileDeviceError.new(udid) unless udid.length == 40
udid
end
|
#mobile_device_cmd(cmd, options = {}) ⇒ Object
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/cukunity/drivers/iOS/utils.rb', line 12
def mobile_device_cmd(cmd, options = {})
options = merge_options(options, { :wait => true, :max_time => MOBILE_DEVICE_DEFAULT_TIMEOUT })
pipe = IO.popen(['mobiledevice'] + cmd)
return pipe unless options[:wait]
status = nil
raise Exception::MobileDeviceTimeout.new(cmd) if check_timeout(options[:max_time]) do
if ::Process.waitpid(pipe.pid, ::Process::WNOHANG)
status = $?
true
else
false
end
end
output = pipe.readlines
pipe.close
raise Exception::MobileDeviceError.new(cmd) unless status.exitstatus == 0
output
end
|
#uiautomation_cmd(name, options = {}) ⇒ Object
41
42
43
|
# File 'lib/cukunity/drivers/iOS/utils.rb', line 41
def uiautomation_cmd(name, options = {})
Cukunity::IOS::UIAutomationMaster.instance.command(name, options)
end
|
#unity_command(name, opts = {}) ⇒ Object
8
9
10
|
# File 'lib/cukunity/drivers/iOS/utils.rb', line 8
def unity_command(name, opts = {})
Cukunity::IOS::Unity::Client.instance.command(name, opts)
end
|