appium-uiautomator2-driver 2.29.11 → 2.30.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.
- package/CHANGELOG.md +7 -0
- package/build/index.d.ts +4 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +8 -15
- package/build/index.js.map +1 -0
- package/build/lib/commands/actions.d.ts +2 -0
- package/build/lib/commands/actions.d.ts.map +1 -0
- package/build/lib/commands/actions.js +67 -62
- package/build/lib/commands/actions.js.map +1 -1
- package/build/lib/commands/alert.d.ts +2 -0
- package/build/lib/commands/alert.d.ts.map +1 -0
- package/build/lib/commands/alert.js +28 -26
- package/build/lib/commands/alert.js.map +1 -1
- package/build/lib/commands/app-strings.d.ts +3 -0
- package/build/lib/commands/app-strings.d.ts.map +1 -0
- package/build/lib/commands/app-strings.js +86 -57
- package/build/lib/commands/app-strings.js.map +1 -1
- package/build/lib/commands/battery.d.ts +2 -0
- package/build/lib/commands/battery.d.ts.map +1 -0
- package/build/lib/commands/battery.js +26 -16
- package/build/lib/commands/battery.js.map +1 -1
- package/build/lib/commands/element.d.ts +2 -0
- package/build/lib/commands/element.d.ts.map +1 -0
- package/build/lib/commands/element.js +140 -159
- package/build/lib/commands/element.js.map +1 -1
- package/build/lib/commands/find.d.ts +2 -0
- package/build/lib/commands/find.d.ts.map +1 -0
- package/build/lib/commands/find.js +39 -25
- package/build/lib/commands/find.js.map +1 -1
- package/build/lib/commands/general.d.ts +4 -0
- package/build/lib/commands/general.d.ts.map +1 -0
- package/build/lib/commands/general.js +217 -215
- package/build/lib/commands/general.js.map +1 -1
- package/build/lib/commands/gestures.d.ts +2 -0
- package/build/lib/commands/gestures.d.ts.map +1 -0
- package/build/lib/commands/gestures.js +206 -193
- package/build/lib/commands/gestures.js.map +1 -1
- package/build/lib/commands/index.d.ts +2 -0
- package/build/lib/commands/index.d.ts.map +1 -0
- package/build/lib/commands/index.js +13 -22
- package/build/lib/commands/index.js.map +1 -1
- package/build/lib/commands/mixins.d.ts +84 -0
- package/build/lib/commands/mixins.d.ts.map +1 -0
- package/build/lib/commands/mixins.js +23 -0
- package/build/lib/commands/mixins.js.map +1 -0
- package/build/lib/commands/screenshot.d.ts +2 -0
- package/build/lib/commands/screenshot.d.ts.map +1 -0
- package/build/lib/commands/screenshot.js +77 -62
- package/build/lib/commands/screenshot.js.map +1 -1
- package/build/lib/commands/touch.d.ts +2 -0
- package/build/lib/commands/touch.d.ts.map +1 -0
- package/build/lib/commands/touch.js +48 -38
- package/build/lib/commands/touch.js.map +1 -1
- package/build/lib/commands/types.d.ts +452 -0
- package/build/lib/commands/types.d.ts.map +1 -0
- package/build/lib/commands/types.js +3 -0
- package/build/lib/commands/types.js.map +1 -0
- package/build/lib/commands/viewport.d.ts +2 -0
- package/build/lib/commands/viewport.d.ts.map +1 -0
- package/build/lib/commands/viewport.js +37 -35
- package/build/lib/commands/viewport.js.map +1 -1
- package/build/lib/constraints.d.ts +334 -0
- package/build/lib/constraints.d.ts.map +1 -0
- package/build/lib/constraints.js +51 -0
- package/build/lib/constraints.js.map +1 -0
- package/build/lib/css-converter.d.ts +45 -0
- package/build/lib/css-converter.d.ts.map +1 -0
- package/build/lib/css-converter.js +272 -175
- package/build/lib/css-converter.js.map +1 -1
- package/build/lib/driver.d.ts +912 -0
- package/build/lib/driver.d.ts.map +1 -0
- package/build/lib/driver.js +738 -482
- package/build/lib/driver.js.map +1 -1
- package/build/lib/execute-method-map.d.ts +477 -0
- package/build/lib/execute-method-map.d.ts.map +1 -0
- package/build/lib/execute-method-map.js +542 -0
- package/build/lib/execute-method-map.js.map +1 -0
- package/build/lib/extensions.d.ts +3 -0
- package/build/lib/extensions.d.ts.map +1 -0
- package/build/lib/extensions.js +7 -9
- package/build/lib/extensions.js.map +1 -1
- package/build/lib/helpers.d.ts +7 -0
- package/build/lib/helpers.d.ts.map +1 -0
- package/build/lib/helpers.js +36 -29
- package/build/lib/helpers.js.map +1 -1
- package/build/lib/logger.d.ts +3 -0
- package/build/lib/logger.d.ts.map +1 -0
- package/build/lib/logger.js +5 -10
- package/build/lib/logger.js.map +1 -1
- package/build/lib/method-map.d.ts +389 -0
- package/build/lib/method-map.d.ts.map +1 -0
- package/build/lib/method-map.js +11 -17
- package/build/lib/method-map.js.map +1 -1
- package/build/lib/types.d.ts +45 -0
- package/build/lib/types.d.ts.map +1 -0
- package/build/lib/types.js +3 -0
- package/build/lib/types.js.map +1 -0
- package/build/lib/uiautomator2.d.ts +45 -0
- package/build/lib/uiautomator2.d.ts.map +1 -0
- package/build/lib/uiautomator2.js +340 -299
- package/build/lib/uiautomator2.js.map +1 -1
- package/build/lib/utils.d.ts +10 -0
- package/build/lib/utils.d.ts.map +1 -0
- package/build/lib/utils.js +23 -16
- package/build/lib/utils.js.map +1 -1
- package/build/tsconfig.tsbuildinfo +1 -0
- package/index.js +5 -3
- package/lib/commands/actions.js +115 -101
- package/lib/commands/alert.js +36 -44
- package/lib/commands/app-strings.js +79 -58
- package/lib/commands/battery.js +27 -28
- package/lib/commands/element.js +231 -134
- package/lib/commands/find.js +40 -21
- package/lib/commands/general.js +271 -336
- package/lib/commands/gestures.js +252 -366
- package/lib/commands/index.js +11 -31
- package/lib/commands/mixins.ts +167 -0
- package/lib/commands/screenshot.js +80 -76
- package/lib/commands/touch.js +64 -31
- package/lib/commands/types.ts +473 -0
- package/lib/commands/viewport.js +43 -31
- package/lib/constraints.ts +53 -0
- package/lib/css-converter.js +9 -1
- package/lib/{driver.js → driver.ts} +383 -225
- package/lib/execute-method-map.ts +573 -0
- package/lib/method-map.ts +11 -0
- package/lib/types.ts +59 -0
- package/lib/uiautomator2.js +21 -2
- package/lib/utils.js +2 -2
- package/npm-shrinkwrap.json +363 -492
- package/package.json +95 -69
- package/build/lib/desired-caps.js +0 -71
- package/build/lib/desired-caps.js.map +0 -1
- package/lib/desired-caps.js +0 -70
- package/lib/method-map.js +0 -11
|
@@ -0,0 +1,573 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @privateRemarks This was created by hand from the type definitions in `lib/commands` here and in `appium-android-driver`.
|
|
3
|
+
* @module
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export const executeMethodMap = {
|
|
7
|
+
'mobile: shell': {
|
|
8
|
+
command: 'mobileShell',
|
|
9
|
+
params: {
|
|
10
|
+
required: ['command'],
|
|
11
|
+
optional: ['args', 'timeout', 'includeStderr'],
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
'mobile: execEmuConsoleCommand': {
|
|
15
|
+
command: 'mobileExecEmuConsoleCommand',
|
|
16
|
+
params: {
|
|
17
|
+
required: ['command'],
|
|
18
|
+
optional: ['execTimeout', 'connTimeout', 'initTimeout'],
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
'mobile: dragGesture': {
|
|
22
|
+
command: 'mobileDragGesture',
|
|
23
|
+
params: {
|
|
24
|
+
optional: ['elementId', 'startX', 'startY', 'endX', 'endY', 'speed'],
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
'mobile: flingGesture': {
|
|
28
|
+
command: 'mobileFlingGesture',
|
|
29
|
+
params: {
|
|
30
|
+
required: ['direction'],
|
|
31
|
+
optional: ['elementId', 'left', 'top', 'width', 'height', 'speed'],
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
'mobile: doubleClickGesture': {
|
|
35
|
+
command: 'mobileDoubleClickGesture',
|
|
36
|
+
params: {
|
|
37
|
+
optional: ['elementId', 'x', 'y'],
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
'mobile: clickGesture': {
|
|
41
|
+
command: 'mobileClickGesture',
|
|
42
|
+
params: {
|
|
43
|
+
optional: ['elementId', 'x', 'y'],
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
'mobile: longClickGesture': {
|
|
47
|
+
command: 'mobileLongClickGesture',
|
|
48
|
+
params: {
|
|
49
|
+
optional: ['elementId', 'x', 'y', 'duration'],
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
'mobile: pinchCloseGesture': {
|
|
53
|
+
command: 'mobilePinchCloseGesture',
|
|
54
|
+
params: {
|
|
55
|
+
required: ['percent'],
|
|
56
|
+
optional: ['elementId', 'left', 'top', 'width', 'height', 'speed'],
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
'mobile: pinchOpenGesture': {
|
|
60
|
+
command: 'mobilePinchOpenGesture',
|
|
61
|
+
params: {
|
|
62
|
+
required: ['percent'],
|
|
63
|
+
optional: ['elementId', 'left', 'top', 'width', 'height', 'speed'],
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
'mobile: swipeGesture': {
|
|
67
|
+
command: 'mobileSwipeGesture',
|
|
68
|
+
params: {
|
|
69
|
+
required: ['direction', 'percent'],
|
|
70
|
+
optional: ['elementId', 'left', 'top', 'width', 'height', 'speed'],
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
'mobile: scrollGesture': {
|
|
74
|
+
command: 'mobileScrollGesture',
|
|
75
|
+
params: {
|
|
76
|
+
required: ['direction', 'percent'],
|
|
77
|
+
optional: ['elementId', 'left', 'top', 'width', 'height', 'speed'],
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
'mobile: scrollBackTo': {
|
|
81
|
+
command: 'mobileScrollBackTo',
|
|
82
|
+
params: {
|
|
83
|
+
required: ['elementId', 'elementToId'],
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
'mobile: scroll': {
|
|
87
|
+
command: 'mobileScroll',
|
|
88
|
+
params: {
|
|
89
|
+
required: ['strategy', 'selector'],
|
|
90
|
+
optional: ['elementId', 'maxSwipes', 'element'],
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
'mobile: viewportScreenshot': {
|
|
94
|
+
command: 'mobileViewportScreenshot',
|
|
95
|
+
},
|
|
96
|
+
'mobile: viewportRect': {
|
|
97
|
+
command: 'mobileViewPortRect',
|
|
98
|
+
},
|
|
99
|
+
|
|
100
|
+
'mobile: deepLink': {
|
|
101
|
+
command: 'mobileDeepLink',
|
|
102
|
+
params: {
|
|
103
|
+
required: ['url', 'package'],
|
|
104
|
+
optional: ['waitForLaunch'],
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
|
|
108
|
+
'mobile: startLogsBroadcast': {
|
|
109
|
+
command: 'mobileStartLogsBroadcast',
|
|
110
|
+
},
|
|
111
|
+
'mobile: stopLogsBroadcast': {
|
|
112
|
+
command: 'mobileStopLogsBroadcast',
|
|
113
|
+
},
|
|
114
|
+
|
|
115
|
+
'mobile: acceptAlert': {
|
|
116
|
+
command: 'mobileAcceptAlert',
|
|
117
|
+
params: {
|
|
118
|
+
optional: ['buttonLabel'],
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
'mobile: dismissAlert': {
|
|
122
|
+
command: 'mobileDismissAlert',
|
|
123
|
+
params: {
|
|
124
|
+
optional: ['buttonLabel'],
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
|
|
128
|
+
'mobile: batteryInfo': {
|
|
129
|
+
command: 'mobileGetBatteryInfo',
|
|
130
|
+
},
|
|
131
|
+
|
|
132
|
+
'mobile: deviceInfo': {
|
|
133
|
+
command: 'mobileGetDeviceInfo',
|
|
134
|
+
},
|
|
135
|
+
|
|
136
|
+
'mobile: getDeviceTime': {
|
|
137
|
+
command: 'mobileGetDeviceTime',
|
|
138
|
+
params: {
|
|
139
|
+
optional: ['format'],
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
|
|
143
|
+
'mobile: changePermissions': {
|
|
144
|
+
command: 'mobileChangePermissions',
|
|
145
|
+
params: {
|
|
146
|
+
required: ['permissions'],
|
|
147
|
+
optional: ['appPackage', 'action', 'target'],
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
'mobile: getPermissions': {
|
|
151
|
+
command: 'mobileGetPermissions',
|
|
152
|
+
params: {
|
|
153
|
+
optional: ['type', 'appPackage'],
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
|
|
157
|
+
'mobile: performEditorAction': {
|
|
158
|
+
command: 'mobilePerformEditorAction',
|
|
159
|
+
params: {
|
|
160
|
+
required: ['action'],
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
|
|
164
|
+
'mobile: startScreenStreaming': {
|
|
165
|
+
command: 'mobileStartScreenStreaming',
|
|
166
|
+
params: {
|
|
167
|
+
optional: [
|
|
168
|
+
'width',
|
|
169
|
+
'height',
|
|
170
|
+
'bitrate',
|
|
171
|
+
'host',
|
|
172
|
+
'pathname',
|
|
173
|
+
'tcpPort',
|
|
174
|
+
'port',
|
|
175
|
+
'quality',
|
|
176
|
+
'considerRotation',
|
|
177
|
+
'logPipelineDetails',
|
|
178
|
+
],
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
'mobile: stopScreenStreaming': {
|
|
182
|
+
command: 'mobileStopScreenStreaming',
|
|
183
|
+
},
|
|
184
|
+
|
|
185
|
+
'mobile: getNotifications': {
|
|
186
|
+
command: 'mobileGetNotifications',
|
|
187
|
+
},
|
|
188
|
+
'mobile: openNotifications': {
|
|
189
|
+
command: 'openNotifications',
|
|
190
|
+
},
|
|
191
|
+
|
|
192
|
+
'mobile: listSms': {
|
|
193
|
+
command: 'mobileListSms',
|
|
194
|
+
params: {
|
|
195
|
+
optional: ['max'],
|
|
196
|
+
},
|
|
197
|
+
},
|
|
198
|
+
|
|
199
|
+
'mobile: type': {
|
|
200
|
+
command: 'mobileType',
|
|
201
|
+
params: {
|
|
202
|
+
required: ['text'],
|
|
203
|
+
},
|
|
204
|
+
},
|
|
205
|
+
'mobile: replaceElementValue': {
|
|
206
|
+
command: 'mobileReplaceElementValue',
|
|
207
|
+
params: {
|
|
208
|
+
required: ['elementId', 'text'],
|
|
209
|
+
},
|
|
210
|
+
},
|
|
211
|
+
|
|
212
|
+
'mobile: pushFile': {
|
|
213
|
+
command: 'mobilePushFile',
|
|
214
|
+
params: {
|
|
215
|
+
required: ['payload', 'remotePath'],
|
|
216
|
+
},
|
|
217
|
+
},
|
|
218
|
+
'mobile: pullFile': {
|
|
219
|
+
command: 'mobilePullFile',
|
|
220
|
+
params: {
|
|
221
|
+
required: ['remotePath'],
|
|
222
|
+
},
|
|
223
|
+
},
|
|
224
|
+
'mobile: pullFolder': {
|
|
225
|
+
command: 'mobilePullFolder',
|
|
226
|
+
params: {
|
|
227
|
+
required: ['remotePath'],
|
|
228
|
+
},
|
|
229
|
+
},
|
|
230
|
+
'mobile: deleteFile': {
|
|
231
|
+
command: 'mobileDeleteFile',
|
|
232
|
+
params: {
|
|
233
|
+
required: ['remotePath'],
|
|
234
|
+
},
|
|
235
|
+
},
|
|
236
|
+
|
|
237
|
+
'mobile: isAppInstalled': {
|
|
238
|
+
command: 'mobileIsAppInstalled',
|
|
239
|
+
params: {
|
|
240
|
+
required: ['appId'],
|
|
241
|
+
},
|
|
242
|
+
},
|
|
243
|
+
'mobile: queryAppState': {
|
|
244
|
+
command: 'mobileQueryAppState',
|
|
245
|
+
params: {
|
|
246
|
+
required: ['appId'],
|
|
247
|
+
},
|
|
248
|
+
},
|
|
249
|
+
'mobile: activateApp': {
|
|
250
|
+
command: 'mobileActivateApp',
|
|
251
|
+
params: {
|
|
252
|
+
required: ['appId'],
|
|
253
|
+
},
|
|
254
|
+
},
|
|
255
|
+
'mobile: removeApp': {
|
|
256
|
+
command: 'mobileRemoveApp',
|
|
257
|
+
params: {
|
|
258
|
+
required: ['appId'],
|
|
259
|
+
optional: ['timeout', 'keepData'],
|
|
260
|
+
},
|
|
261
|
+
},
|
|
262
|
+
'mobile: terminateApp': {
|
|
263
|
+
command: 'mobileTerminateApp',
|
|
264
|
+
params: {
|
|
265
|
+
required: ['appId'],
|
|
266
|
+
optional: ['timeout'],
|
|
267
|
+
},
|
|
268
|
+
},
|
|
269
|
+
'mobile: installApp': {
|
|
270
|
+
command: 'mobileInstallApp',
|
|
271
|
+
params: {
|
|
272
|
+
required: ['appPath'],
|
|
273
|
+
optional: ['timeout', 'keepData'],
|
|
274
|
+
},
|
|
275
|
+
},
|
|
276
|
+
'mobile: clearApp': {
|
|
277
|
+
command: 'mobileClearApp',
|
|
278
|
+
params: {
|
|
279
|
+
required: ['appId'],
|
|
280
|
+
},
|
|
281
|
+
},
|
|
282
|
+
'mobile: backgroundApp': {
|
|
283
|
+
command: 'mobileBackgroundApp',
|
|
284
|
+
params: {
|
|
285
|
+
optional: ['seconds'],
|
|
286
|
+
},
|
|
287
|
+
},
|
|
288
|
+
'mobile: getCurrentActivity': {
|
|
289
|
+
command: 'getCurrentActivity',
|
|
290
|
+
},
|
|
291
|
+
'mobile: getCurrentPackage': {
|
|
292
|
+
command: 'getCurrentPackage',
|
|
293
|
+
},
|
|
294
|
+
|
|
295
|
+
'mobile: startActivity': {
|
|
296
|
+
command: 'mobileStartActivity',
|
|
297
|
+
params: {
|
|
298
|
+
optional: ['wait', 'stop', 'windowingMode', 'activityType', 'display'],
|
|
299
|
+
},
|
|
300
|
+
},
|
|
301
|
+
'mobile: startService': {
|
|
302
|
+
command: 'mobileStartService',
|
|
303
|
+
params: {
|
|
304
|
+
optional: [
|
|
305
|
+
'user',
|
|
306
|
+
'intent',
|
|
307
|
+
'action',
|
|
308
|
+
'package',
|
|
309
|
+
'uri',
|
|
310
|
+
'mimeType',
|
|
311
|
+
'identifier',
|
|
312
|
+
'component',
|
|
313
|
+
'categories',
|
|
314
|
+
'extras',
|
|
315
|
+
'flags',
|
|
316
|
+
'wait',
|
|
317
|
+
'stop',
|
|
318
|
+
'windowingMode',
|
|
319
|
+
'activityType',
|
|
320
|
+
'display',
|
|
321
|
+
],
|
|
322
|
+
},
|
|
323
|
+
},
|
|
324
|
+
'mobile: stopService': {
|
|
325
|
+
command: 'mobileStopService',
|
|
326
|
+
params: {
|
|
327
|
+
optional: [
|
|
328
|
+
'user',
|
|
329
|
+
'intent',
|
|
330
|
+
'action',
|
|
331
|
+
'package',
|
|
332
|
+
'uri',
|
|
333
|
+
'mimeType',
|
|
334
|
+
'identifier',
|
|
335
|
+
'component',
|
|
336
|
+
'categories',
|
|
337
|
+
'extras',
|
|
338
|
+
'flags',
|
|
339
|
+
],
|
|
340
|
+
},
|
|
341
|
+
},
|
|
342
|
+
'mobile: broadcast': {
|
|
343
|
+
command: 'mobileBroadcast',
|
|
344
|
+
params: {
|
|
345
|
+
optional: [
|
|
346
|
+
'user',
|
|
347
|
+
'intent',
|
|
348
|
+
'action',
|
|
349
|
+
'package',
|
|
350
|
+
'uri',
|
|
351
|
+
'mimeType',
|
|
352
|
+
'identifier',
|
|
353
|
+
'component',
|
|
354
|
+
'categories',
|
|
355
|
+
'extras',
|
|
356
|
+
'flags',
|
|
357
|
+
'receiverPermission',
|
|
358
|
+
'allowBackgroundActivityStarts',
|
|
359
|
+
],
|
|
360
|
+
},
|
|
361
|
+
},
|
|
362
|
+
|
|
363
|
+
'mobile: getContexts': {
|
|
364
|
+
command: 'mobileGetContexts',
|
|
365
|
+
},
|
|
366
|
+
|
|
367
|
+
'mobile: getAppStrings': {
|
|
368
|
+
command: 'mobileGetAppStrings',
|
|
369
|
+
params: {
|
|
370
|
+
optional: ['language'],
|
|
371
|
+
},
|
|
372
|
+
},
|
|
373
|
+
|
|
374
|
+
'mobile: installMultipleApks': {
|
|
375
|
+
command: 'mobileInstallMultipleApks',
|
|
376
|
+
params: {
|
|
377
|
+
required: ['apks'],
|
|
378
|
+
optional: ['options'],
|
|
379
|
+
},
|
|
380
|
+
},
|
|
381
|
+
|
|
382
|
+
'mobile: lock': {
|
|
383
|
+
command: 'mobileLock',
|
|
384
|
+
params: {
|
|
385
|
+
optional: ['seconds'],
|
|
386
|
+
},
|
|
387
|
+
},
|
|
388
|
+
'mobile: unlock': {
|
|
389
|
+
command: 'mobileUnlock',
|
|
390
|
+
params: {
|
|
391
|
+
optional: ['key', 'type', 'strategy', 'timeoutMs'],
|
|
392
|
+
},
|
|
393
|
+
},
|
|
394
|
+
'mobile: isLocked': {
|
|
395
|
+
command: 'isLocked',
|
|
396
|
+
},
|
|
397
|
+
|
|
398
|
+
'mobile: refreshGpsCache': {
|
|
399
|
+
command: 'mobileRefreshGpsCache',
|
|
400
|
+
params: {
|
|
401
|
+
optional: ['timeoutMs'],
|
|
402
|
+
},
|
|
403
|
+
},
|
|
404
|
+
|
|
405
|
+
'mobile: startMediaProjectionRecording': {
|
|
406
|
+
command: 'mobileStartMediaProjectionRecording',
|
|
407
|
+
params: {
|
|
408
|
+
optional: ['resolution', 'maxDurationSec', 'priority', 'filename'],
|
|
409
|
+
},
|
|
410
|
+
},
|
|
411
|
+
'mobile: isMediaProjectionRecordingRunning': {
|
|
412
|
+
command: 'mobileIsMediaProjectionRecordingRunning',
|
|
413
|
+
},
|
|
414
|
+
'mobile: stopMediaProjectionRecording': {
|
|
415
|
+
command: 'mobileStopMediaProjectionRecording',
|
|
416
|
+
params: {
|
|
417
|
+
optional: [
|
|
418
|
+
'remotePath',
|
|
419
|
+
'user',
|
|
420
|
+
'pass',
|
|
421
|
+
'method',
|
|
422
|
+
'headers',
|
|
423
|
+
'fileFieldName',
|
|
424
|
+
'formFields',
|
|
425
|
+
'uploadTimeout',
|
|
426
|
+
],
|
|
427
|
+
},
|
|
428
|
+
},
|
|
429
|
+
|
|
430
|
+
'mobile: getConnectivity': {
|
|
431
|
+
command: 'mobileGetConnectivity',
|
|
432
|
+
params: {
|
|
433
|
+
optional: ['services'],
|
|
434
|
+
},
|
|
435
|
+
},
|
|
436
|
+
'mobile: setConnectivity': {
|
|
437
|
+
command: 'mobileSetConnectivity',
|
|
438
|
+
params: {
|
|
439
|
+
optional: ['wifi', 'data', 'airplaneMode'],
|
|
440
|
+
},
|
|
441
|
+
},
|
|
442
|
+
'mobile: toggleGps': {
|
|
443
|
+
command: 'toggleLocationServices',
|
|
444
|
+
},
|
|
445
|
+
'mobile: isGpsEnabled': {
|
|
446
|
+
command: 'isLocationServicesEnabled',
|
|
447
|
+
},
|
|
448
|
+
|
|
449
|
+
'mobile: hideKeyboard': {
|
|
450
|
+
command: 'hideKeyboard',
|
|
451
|
+
},
|
|
452
|
+
'mobile: isKeyboardShown': {
|
|
453
|
+
command: 'isKeyboardShown',
|
|
454
|
+
},
|
|
455
|
+
|
|
456
|
+
'mobile: pressKey': {
|
|
457
|
+
command: 'mobilePressKey',
|
|
458
|
+
params: {
|
|
459
|
+
required: ['keycode'],
|
|
460
|
+
optional: ['metastate', 'flags', 'isLongPress'],
|
|
461
|
+
},
|
|
462
|
+
},
|
|
463
|
+
|
|
464
|
+
'mobile: getDisplayDensity': {
|
|
465
|
+
command: 'getDisplayDensity',
|
|
466
|
+
},
|
|
467
|
+
'mobile: getSystemBars': {
|
|
468
|
+
command: 'getSystemBars',
|
|
469
|
+
},
|
|
470
|
+
|
|
471
|
+
'mobile: fingerprint': {
|
|
472
|
+
command: 'mobileFingerprint',
|
|
473
|
+
params: {
|
|
474
|
+
required: ['fingerprintId'],
|
|
475
|
+
},
|
|
476
|
+
},
|
|
477
|
+
'mobile: sendSms': {
|
|
478
|
+
command: 'mobileSendSms',
|
|
479
|
+
params: {
|
|
480
|
+
required: ['phoneNumber', 'message'],
|
|
481
|
+
},
|
|
482
|
+
},
|
|
483
|
+
'mobile: gsmCall': {
|
|
484
|
+
command: 'mobileGsmCall',
|
|
485
|
+
params: {
|
|
486
|
+
required: ['phoneNumber', 'action'],
|
|
487
|
+
},
|
|
488
|
+
},
|
|
489
|
+
'mobile: gsmSignal': {
|
|
490
|
+
command: 'mobileGsmSignal',
|
|
491
|
+
params: {
|
|
492
|
+
required: ['strength'],
|
|
493
|
+
},
|
|
494
|
+
},
|
|
495
|
+
'mobile: gsmVoice': {
|
|
496
|
+
command: 'mobileGsmVoice',
|
|
497
|
+
params: {
|
|
498
|
+
required: ['state'],
|
|
499
|
+
},
|
|
500
|
+
},
|
|
501
|
+
'mobile: powerAc': {
|
|
502
|
+
command: 'mobilePowerAc',
|
|
503
|
+
params: {
|
|
504
|
+
required: ['state'],
|
|
505
|
+
},
|
|
506
|
+
},
|
|
507
|
+
'mobile: powerCapacity': {
|
|
508
|
+
command: 'mobilePowerCapacity',
|
|
509
|
+
params: {
|
|
510
|
+
required: ['percent'],
|
|
511
|
+
},
|
|
512
|
+
},
|
|
513
|
+
'mobile: networkSpeed': {
|
|
514
|
+
command: 'mobileNetworkSpeed',
|
|
515
|
+
params: {
|
|
516
|
+
required: ['speed'],
|
|
517
|
+
},
|
|
518
|
+
},
|
|
519
|
+
'mobile: sensorSet': {
|
|
520
|
+
command: 'sensorSet',
|
|
521
|
+
params: {
|
|
522
|
+
required: ['sensorType', 'value'],
|
|
523
|
+
},
|
|
524
|
+
},
|
|
525
|
+
|
|
526
|
+
'mobile: getPerformanceData': {
|
|
527
|
+
command: 'mobileGetPerformanceData',
|
|
528
|
+
params: {
|
|
529
|
+
required: ['packageName', 'dataType'],
|
|
530
|
+
},
|
|
531
|
+
},
|
|
532
|
+
'mobile: getPerformanceDataTypes': {
|
|
533
|
+
command: 'getPerformanceDataTypes',
|
|
534
|
+
},
|
|
535
|
+
|
|
536
|
+
'mobile: statusBar': {
|
|
537
|
+
command: 'mobilePerformStatusBarCommand',
|
|
538
|
+
params: {
|
|
539
|
+
required: ['command'],
|
|
540
|
+
optional: ['component'],
|
|
541
|
+
},
|
|
542
|
+
},
|
|
543
|
+
|
|
544
|
+
'mobile: screenshots': {
|
|
545
|
+
command: 'mobileScreenshots',
|
|
546
|
+
params: {
|
|
547
|
+
optional: ['displayId'],
|
|
548
|
+
},
|
|
549
|
+
},
|
|
550
|
+
|
|
551
|
+
'mobile: scheduleAction': {
|
|
552
|
+
command: 'mobileScheduleAction',
|
|
553
|
+
params: {
|
|
554
|
+
optional: ['opts'],
|
|
555
|
+
},
|
|
556
|
+
},
|
|
557
|
+
|
|
558
|
+
'mobile: getActionHistory': {
|
|
559
|
+
command: 'mobileGetActionHistory',
|
|
560
|
+
params: {
|
|
561
|
+
optional: ['opts'],
|
|
562
|
+
},
|
|
563
|
+
},
|
|
564
|
+
|
|
565
|
+
'mobile: unscheduleAction': {
|
|
566
|
+
command: 'mobileUnscheduleAction',
|
|
567
|
+
params: {
|
|
568
|
+
optional: ['opts'],
|
|
569
|
+
},
|
|
570
|
+
},
|
|
571
|
+
} as const;
|
|
572
|
+
|
|
573
|
+
export type Uiautomator2ExecuteMethodMap = typeof executeMethodMap;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import {AndroidDriver} from 'appium-android-driver';
|
|
2
|
+
|
|
3
|
+
export const newMethodMap = {
|
|
4
|
+
...AndroidDriver.newMethodMap,
|
|
5
|
+
'/session/:sessionId/appium/device/get_clipboard': {
|
|
6
|
+
POST: {
|
|
7
|
+
command: 'getClipboard',
|
|
8
|
+
payloadParams: {optional: ['contentType']},
|
|
9
|
+
},
|
|
10
|
+
},
|
|
11
|
+
} as const;
|
package/lib/types.ts
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type {DriverCaps, DriverOpts, W3CDriverCaps} from '@appium/types';
|
|
2
|
+
import type {AndroidSettings} from 'appium-android-driver';
|
|
3
|
+
import type {EmptyObject} from 'type-fest';
|
|
4
|
+
import type {RelativeRect} from './commands/types';
|
|
5
|
+
import type {Uiautomator2Constraints} from './constraints';
|
|
6
|
+
|
|
7
|
+
export type Uiautomator2DriverOpts = DriverOpts<Uiautomator2Constraints>;
|
|
8
|
+
|
|
9
|
+
export type Uiautomator2DriverCaps = DriverCaps<Uiautomator2Constraints>;
|
|
10
|
+
|
|
11
|
+
export type W3CUiautomator2DriverCaps = W3CDriverCaps<Uiautomator2Constraints>;
|
|
12
|
+
|
|
13
|
+
export interface Uiautomator2DeviceInfo {
|
|
14
|
+
deviceApiLevel: number;
|
|
15
|
+
deviceScreenSize: string;
|
|
16
|
+
deviceScreenDensity: string;
|
|
17
|
+
deviceModel: string;
|
|
18
|
+
deviceManufacturer: string;
|
|
19
|
+
platformVersion: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface Uiautomator2SessionInfo {
|
|
23
|
+
deviceName: string;
|
|
24
|
+
deviceUDID: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface Uiautomator2DeviceDetails {
|
|
28
|
+
pixelRatio: string;
|
|
29
|
+
statBarHeight: number;
|
|
30
|
+
viewportRect: RelativeRect;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface Uiautomator2ServerInfo {
|
|
34
|
+
platform: 'LINUX';
|
|
35
|
+
webStorageEnabled: false;
|
|
36
|
+
takesScreenshot: true;
|
|
37
|
+
javascriptEnabled: true;
|
|
38
|
+
databaseEnabled: false;
|
|
39
|
+
networkConnectionEnabled: true;
|
|
40
|
+
locationContextEnabled: false;
|
|
41
|
+
warnings: EmptyObject;
|
|
42
|
+
desired: Uiautomator2DriverCaps;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface Uiautomator2StartSessionOpts
|
|
46
|
+
extends Uiautomator2DriverCaps,
|
|
47
|
+
Uiautomator2ServerInfo {}
|
|
48
|
+
|
|
49
|
+
export interface Uiautomator2SessionCaps
|
|
50
|
+
extends Uiautomator2ServerInfo,
|
|
51
|
+
Uiautomator2SessionInfo,
|
|
52
|
+
Uiautomator2DeviceInfo,
|
|
53
|
+
Uiautomator2DeviceDetails {}
|
|
54
|
+
|
|
55
|
+
export type Uiautomator2CreateResult = [string, Uiautomator2SessionCaps];
|
|
56
|
+
|
|
57
|
+
export interface Uiautomator2Settings extends AndroidSettings {
|
|
58
|
+
allowInvisibleElements: boolean;
|
|
59
|
+
}
|
package/lib/uiautomator2.js
CHANGED
|
@@ -24,6 +24,9 @@ const INSTRUMENTATION_TARGET = `${SERVER_TEST_PACKAGE_ID}/androidx.test.runner.A
|
|
|
24
24
|
const instrumentationLogger = logger.getLogger('Instrumentation');
|
|
25
25
|
|
|
26
26
|
class UIA2Proxy extends JWProxy {
|
|
27
|
+
/** @type {boolean} */
|
|
28
|
+
didInstrumentationExit;
|
|
29
|
+
|
|
27
30
|
async proxyCommand (url, method, body = null) {
|
|
28
31
|
if (this.didInstrumentationExit) {
|
|
29
32
|
throw new errors.InvalidContextError(
|
|
@@ -36,6 +39,21 @@ class UIA2Proxy extends JWProxy {
|
|
|
36
39
|
}
|
|
37
40
|
|
|
38
41
|
class UiAutomator2Server {
|
|
42
|
+
/** @type {string} */
|
|
43
|
+
host;
|
|
44
|
+
|
|
45
|
+
/** @type {number} */
|
|
46
|
+
systemPort;
|
|
47
|
+
|
|
48
|
+
/** @type {import('appium-adb').ADB} */
|
|
49
|
+
adb;
|
|
50
|
+
|
|
51
|
+
/** @type {boolean} */
|
|
52
|
+
disableWindowAnimation;
|
|
53
|
+
|
|
54
|
+
/** @type {boolean|undefined} */
|
|
55
|
+
disableSuppressAccessibilityService;
|
|
56
|
+
|
|
39
57
|
constructor (log, opts = {}) {
|
|
40
58
|
for (let req of REQD_PARAMS) {
|
|
41
59
|
if (!opts || !util.hasValue(opts[req])) {
|
|
@@ -192,6 +210,7 @@ class UiAutomator2Server {
|
|
|
192
210
|
intervalMs: 1000,
|
|
193
211
|
});
|
|
194
212
|
} catch (err) {
|
|
213
|
+
// @ts-ignore It is ok if the attribute does not exist
|
|
195
214
|
this.log.error(`Unable to find instrumentation target '${INSTRUMENTATION_TARGET}': ${(pmError || {}).message}`);
|
|
196
215
|
if (pmOutput) {
|
|
197
216
|
this.log.debug('Available targets:');
|
|
@@ -271,10 +290,10 @@ class UiAutomator2Server {
|
|
|
271
290
|
cmd.push('--no-window-animation');
|
|
272
291
|
}
|
|
273
292
|
if (_.isBoolean(this.disableSuppressAccessibilityService)) {
|
|
274
|
-
cmd.push('-e', 'DISABLE_SUPPRESS_ACCESSIBILITY_SERVICES', this.disableSuppressAccessibilityService);
|
|
293
|
+
cmd.push('-e', 'DISABLE_SUPPRESS_ACCESSIBILITY_SERVICES', `${this.disableSuppressAccessibilityService}`);
|
|
275
294
|
}
|
|
276
295
|
// Disable Google analytics to prevent possible fatal exception
|
|
277
|
-
cmd.push('-e', 'disableAnalytics', true);
|
|
296
|
+
cmd.push('-e', 'disableAnalytics', 'true');
|
|
278
297
|
cmd.push(INSTRUMENTATION_TARGET);
|
|
279
298
|
const instrumentationProcess = this.adb.createSubProcess(['shell', ...cmd]);
|
|
280
299
|
instrumentationProcess.on('output', (stdout, stderr) => {
|
package/lib/utils.js
CHANGED
|
@@ -4,12 +4,12 @@ import { errors } from 'appium/driver';
|
|
|
4
4
|
/**
|
|
5
5
|
* Assert the presence of particular keys in the given object
|
|
6
6
|
*
|
|
7
|
-
* @template {
|
|
7
|
+
* @template {Record<string, any>} T
|
|
8
8
|
* @param {string|string[]} argNames one or more key names
|
|
9
9
|
* @param {T} opts the object to check
|
|
10
10
|
* @returns {T} the same given object
|
|
11
11
|
*/
|
|
12
|
-
export function requireArgs (argNames, opts
|
|
12
|
+
export function requireArgs (argNames, opts) {
|
|
13
13
|
for (const argName of (_.isArray(argNames) ? argNames : [argNames])) {
|
|
14
14
|
if (!_.has(opts, argName)) {
|
|
15
15
|
throw new errors.InvalidArgumentError(`'${argName}' argument must be provided`);
|