Module: Appium::Android::Device
- Extended by:
- Forwardable
- Defined in:
- lib/appium_lib_core/android/device.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#end_coverage(path, intent) ⇒ Object
Android only; Ends the test coverage and writes the results to the given path on device.
-
#get_performance_data(package_name: , data_type: , data_read_timeout: 1000) ⇒ Object
Get the resource usage information of the application.
-
#get_performance_data_types ⇒ Object
Get the information type of the system state which is supported to read such as cpu, memory, network, battery via adb commands.
-
#hide_keyboard(close_key = nil, strategy = nil) ⇒ Object
Hide the onscreen keyboard.
-
#set_network_connection(mode) ⇒ Object
Set the device network connection mode.
-
#start_activity(opts) ⇒ Object
Android only.
-
#start_recording_screen(package_name: , data_type: , data_read_timeout: 1000) ⇒ Object
Record the display of devices running Android 4.4 (API level 19) and higher.
-
#stop_recording_screen ⇒ Object
Stop recording the screen.
Class Method Details
.extended(_mod) ⇒ Object
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 |
# File 'lib/appium_lib_core/android/device.rb', line 107 def extended(_mod) Appium::Core::Device.extend_webdriver_with_forwardable # Android Appium::Core::Device.add_endpoint_method(:start_activity) do def start_activity(opts) raise 'opts must be a hash' unless opts.is_a? Hash app_package = opts[:app_package] raise 'app_package is required' unless app_package app_activity = opts[:app_activity] raise 'app_activity is required' unless app_activity app_wait_package = opts.fetch(:app_wait_package, '') app_wait_activity = opts.fetch(:app_wait_activity, '') unknown_opts = opts.keys - %i(app_package app_activity app_wait_package app_wait_activity) raise "Unknown options #{unknown_opts}" unless unknown_opts.empty? execute :start_activity, {}, appPackage: app_package, appActivity: app_activity, appWaitPackage: app_wait_package, appWaitActivity: app_wait_activity end end # Android, Override Appium::Core::Device.add_endpoint_method(:hide_keyboard) do def hide_keyboard(close_key = nil, strategy = nil) option = {} option[:key] = close_key if close_key option[:strategy] = strategy || :tapOutside # default to pressKey execute :hide_keyboard, {}, option end end # TODO: TEST ME Appium::Core::Device.add_endpoint_method(:end_coverage) do def end_coverage(path, intent) execute :end_coverage, {}, path: path, intent: intent end end Appium::Core::Device.add_endpoint_method(:set_network_connection) do def set_network_connection(mode) execute :set_network_connection, {}, type: mode end end Appium::Core::Device.add_endpoint_method(:get_performance_data) do def get_performance_data(package_name:, data_type:, data_read_timeout: 1000) execute(:get_performance_data, {}, packageName: package_name, dataType: data_type, dataReadTimeout: data_read_timeout) end end Appium::Core::Device.add_endpoint_method(:start_recording_screen) do def start_recording_screen(file_path: '/sdcard/default.mp4', video_size: '1280x720', time_limit: '180', bit_rate: '3000000') execute(:start_recording_screen, {}, filePath: file_path, videoSize: video_size, timeLimit: time_limit, bitRate: bit_rate) end end end |
Instance Method Details
#end_coverage(path, intent) ⇒ Object
Android only; Ends the test coverage and writes the results to the given path on device.
|
|
# File 'lib/appium_lib_core/android/device.rb', line 21
|
#get_performance_data(package_name: , data_type: , data_read_timeout: 1000) ⇒ Object
Get the resource usage information of the application. github.com/appium/appium-base-driver/blob/be29aec2318316d12b5c3295e924a5ba8f09b0fb/lib/mjsonwp/routes.js#L303
|
|
# File 'lib/appium_lib_core/android/device.rb', line 68
|
#get_performance_data_types ⇒ Object
Get the information type of the system state which is supported to read such as cpu, memory, network, battery via adb commands. github.com/appium/appium-base-driver/blob/be29aec2318316d12b5c3295e924a5ba8f09b0fb/lib/mjsonwp/routes.js#L300
|
|
# File 'lib/appium_lib_core/android/device.rb', line 58
|
#hide_keyboard(close_key = nil, strategy = nil) ⇒ Object
Hide the onscreen keyboard
|
|
# File 'lib/appium_lib_core/android/device.rb', line 6
|
#set_network_connection(mode) ⇒ Object
Set the device network connection mode
|
|
# File 'lib/appium_lib_core/android/device.rb', line 41
|
#start_activity(opts) ⇒ Object
Android only. Start a new activity within the current app or launch a new app and start the target activity.
|
|
# File 'lib/appium_lib_core/android/device.rb', line 27
|
#start_recording_screen(package_name: , data_type: , data_read_timeout: 1000) ⇒ Object
Record the display of devices running Android 4.4 (API level 19) and higher. It records screen activity to an MPEG-4 file. Audio is not recorded with the video file.
|
|
# File 'lib/appium_lib_core/android/device.rb', line 80
|
#stop_recording_screen ⇒ Object
Stop recording the screen.
|
|
# File 'lib/appium_lib_core/android/device.rb', line 94
|