appium_lib_core 1.6.0 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +2 -2
- data/CHANGELOG.md +16 -0
- data/lib/appium_lib_core/android/device.rb +301 -406
- data/lib/appium_lib_core/android/device/clipboard.rb +42 -0
- data/lib/appium_lib_core/android/device/emulator.rb +149 -147
- data/lib/appium_lib_core/android/device/network.rb +47 -0
- data/lib/appium_lib_core/android/device/performance.rb +24 -0
- data/lib/appium_lib_core/android/device/screen.rb +39 -0
- data/lib/appium_lib_core/android/espresso/bridge.rb +1 -1
- data/lib/appium_lib_core/android/uiautomator1/bridge.rb +1 -1
- data/lib/appium_lib_core/android/uiautomator2/bridge.rb +1 -1
- data/lib/appium_lib_core/android/uiautomator2/device.rb +3 -14
- data/lib/appium_lib_core/android/uiautomator2/device/battery.rb +28 -0
- data/lib/appium_lib_core/common/base/http_default.rb +5 -1
- data/lib/appium_lib_core/device.rb +50 -370
- data/lib/appium_lib_core/device/app_management.rb +113 -0
- data/lib/appium_lib_core/device/app_state.rb +18 -1
- data/lib/appium_lib_core/device/context.rb +48 -0
- data/lib/appium_lib_core/device/device_lock.rb +28 -0
- data/lib/appium_lib_core/device/file_management.rb +32 -0
- data/lib/appium_lib_core/device/image_comparison.rb +1 -3
- data/lib/appium_lib_core/device/ime_actions.rb +43 -0
- data/lib/appium_lib_core/device/keyboard.rb +26 -0
- data/lib/appium_lib_core/device/keyevent.rb +44 -0
- data/lib/appium_lib_core/device/screen_record.rb +21 -0
- data/lib/appium_lib_core/device/setting.rb +21 -0
- data/lib/appium_lib_core/device/touch_actions.rb +22 -0
- data/lib/appium_lib_core/device/value.rb +23 -0
- data/lib/appium_lib_core/driver.rb +8 -0
- data/lib/appium_lib_core/ios/device.rb +70 -101
- data/lib/appium_lib_core/ios/device/clipboard.rb +41 -0
- data/lib/appium_lib_core/ios/uiautomation/bridge.rb +1 -1
- data/lib/appium_lib_core/ios/xcuitest/bridge.rb +2 -2
- data/lib/appium_lib_core/ios/xcuitest/device.rb +166 -227
- data/lib/appium_lib_core/ios/xcuitest/device/battery.rb +28 -0
- data/lib/appium_lib_core/ios/xcuitest/device/performance.rb +40 -0
- data/lib/appium_lib_core/ios/xcuitest/device/screen.rb +30 -0
- data/lib/appium_lib_core/version.rb +2 -2
- data/release_notes.md +12 -0
- metadata +21 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ae3ab4209d2a044887cda376b71c5a61a5e525d7
|
4
|
+
data.tar.gz: 16dacc763beec91077e7fdc76806c6d775002966
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 74c62e4e29d2c3b6428a8f6891f209f780b73b2d5cd491e85bb74dd057de9a786f38933ff81c57a44a81bc02f6f7e76a8e127af2ef59990d793babdbef903d3b
|
7
|
+
data.tar.gz: 819194531cf4631149199061461ddf41f7be0eec4dba95cc7573f2ad75de6791c5d490c8e08226e9df3ee6e23e9663e0d8913e9012c9fe831513ef50673ff92a
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -8,6 +8,22 @@ All notable changes to this project will be documented in this file.
|
|
8
8
|
|
9
9
|
### Deprecations
|
10
10
|
|
11
|
+
## [1.7.0] - 2018-05-28
|
12
|
+
### Enhancements
|
13
|
+
- Has one **Breaking Change**
|
14
|
+
- Add `flags` in `press_keycode` and `long_press_keycode`
|
15
|
+
- New: `@driver.press_keycode 66, metastate: [1], flags: [0x20, 0x2000]`
|
16
|
+
- `metastate` should set as a keyword argument
|
17
|
+
- `long_press_keycode` as well
|
18
|
+
- Before: `@driver.press_keycode 66, 1` (Can set only metastate)
|
19
|
+
- How to change: add `metastate:` for the metastate argument
|
20
|
+
- [Internal] Change directory and file structure
|
21
|
+
- [Internal] Set default content-type
|
22
|
+
|
23
|
+
### Bug fixes
|
24
|
+
|
25
|
+
### Deprecations
|
26
|
+
|
11
27
|
## [1.6.0] - 2018-05-08
|
12
28
|
### Enhancements
|
13
29
|
- **Breaking Change**
|
@@ -1,432 +1,327 @@
|
|
1
1
|
require_relative 'device/emulator'
|
2
|
-
|
2
|
+
require_relative 'device/clipboard'
|
3
|
+
require_relative 'device/network'
|
4
|
+
require_relative 'device/performance'
|
5
|
+
require_relative 'device/screen'
|
3
6
|
|
4
7
|
module Appium
|
5
|
-
module
|
6
|
-
module
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
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
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
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
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
Appium::Core::Device.add_endpoint_method(:toggle_airplane_mode) do
|
251
|
-
def toggle_airplane_mode
|
252
|
-
execute :toggle_airplane_mode
|
253
|
-
end
|
254
|
-
alias_method :toggle_flight_mode, :toggle_airplane_mode
|
255
|
-
end
|
256
|
-
|
257
|
-
Appium::Core::Device.add_endpoint_method(:current_activity) do
|
258
|
-
def current_activity
|
259
|
-
execute :current_activity
|
260
|
-
end
|
261
|
-
end
|
262
|
-
|
263
|
-
Appium::Core::Device.add_endpoint_method(:current_package) do
|
264
|
-
def current_package
|
265
|
-
execute :current_package
|
266
|
-
end
|
267
|
-
end
|
268
|
-
|
269
|
-
Appium::Core::Device.add_endpoint_method(:get_system_bars) do
|
270
|
-
def get_system_bars
|
271
|
-
execute :get_system_bars
|
272
|
-
end
|
273
|
-
end
|
274
|
-
|
275
|
-
Appium::Core::Device.add_endpoint_method(:get_display_density) do
|
276
|
-
def get_display_density
|
277
|
-
execute :get_display_density
|
278
|
-
end
|
279
|
-
end
|
280
|
-
|
281
|
-
Appium::Core::Device.add_endpoint_method(:get_network_connection) do
|
282
|
-
def get_network_connection
|
283
|
-
execute :get_network_connection
|
284
|
-
end
|
285
|
-
end
|
286
|
-
|
287
|
-
Appium::Core::Device.add_endpoint_method(:get_performance_data_types) do
|
288
|
-
def get_performance_data_types
|
289
|
-
execute :get_performance_data_types
|
290
|
-
end
|
291
|
-
end
|
292
|
-
|
293
|
-
Appium::Core::Device.add_endpoint_method(:toggle_wifi) do
|
294
|
-
def toggle_wifi
|
295
|
-
execute :toggle_wifi
|
296
|
-
end
|
297
|
-
end
|
298
|
-
|
299
|
-
Appium::Core::Device.add_endpoint_method(:toggle_data) do
|
300
|
-
def toggle_data
|
301
|
-
execute :toggle_data
|
302
|
-
end
|
303
|
-
end
|
304
|
-
|
305
|
-
Appium::Core::Device.add_endpoint_method(:toggle_location_services) do
|
306
|
-
def toggle_location_services
|
307
|
-
execute :toggle_location_services
|
8
|
+
module Core
|
9
|
+
module Android
|
10
|
+
module Device
|
11
|
+
extend Forwardable
|
12
|
+
|
13
|
+
# rubocop:disable Metrics/LineLength
|
14
|
+
|
15
|
+
# @!method open_notifications
|
16
|
+
# Open Android notifications
|
17
|
+
#
|
18
|
+
# @example
|
19
|
+
#
|
20
|
+
# @driver.open_notifications
|
21
|
+
#
|
22
|
+
|
23
|
+
# @!method current_activity
|
24
|
+
# Get current activity name
|
25
|
+
# @return [String] An activity name
|
26
|
+
#
|
27
|
+
# @example
|
28
|
+
#
|
29
|
+
# @driver.current_activity # '.ApiDemos'
|
30
|
+
#
|
31
|
+
|
32
|
+
# @!method current_package
|
33
|
+
# Get current package name
|
34
|
+
# @return [String] A package name
|
35
|
+
#
|
36
|
+
# @example
|
37
|
+
#
|
38
|
+
# @driver.current_package # 'com.example.android.apis'
|
39
|
+
#
|
40
|
+
|
41
|
+
# @!method get_system_bars
|
42
|
+
# Get system bar's information
|
43
|
+
# @return [String]
|
44
|
+
#
|
45
|
+
# @example
|
46
|
+
#
|
47
|
+
# @driver.get_system_bars
|
48
|
+
#
|
49
|
+
|
50
|
+
# @!method get_display_density
|
51
|
+
# Get connected device's density.
|
52
|
+
# @return [Integer] The size of density
|
53
|
+
#
|
54
|
+
# @example
|
55
|
+
#
|
56
|
+
# @driver.get_display_density # 320
|
57
|
+
#
|
58
|
+
|
59
|
+
# @!method get_network_connection
|
60
|
+
# Get the device network connection current status
|
61
|
+
# See set_network_connection method for return value
|
62
|
+
#
|
63
|
+
# @example
|
64
|
+
#
|
65
|
+
# @driver.network_connection_type #=> 6
|
66
|
+
# @driver.get_network_connection #=> 6
|
67
|
+
#
|
68
|
+
|
69
|
+
# @!method toggle_wifi
|
70
|
+
# Switch the state of the wifi service only for Android
|
71
|
+
#
|
72
|
+
# @return [String]
|
73
|
+
#
|
74
|
+
# @example
|
75
|
+
#
|
76
|
+
# @driver.toggle_wifi
|
77
|
+
#
|
78
|
+
|
79
|
+
# @!method toggle_data
|
80
|
+
# Switch the state of data service only for Android, and the device should be rooted
|
81
|
+
#
|
82
|
+
# @return [String]
|
83
|
+
#
|
84
|
+
# @example
|
85
|
+
#
|
86
|
+
# @driver.toggle_data
|
87
|
+
#
|
88
|
+
|
89
|
+
# @!method toggle_location_services
|
90
|
+
# Switch the state of the location service
|
91
|
+
#
|
92
|
+
# @return [String]
|
93
|
+
#
|
94
|
+
# @example
|
95
|
+
#
|
96
|
+
# @driver.toggle_location_services
|
97
|
+
#
|
98
|
+
|
99
|
+
# @!method toggle_airplane_mode
|
100
|
+
# Toggle flight mode on or off
|
101
|
+
#
|
102
|
+
# @example
|
103
|
+
#
|
104
|
+
# @driver.toggle_airplane_mode
|
105
|
+
#
|
106
|
+
|
107
|
+
# @!method hide_keyboard(close_key = nil, strategy = nil)
|
108
|
+
# Hide the onscreen keyboard
|
109
|
+
# @param [String] close_key The name of the key which closes the keyboard.
|
110
|
+
# Defaults to 'Done' for iOS(except for XCUITest).
|
111
|
+
# @param [Symbol] strategy The symbol of the strategy which closes the keyboard.
|
112
|
+
# XCUITest ignore this argument.
|
113
|
+
# Default for iOS is `:pressKey`. Default for Android is `:tapOutside`.
|
114
|
+
#
|
115
|
+
# @example
|
116
|
+
#
|
117
|
+
# @driver.hide_keyboard # Close a keyboard with the 'Done' button
|
118
|
+
# @driver.hide_keyboard('Finished') # Close a keyboard with the 'Finished' button
|
119
|
+
# @driver.hide_keyboard(nil, :tapOutside) # Close a keyboard with tapping out side of keyboard
|
120
|
+
#
|
121
|
+
|
122
|
+
# @!method end_coverage(path, intent)
|
123
|
+
# Android only; Ends the test coverage and writes the results to the given path on device.
|
124
|
+
# @param [String] path Path on the device to write too.
|
125
|
+
# @param [String] intent Intent to broadcast when ending coverage.
|
126
|
+
#
|
127
|
+
|
128
|
+
# @!method start_activity(opts)
|
129
|
+
# Android only. Start a new activity within the current app or launch a new app and start the target activity.
|
130
|
+
#
|
131
|
+
# @param opts [Hash] Options
|
132
|
+
# @option opts [String] :app_package The package owning the activity [required]
|
133
|
+
# @option opts [String] :app_activity The target activity [required]
|
134
|
+
# @option opts [String] :app_wait_package The package to start before the target package [optional]
|
135
|
+
# @option opts [String] :app_wait_activity The activity to start before the target activity [optional]
|
136
|
+
#
|
137
|
+
# @example
|
138
|
+
#
|
139
|
+
# start_activity app_package: 'io.appium.android.apis',
|
140
|
+
# app_activity: '.accessibility.AccessibilityNodeProviderActivity'
|
141
|
+
#
|
142
|
+
|
143
|
+
# @!method set_network_connection(mode)
|
144
|
+
# Set the device network connection mode
|
145
|
+
# @param [String] mode Bit mask that represent the network mode
|
146
|
+
#
|
147
|
+
# Value (Alias) | Data | Wifi | Airplane Mode
|
148
|
+
# -------------------------------------------------
|
149
|
+
# 1 (Airplane Mode) | 0 | 0 | 1
|
150
|
+
# 6 (All network on) | 1 | 1 | 0
|
151
|
+
# 4 (Data only) | 1 | 0 | 0
|
152
|
+
# 2 (Wifi only) | 0 | 1 | 0
|
153
|
+
# 0 (None) | 0 | 0 | 0
|
154
|
+
#
|
155
|
+
# @example
|
156
|
+
#
|
157
|
+
# @driver.set_network_connection 1
|
158
|
+
# @driver.network_connection_type = 1
|
159
|
+
#
|
160
|
+
|
161
|
+
# @!method get_performance_data_types
|
162
|
+
# Get the information type of the system state which is supported to read such as
|
163
|
+
# cpu, memory, network, battery via adb commands.
|
164
|
+
# https://github.com/appium/appium-base-driver/blob/be29aec2318316d12b5c3295e924a5ba8f09b0fb/lib/mjsonwp/routes.js#L300
|
165
|
+
#
|
166
|
+
# @example
|
167
|
+
#
|
168
|
+
# @driver.get_performance_data_types #=> ["cpuinfo", "batteryinfo", "networkinfo", "memoryinfo"]
|
169
|
+
#
|
170
|
+
|
171
|
+
# @!method get_performance_data(package_name:, data_type:, data_read_timeout: 1000)
|
172
|
+
# Get the resource usage information of the application.
|
173
|
+
# https://github.com/appium/appium-base-driver/blob/be29aec2318316d12b5c3295e924a5ba8f09b0fb/lib/mjsonwp/routes.js#L303
|
174
|
+
# @param [String] package_name: Package name
|
175
|
+
# @param [String] data_type: Data type get with `get_performance_data_types`
|
176
|
+
# @param [String] data_read_timeout: Command timeout. Default is 2.
|
177
|
+
#
|
178
|
+
# @example
|
179
|
+
#
|
180
|
+
# @driver.get_performance_data package_name: package_name, data_type: data_type, data_read_timeout: 2
|
181
|
+
#
|
182
|
+
|
183
|
+
# @!method start_recording_screen(remote_path: nil, user: nil, pass: nil, method: 'PUT', force_restart: nil, video_size: nil, time_limit: '180', bit_rate: '4000000')
|
184
|
+
# @param [String] remote_path: The path to the remote location, where the resulting video should be uploaded.
|
185
|
+
# The following protocols are supported: http/https, ftp.
|
186
|
+
# Null or empty string value (the default setting) means the content of resulting
|
187
|
+
# file should be encoded as Base64 and passed as the endpoint response value.
|
188
|
+
# An exception will be thrown if the generated media file is too big to
|
189
|
+
# fit into the available process memory.
|
190
|
+
# This option only has an effect if there is screen recording process in progress
|
191
|
+
# and `forceRestart` parameter is not set to `true`.
|
192
|
+
# @param [String] user: The name of the user for the remote authentication.
|
193
|
+
# @param [String] pass: The password for the remote authentication.
|
194
|
+
# @param [String] method: The http multipart upload method name. The 'PUT' one is used by default.
|
195
|
+
# @param [Boolean] force_restart: Whether to try to catch and upload/return the currently running screen recording
|
196
|
+
# (`false`, the default setting on server) or ignore the result of it
|
197
|
+
# and start a new recording immediately (`true`).
|
198
|
+
#
|
199
|
+
# @param [String] video_size: The format is widthxheight.
|
200
|
+
# The default value is the device's native display resolution (if supported),
|
201
|
+
# 1280x720 if not. For best results,
|
202
|
+
# use a size supported by your device's Advanced Video Coding (AVC) encoder.
|
203
|
+
# For example, "1280x720"
|
204
|
+
# @param [String] time_limit: Recording time. 180 seconds is by default.
|
205
|
+
# @param [String] bit_rate: The video bit rate for the video, in megabits per second.
|
206
|
+
# 4 Mbp/s(4000000) is by default for Android API level below 27. 20 Mb/s(20000000) for API level 27 and above.
|
207
|
+
# @param [Boolean] bug_report: Set it to `true` in order to display additional information on the video overlay,
|
208
|
+
# such as a timestamp, that is helpful in videos captured to illustrate bugs.
|
209
|
+
# This option is only supported since API level 27 (Android P).
|
210
|
+
#
|
211
|
+
# @example
|
212
|
+
#
|
213
|
+
# @driver.start_recording_screen
|
214
|
+
# @driver.start_recording_screen video_size: '1280x720', time_limit: '180', bit_rate: '5000000'
|
215
|
+
#
|
216
|
+
|
217
|
+
# @!method get_clipboard(content_type: :plaintext)
|
218
|
+
# Set the content of device's clipboard.
|
219
|
+
# @param [String] content_type: one of supported content types.
|
220
|
+
# @return [String]
|
221
|
+
#
|
222
|
+
# @example
|
223
|
+
#
|
224
|
+
# @driver.get_clipboard #=> "happy testing"
|
225
|
+
#
|
226
|
+
|
227
|
+
# @!method set_clipboard(content:, content_type: :plaintext, label: nil)
|
228
|
+
# Set the content of device's clipboard.
|
229
|
+
# @param [String] label: clipboard data label.
|
230
|
+
# @param [String] content_type: one of supported content types.
|
231
|
+
# @param [String] content: Contents to be set. (Will encode with base64-encoded inside this method)
|
232
|
+
#
|
233
|
+
# @example
|
234
|
+
#
|
235
|
+
# @driver.set_clipboard(content: 'happy testing') #=> {"protocol"=>"W3C"}
|
236
|
+
#
|
237
|
+
|
238
|
+
####
|
239
|
+
## class << self
|
240
|
+
####
|
241
|
+
|
242
|
+
# rubocop:enable Metrics/LineLength
|
243
|
+
|
244
|
+
class << self
|
245
|
+
def extended(_mod)
|
246
|
+
::Appium::Core::Device.extend_webdriver_with_forwardable
|
247
|
+
|
248
|
+
::Appium::Core::Device.add_endpoint_method(:open_notifications) do
|
249
|
+
def open_notifications
|
250
|
+
execute :open_notifications
|
251
|
+
end
|
308
252
|
end
|
309
|
-
end
|
310
253
|
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
raise 'app_package is required' unless app_package
|
316
|
-
app_activity = opts[:app_activity]
|
317
|
-
raise 'app_activity is required' unless app_activity
|
318
|
-
app_wait_package = opts.fetch(:app_wait_package, '')
|
319
|
-
app_wait_activity = opts.fetch(:app_wait_activity, '')
|
320
|
-
|
321
|
-
unknown_opts = opts.keys - %i(app_package app_activity app_wait_package app_wait_activity)
|
322
|
-
raise "Unknown options #{unknown_opts}" unless unknown_opts.empty?
|
323
|
-
|
324
|
-
execute :start_activity, {}, appPackage: app_package,
|
325
|
-
appActivity: app_activity,
|
326
|
-
appWaitPackage: app_wait_package,
|
327
|
-
appWaitActivity: app_wait_activity
|
254
|
+
::Appium::Core::Device.add_endpoint_method(:current_activity) do
|
255
|
+
def current_activity
|
256
|
+
execute :current_activity
|
257
|
+
end
|
328
258
|
end
|
329
|
-
end
|
330
|
-
|
331
|
-
# Android, Override
|
332
|
-
Appium::Core::Device.add_endpoint_method(:hide_keyboard) do
|
333
|
-
def hide_keyboard(close_key = nil, strategy = nil)
|
334
|
-
option = {}
|
335
|
-
|
336
|
-
option[:key] = close_key if close_key
|
337
|
-
option[:strategy] = strategy || :tapOutside # default to pressKey
|
338
259
|
|
339
|
-
|
260
|
+
::Appium::Core::Device.add_endpoint_method(:current_package) do
|
261
|
+
def current_package
|
262
|
+
execute :current_package
|
263
|
+
end
|
340
264
|
end
|
341
|
-
end
|
342
265
|
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
266
|
+
::Appium::Core::Device.add_endpoint_method(:get_system_bars) do
|
267
|
+
def get_system_bars
|
268
|
+
execute :get_system_bars
|
269
|
+
end
|
347
270
|
end
|
348
|
-
end
|
349
271
|
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
# raise ArgumentError, 'Invalid connection type' unless type_to_values.keys.include? mode
|
355
|
-
# type = connection_type[mode]
|
356
|
-
# execute :set_network_connection, {}, type: type
|
357
|
-
execute :set_network_connection, {}, type: mode
|
272
|
+
::Appium::Core::Device.add_endpoint_method(:toggle_location_services) do
|
273
|
+
def toggle_location_services
|
274
|
+
execute :toggle_location_services
|
275
|
+
end
|
358
276
|
end
|
359
|
-
end
|
360
277
|
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
278
|
+
::Appium::Core::Device.add_endpoint_method(:start_activity) do
|
279
|
+
def start_activity(opts)
|
280
|
+
raise 'opts must be a hash' unless opts.is_a? Hash
|
281
|
+
app_package = opts[:app_package]
|
282
|
+
raise 'app_package is required' unless app_package
|
283
|
+
app_activity = opts[:app_activity]
|
284
|
+
raise 'app_activity is required' unless app_activity
|
285
|
+
app_wait_package = opts.fetch(:app_wait_package, '')
|
286
|
+
app_wait_activity = opts.fetch(:app_wait_activity, '')
|
287
|
+
|
288
|
+
unknown_opts = opts.keys - %i(app_package app_activity app_wait_package app_wait_activity)
|
289
|
+
raise "Unknown options #{unknown_opts}" unless unknown_opts.empty?
|
290
|
+
|
291
|
+
execute :start_activity, {}, appPackage: app_package,
|
292
|
+
appActivity: app_activity,
|
293
|
+
appWaitPackage: app_wait_package,
|
294
|
+
appWaitActivity: app_wait_activity
|
295
|
+
end
|
365
296
|
end
|
366
|
-
end
|
367
|
-
|
368
|
-
add_screen_recording
|
369
|
-
add_clipboard
|
370
|
-
Emulator.emulator_commands
|
371
|
-
end
|
372
|
-
|
373
|
-
private
|
374
297
|
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
video_size: nil, time_limit: '180', bit_rate: nil, bug_report: nil)
|
380
|
-
option = ::Appium::Core::Device::ScreenRecord.new(
|
381
|
-
remote_path: remote_path, user: user, pass: pass, method: method, force_restart: force_restart
|
382
|
-
).upload_option
|
298
|
+
# Android, Override
|
299
|
+
::Appium::Core::Device.add_endpoint_method(:hide_keyboard) do
|
300
|
+
def hide_keyboard(close_key = nil, strategy = nil)
|
301
|
+
option = {}
|
383
302
|
|
384
|
-
|
385
|
-
|
386
|
-
option[:bitRate] = bit_rate unless bit_rate.nil?
|
303
|
+
option[:key] = close_key if close_key
|
304
|
+
option[:strategy] = strategy || :tapOutside # default to pressKey
|
387
305
|
|
388
|
-
|
389
|
-
raise 'bug_report should be true or false' unless [true, false].member?(bug_report)
|
390
|
-
option[:bugReport] = bug_report
|
306
|
+
execute :hide_keyboard, {}, option
|
391
307
|
end
|
392
|
-
|
393
|
-
execute(:start_recording_screen, {}, { options: option })
|
394
308
|
end
|
395
|
-
# rubocop:enable Metrics/ParameterLists
|
396
|
-
end
|
397
|
-
end
|
398
309
|
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
raise "content_type should be #{::Appium::Core::Device::Clipboard::CONTENT_TYPE}"
|
310
|
+
# TODO: TEST ME
|
311
|
+
::Appium::Core::Device.add_endpoint_method(:end_coverage) do
|
312
|
+
def end_coverage(path, intent)
|
313
|
+
execute :end_coverage, {}, path: path, intent: intent
|
404
314
|
end
|
405
|
-
|
406
|
-
params = { contentType: content_type }
|
407
|
-
|
408
|
-
data = execute(:get_clipboard, {}, params)
|
409
|
-
Base64.decode64 data
|
410
315
|
end
|
411
|
-
end
|
412
316
|
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
params = {
|
420
|
-
contentType: content_type,
|
421
|
-
content: Base64.encode64(content)
|
422
|
-
}
|
423
|
-
params[:label] = label unless label.nil?
|
424
|
-
|
425
|
-
execute(:set_clipboard, {}, params)
|
426
|
-
end
|
317
|
+
Screen.add_methods
|
318
|
+
Performance.add_methods
|
319
|
+
Network.add_methods
|
320
|
+
Clipboard.add_methods
|
321
|
+
Emulator.add_methods
|
427
322
|
end
|
428
323
|
end
|
429
|
-
end
|
430
|
-
end # module
|
431
|
-
end
|
324
|
+
end # module Device
|
325
|
+
end # module Android
|
326
|
+
end
|
432
327
|
end # module Appium
|