appium-android-driver 5.14.7 → 6.0.1

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.
Files changed (210) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/build/lib/commands/actions.d.ts +6 -224
  3. package/build/lib/commands/actions.d.ts.map +1 -1
  4. package/build/lib/commands/actions.js +306 -405
  5. package/build/lib/commands/actions.js.map +1 -1
  6. package/build/lib/commands/alert.d.ts +7 -9
  7. package/build/lib/commands/alert.d.ts.map +1 -1
  8. package/build/lib/commands/alert.js +24 -18
  9. package/build/lib/commands/alert.js.map +1 -1
  10. package/build/lib/commands/app-management.d.ts +7 -313
  11. package/build/lib/commands/app-management.d.ts.map +1 -1
  12. package/build/lib/commands/app-management.js +135 -293
  13. package/build/lib/commands/app-management.js.map +1 -1
  14. package/build/lib/commands/context.d.ts +8 -92
  15. package/build/lib/commands/context.d.ts.map +1 -1
  16. package/build/lib/commands/context.js +381 -439
  17. package/build/lib/commands/context.js.map +1 -1
  18. package/build/lib/commands/element.d.ts +8 -35
  19. package/build/lib/commands/element.d.ts.map +1 -1
  20. package/build/lib/commands/element.js +153 -136
  21. package/build/lib/commands/element.js.map +1 -1
  22. package/build/lib/commands/emu-console.d.ts +6 -48
  23. package/build/lib/commands/emu-console.d.ts.map +1 -1
  24. package/build/lib/commands/emu-console.js +19 -34
  25. package/build/lib/commands/emu-console.js.map +1 -1
  26. package/build/lib/commands/execute.d.ts +6 -5
  27. package/build/lib/commands/execute.d.ts.map +1 -1
  28. package/build/lib/commands/execute.js +77 -66
  29. package/build/lib/commands/execute.js.map +1 -1
  30. package/build/lib/commands/file-actions.d.ts +7 -128
  31. package/build/lib/commands/file-actions.d.ts.map +1 -1
  32. package/build/lib/commands/file-actions.js +183 -219
  33. package/build/lib/commands/file-actions.js.map +1 -1
  34. package/build/lib/commands/find.d.ts +8 -12
  35. package/build/lib/commands/find.d.ts.map +1 -1
  36. package/build/lib/commands/find.js +19 -23
  37. package/build/lib/commands/find.js.map +1 -1
  38. package/build/lib/commands/general.d.ts +9 -132
  39. package/build/lib/commands/general.d.ts.map +1 -1
  40. package/build/lib/commands/general.js +281 -312
  41. package/build/lib/commands/general.js.map +1 -1
  42. package/build/lib/commands/ime.d.ts +7 -10
  43. package/build/lib/commands/ime.d.ts.map +1 -1
  44. package/build/lib/commands/ime.js +47 -35
  45. package/build/lib/commands/ime.js.map +1 -1
  46. package/build/lib/commands/index.d.ts +27 -2
  47. package/build/lib/commands/index.d.ts.map +1 -1
  48. package/build/lib/commands/index.js +41 -19
  49. package/build/lib/commands/index.js.map +1 -1
  50. package/build/lib/commands/intent.d.ts +7 -417
  51. package/build/lib/commands/intent.d.ts.map +1 -1
  52. package/build/lib/commands/intent.js +104 -216
  53. package/build/lib/commands/intent.js.map +1 -1
  54. package/build/lib/commands/keyboard.d.ts +6 -5
  55. package/build/lib/commands/keyboard.d.ts.map +1 -1
  56. package/build/lib/commands/keyboard.js +16 -8
  57. package/build/lib/commands/keyboard.js.map +1 -1
  58. package/build/lib/commands/log.d.ts +7 -44
  59. package/build/lib/commands/log.d.ts.map +1 -1
  60. package/build/lib/commands/log.js +146 -108
  61. package/build/lib/commands/log.js.map +1 -1
  62. package/build/lib/commands/media-projection.d.ts +7 -143
  63. package/build/lib/commands/media-projection.d.ts.map +1 -1
  64. package/build/lib/commands/media-projection.js +113 -140
  65. package/build/lib/commands/media-projection.js.map +1 -1
  66. package/build/lib/commands/mixins.d.ts +740 -0
  67. package/build/lib/commands/mixins.d.ts.map +1 -0
  68. package/build/lib/commands/mixins.js +19 -0
  69. package/build/lib/commands/mixins.js.map +1 -0
  70. package/build/lib/commands/network.d.ts +7 -138
  71. package/build/lib/commands/network.d.ts.map +1 -1
  72. package/build/lib/commands/network.js +212 -254
  73. package/build/lib/commands/network.js.map +1 -1
  74. package/build/lib/commands/performance.d.ts +24 -70
  75. package/build/lib/commands/performance.d.ts.map +1 -1
  76. package/build/lib/commands/performance.js +144 -100
  77. package/build/lib/commands/performance.js.map +1 -1
  78. package/build/lib/commands/permissions.d.ts +8 -92
  79. package/build/lib/commands/permissions.d.ts.map +1 -1
  80. package/build/lib/commands/permissions.js +75 -87
  81. package/build/lib/commands/permissions.js.map +1 -1
  82. package/build/lib/commands/recordscreen.d.ts +7 -193
  83. package/build/lib/commands/recordscreen.d.ts.map +1 -1
  84. package/build/lib/commands/recordscreen.js +151 -182
  85. package/build/lib/commands/recordscreen.js.map +1 -1
  86. package/build/lib/commands/shell.d.ts +7 -7
  87. package/build/lib/commands/shell.d.ts.map +1 -1
  88. package/build/lib/commands/shell.js +40 -33
  89. package/build/lib/commands/shell.js.map +1 -1
  90. package/build/lib/commands/streamscreen.d.ts +9 -103
  91. package/build/lib/commands/streamscreen.d.ts.map +1 -1
  92. package/build/lib/commands/streamscreen.js +261 -218
  93. package/build/lib/commands/streamscreen.js.map +1 -1
  94. package/build/lib/commands/system-bars.d.ts +22 -90
  95. package/build/lib/commands/system-bars.d.ts.map +1 -1
  96. package/build/lib/commands/system-bars.js +76 -74
  97. package/build/lib/commands/system-bars.js.map +1 -1
  98. package/build/lib/commands/touch.d.ts +10 -29
  99. package/build/lib/commands/touch.d.ts.map +1 -1
  100. package/build/lib/commands/touch.js +301 -285
  101. package/build/lib/commands/touch.js.map +1 -1
  102. package/build/lib/commands/types.d.ts +978 -0
  103. package/build/lib/commands/types.d.ts.map +1 -0
  104. package/build/lib/commands/types.js +3 -0
  105. package/build/lib/commands/types.js.map +1 -0
  106. package/build/lib/constraints.d.ts +291 -0
  107. package/build/lib/constraints.d.ts.map +1 -0
  108. package/build/lib/{desired-caps.js → constraints.js} +103 -102
  109. package/build/lib/constraints.js.map +1 -0
  110. package/build/lib/driver.d.ts +68 -37
  111. package/build/lib/driver.d.ts.map +1 -1
  112. package/build/lib/driver.js +123 -80
  113. package/build/lib/driver.js.map +1 -1
  114. package/build/lib/helpers/android.d.ts +164 -0
  115. package/build/lib/helpers/android.d.ts.map +1 -0
  116. package/build/lib/helpers/android.js +819 -0
  117. package/build/lib/helpers/android.js.map +1 -0
  118. package/build/lib/helpers/index.d.ts +7 -0
  119. package/build/lib/helpers/index.d.ts.map +1 -0
  120. package/build/lib/helpers/index.js +29 -0
  121. package/build/lib/helpers/index.js.map +1 -0
  122. package/build/lib/helpers/types.d.ts +121 -0
  123. package/build/lib/helpers/types.d.ts.map +1 -0
  124. package/build/lib/helpers/types.js +3 -0
  125. package/build/lib/helpers/types.js.map +1 -0
  126. package/build/lib/helpers/unlock.d.ts +32 -0
  127. package/build/lib/helpers/unlock.d.ts.map +1 -0
  128. package/build/lib/helpers/unlock.js +273 -0
  129. package/build/lib/helpers/unlock.js.map +1 -0
  130. package/build/lib/helpers/webview.d.ts +74 -0
  131. package/build/lib/helpers/webview.d.ts.map +1 -0
  132. package/build/lib/helpers/webview.js +421 -0
  133. package/build/lib/helpers/webview.js.map +1 -0
  134. package/build/lib/index.d.ts +9 -0
  135. package/build/lib/index.d.ts.map +1 -0
  136. package/build/lib/index.js +37 -0
  137. package/build/lib/index.js.map +1 -0
  138. package/build/lib/method-map.d.ts +0 -8
  139. package/build/lib/method-map.d.ts.map +1 -1
  140. package/build/lib/method-map.js +63 -74
  141. package/build/lib/method-map.js.map +1 -1
  142. package/build/lib/stubs.d.ts +0 -1
  143. package/build/lib/stubs.d.ts.map +1 -1
  144. package/build/lib/stubs.js +1 -0
  145. package/build/lib/stubs.js.map +1 -1
  146. package/build/lib/utils.d.ts +1 -1
  147. package/build/lib/utils.d.ts.map +1 -1
  148. package/lib/commands/actions.js +351 -464
  149. package/lib/commands/alert.js +27 -17
  150. package/lib/commands/app-management.js +156 -314
  151. package/lib/commands/context.js +457 -441
  152. package/lib/commands/element.js +201 -157
  153. package/lib/commands/emu-console.js +25 -45
  154. package/lib/commands/execute.js +106 -90
  155. package/lib/commands/file-actions.js +222 -240
  156. package/lib/commands/find.ts +103 -0
  157. package/lib/commands/general.js +327 -339
  158. package/lib/commands/ime.js +50 -34
  159. package/lib/commands/{index.js → index.ts} +20 -24
  160. package/lib/commands/intent.js +108 -249
  161. package/lib/commands/keyboard.js +20 -8
  162. package/lib/commands/log.js +172 -116
  163. package/lib/commands/media-projection.js +134 -161
  164. package/lib/commands/mixins.ts +966 -0
  165. package/lib/commands/network.js +252 -281
  166. package/lib/commands/performance.js +203 -132
  167. package/lib/commands/permissions.js +108 -109
  168. package/lib/commands/recordscreen.js +212 -209
  169. package/lib/commands/shell.js +51 -40
  170. package/lib/commands/streamscreen.js +355 -289
  171. package/lib/commands/system-bars.js +92 -83
  172. package/lib/commands/touch.js +357 -294
  173. package/lib/commands/types.ts +1097 -0
  174. package/lib/{desired-caps.js → constraints.ts} +106 -103
  175. package/lib/{driver.js → driver.ts} +278 -132
  176. package/lib/helpers/android.ts +1143 -0
  177. package/lib/helpers/index.ts +6 -0
  178. package/lib/helpers/types.ts +134 -0
  179. package/lib/helpers/unlock.ts +329 -0
  180. package/lib/helpers/webview.ts +582 -0
  181. package/lib/index.ts +18 -0
  182. package/lib/method-map.js +87 -98
  183. package/lib/stubs.ts +0 -1
  184. package/package.json +26 -19
  185. package/build/index.js +0 -51
  186. package/build/lib/android-helpers.d.ts +0 -136
  187. package/build/lib/android-helpers.d.ts.map +0 -1
  188. package/build/lib/android-helpers.js +0 -855
  189. package/build/lib/android-helpers.js.map +0 -1
  190. package/build/lib/commands/coverage.d.ts +0 -5
  191. package/build/lib/commands/coverage.d.ts.map +0 -1
  192. package/build/lib/commands/coverage.js +0 -19
  193. package/build/lib/commands/coverage.js.map +0 -1
  194. package/build/lib/desired-caps.d.ts +0 -353
  195. package/build/lib/desired-caps.d.ts.map +0 -1
  196. package/build/lib/desired-caps.js.map +0 -1
  197. package/build/lib/unlock-helpers.d.ts +0 -38
  198. package/build/lib/unlock-helpers.d.ts.map +0 -1
  199. package/build/lib/unlock-helpers.js +0 -266
  200. package/build/lib/unlock-helpers.js.map +0 -1
  201. package/build/lib/webview-helpers.d.ts +0 -224
  202. package/build/lib/webview-helpers.d.ts.map +0 -1
  203. package/build/lib/webview-helpers.js +0 -528
  204. package/build/lib/webview-helpers.js.map +0 -1
  205. package/index.js +0 -24
  206. package/lib/android-helpers.js +0 -983
  207. package/lib/commands/coverage.js +0 -18
  208. package/lib/commands/find.js +0 -82
  209. package/lib/unlock-helpers.js +0 -278
  210. package/lib/webview-helpers.js +0 -602
@@ -0,0 +1,966 @@
1
+ import type {
2
+ AppiumLogger,
3
+ Element,
4
+ ExternalDriver,
5
+ LogDefRecord,
6
+ Orientation,
7
+ Position,
8
+ Rect,
9
+ Size,
10
+ StringRecord,
11
+ Location,
12
+ } from '@appium/types';
13
+ import type {
14
+ ADB,
15
+ InstallOptions,
16
+ LogcatListener,
17
+ SmsListResult,
18
+ UninstallOptions,
19
+ } from 'appium-adb';
20
+ import type Chromedriver from 'appium-chromedriver';
21
+ import {AndroidDriverOpts, AndroidDriver} from '../driver';
22
+ import type * as types from './types';
23
+
24
+ export interface ActionsMixin {
25
+ keyevent(keycode: string | number, metastate?: number): Promise<void>;
26
+ pressKeyCode(keycode: string | number, metastate?: number, flags?: any): Promise<void>;
27
+ longPressKeyCode(keycode: string | number, metastate?: number, flags?: any): Promise<void>;
28
+ getOrientation(): Promise<Orientation>;
29
+ setOrientation(orientation: Orientation): Promise<void>;
30
+ fakeFlick(xSpeed: number, ySpeed: number): Promise<void>;
31
+ fakeFlickElement(
32
+ elementId: string,
33
+ xoffset: number,
34
+ yoffset: number,
35
+ speed: number
36
+ ): Promise<void>;
37
+ swipe(
38
+ startX: number | 'null',
39
+ startY: number | 'null',
40
+ endX: number,
41
+ endY: number,
42
+ duration: number,
43
+ touchCount: number,
44
+ elId: string
45
+ ): Promise<void>;
46
+ doSwipe(opts: types.SwipeOpts): Promise<void>;
47
+ pinchClose(
48
+ startX: number,
49
+ startY: number,
50
+ endX: number,
51
+ endY: number,
52
+ duration: number,
53
+ percent: number,
54
+ steps: number,
55
+ elId: string
56
+ ): Promise<void>;
57
+ pinchOpen(
58
+ startX: number,
59
+ startY: number,
60
+ endX: number,
61
+ endY: number,
62
+ duration: number,
63
+ percent: number,
64
+ steps: number,
65
+ elId: string
66
+ ): Promise<void>;
67
+ flick(
68
+ element: string,
69
+ xSpeed: number,
70
+ ySpeed: number,
71
+ xOffset: number,
72
+ yOffset: number,
73
+ speed: number
74
+ ): Promise<void>;
75
+ drag(
76
+ startX: number,
77
+ startY: number,
78
+ endX: number,
79
+ endY: number,
80
+ duration: number,
81
+ touchCount: number,
82
+ elementId?: string | number,
83
+ destElId?: string | number
84
+ ): Promise<void>;
85
+ doDrag(opts: types.DragOpts): Promise<void>;
86
+ lock(seconds?: number): Promise<void>;
87
+ /**
88
+ * Lock the device (and optionally unlock it after a certain amount of time).
89
+ * @throws {Error} if lock or unlock operation fails
90
+ */
91
+ mobileLock(opts: types.LockOpts): Promise<void>;
92
+ unlock(): Promise<void>;
93
+ isLocked(): Promise<boolean>;
94
+ openNotifications(): Promise<void>;
95
+ setLocation(latitude: number, longitude: number): Promise<void>;
96
+ /**
97
+ * @group Emulator Only
98
+ */
99
+ fingerprint(fingerprintId: string | number): Promise<void>;
100
+ /**
101
+ * Emulate fingerprint on Android Emulator.
102
+ * Only works on API 23+
103
+ * @group Emulator Only
104
+ */
105
+ mobileFingerprint(opts: types.FingerprintOpts): Promise<void>;
106
+ /**
107
+ * @group Emulator Only
108
+ */
109
+ sendSMS(phoneNumber: string, message: string): Promise<void>;
110
+
111
+ /**
112
+ * Emulate sending an SMS to the given phone number.
113
+ * Only works on emulators.
114
+ *
115
+ * @group Emulator Only
116
+ */
117
+ mobileSendSms(opts: types.SendSMSOpts): Promise<void>;
118
+
119
+ /**
120
+ * @group Emulator Only
121
+ */
122
+ gsmCall(phoneNumber: string, action: string): Promise<void>;
123
+
124
+ /**
125
+ * Emulate a GSM call to the given phone number.
126
+ * Only works on emulators.
127
+ *
128
+ * @group Emulator Only
129
+ */
130
+ mobileGsmCall(opts: types.GsmCallOpts): Promise<void>;
131
+
132
+ /**
133
+ * @group Emulator Only
134
+ */
135
+ gsmSignal(signalStrength: types.GsmSignalStrength): Promise<void>;
136
+ /**
137
+ * Emulate GSM signal strength change event.
138
+ * Only works on emulators.
139
+ *
140
+ * @group Emulator Only
141
+ */
142
+ mobileGsmSignal(opts: types.GsmSignalStrengthOpts): Promise<void>;
143
+ /**
144
+ * @group Emulator Only
145
+ */
146
+ gsmVoice(state: types.GsmVoiceState): Promise<void>;
147
+
148
+ /**
149
+ * Emulate GSM voice state change event.
150
+ * Only works on emulators.
151
+ */
152
+ mobileGsmVoice(opts: types.GsmVoiceOpts): Promise<void>;
153
+ /**
154
+ * @group Emulator Only
155
+ */
156
+ powerAC(state: types.PowerACState): Promise<void>;
157
+ /**
158
+ * Emulate AC power state change.
159
+ * Only works on emulators.
160
+ *
161
+ * @group Emulator Only
162
+ */
163
+ mobilePowerAc(opts: types.PowerACOpts): Promise<void>;
164
+
165
+ /**
166
+ * @group Emulator Only
167
+ */
168
+ powerCapacity(percent: number): Promise<void>;
169
+
170
+ /**
171
+ * Emulate power capacity change.
172
+ * Only works on emulators.
173
+ *
174
+ * @group Emulator Only
175
+ */
176
+ mobilePowerCapacity(opts: types.PowerCapacityOpts): Promise<void>;
177
+
178
+ /**
179
+ * @group Emulator Only
180
+ */
181
+ networkSpeed(networkSpeed: types.NetworkSpeed): Promise<void>;
182
+
183
+ /**
184
+ * Emulate different network connection speed modes.
185
+ Only works on emulators.
186
+ *
187
+ * @group Emulator Only
188
+ */
189
+ mobileNetworkSpeed(opts: types.NetworkSpeedOpts): Promise<void>;
190
+
191
+ /**
192
+ * Emulate sensors values on the connected emulator.
193
+ * @group Emulator Only
194
+ * @throws {Error} - If sensorType is not defined
195
+ * @throws {Error} - If value for the sensor is not defined
196
+ * @throws {Error} - If deviceType is not an emulator
197
+ */
198
+ sensorSet(opts: types.SensorSetOpts): Promise<void>;
199
+
200
+ getScreenshotDataWithAdbShell(adb: ADB, opts: AndroidDriverOpts): Promise<Buffer>;
201
+
202
+ getScreenshotDataWithAdbExecOut(adb: ADB): Promise<Buffer>;
203
+
204
+ getScreenshot(): Promise<string>;
205
+ }
206
+
207
+ export type AlertMixin = Required<
208
+ Pick<ExternalDriver, 'getAlertText' | 'setAlertText' | 'postAcceptAlert' | 'postDismissAlert'>
209
+ >;
210
+
211
+ export interface AppManagementMixin {
212
+ /**
213
+ * Installs the given application to the device under test
214
+ * @throws {Error} if the given apk does not exist or is not reachable
215
+ */
216
+ installApp(appId: string, opts?: Omit<InstallOptions, 'appId'>): Promise<void>;
217
+ /**
218
+ * Terminates the app if it is running.
219
+ *
220
+ * If the given timeout was lower or equal to zero, it returns true after
221
+ * terminating the app without checking the app state.
222
+ * @throws {Error} if the app has not been terminated within the given timeout.
223
+ */
224
+ terminateApp(appId: string, opts?: Omit<types.TerminateAppOpts, 'appId'>): Promise<boolean>;
225
+ /**
226
+ * Remove the corresponding application if is installed.
227
+ *
228
+ * The call is ignored if the app is not installed.
229
+ *
230
+ * @returns `true` if the package was found on the device and
231
+ * successfully uninstalled.
232
+ */
233
+ removeApp(appId: string, opts: Omit<UninstallOptions, 'appId'>): Promise<boolean>;
234
+ /**
235
+ * Activates the given application or launches it if necessary.
236
+ *
237
+ * The action literally simulates clicking the corresponding application
238
+ * icon on the dashboard.
239
+ *
240
+ * @throws {Error} If the app cannot be activated
241
+ */
242
+ activateApp(appId: string): Promise<void>;
243
+ /**
244
+ * Queries the current state of the app.
245
+ * @returns The corresponding constant, which describes the current application state.
246
+ */
247
+ queryAppState(appId: string): Promise<types.AppState>;
248
+ /**
249
+ * Determine whether an app is installed
250
+ */
251
+ isAppInstalled(appId: string): Promise<boolean>;
252
+ /**
253
+ * Installs the given application to the device under test
254
+ * @throws {Error} if the given apk does not exist or is not reachable
255
+ */
256
+ mobileInstallApp(opts: types.InstallAppOpts): Promise<void>;
257
+ /**
258
+ * Terminates the app if it is running.
259
+ *
260
+ * If the given timeout was lower or equal to zero, it returns true after
261
+ * terminating the app without checking the app state.
262
+ * @throws {Error} if the app has not been terminated within the given timeout.
263
+ */
264
+ mobileTerminateApp(opts: types.TerminateAppOpts): Promise<boolean>;
265
+ /**
266
+ * Remove the corresponding application if is installed.
267
+ *
268
+ * The call is ignored if the app is not installed.
269
+ *
270
+ * @returns `true` if the package was found on the device and
271
+ * successfully uninstalled.
272
+ */
273
+ mobileRemoveApp(opts: types.RemoveAppOpts): Promise<boolean>;
274
+ /**
275
+ *
276
+ * Activates the given application or launches it if necessary.
277
+ *
278
+ * The action literally simulates clicking the corresponding application
279
+ * icon on the dashboard.
280
+ *
281
+ * @throws {Error} If the app cannot be activated
282
+ */
283
+ mobileActivateApp(opts: types.ActivateAppOpts): Promise<void>;
284
+ /**
285
+ * Queries the current state of the app.
286
+ * @returns The corresponding constant, which describes the current application state.
287
+ */
288
+ mobileQueryAppState(opts: types.QueryAppStateOpts): Promise<types.AppState>;
289
+ /**
290
+ * Determine whether an app is installed
291
+ */
292
+ mobileIsAppInstalled(opts: types.IsAppInstalledOpts): Promise<boolean>;
293
+ /**
294
+ * Deletes all data associated with a package.
295
+ *
296
+ * @throws {Error} If cleaning of the app data fails
297
+ */
298
+ mobileClearApp(opts: types.ClearAppOpts): Promise<void>;
299
+ }
300
+
301
+ export interface ContextMixin {
302
+ getCurrentContext(): Promise<string>;
303
+ getContexts(): Promise<string[]>;
304
+ setContext(name?: string): Promise<void>;
305
+ defaultContextName(): string;
306
+ defaultWebviewName(): string;
307
+ assignContexts(mappings: types.WebviewsMapping[]): string[];
308
+ /**
309
+ * Returns a webviewsMapping based on CDP endpoints
310
+ */
311
+ mobileGetContexts(): Promise<types.WebviewsMapping[]>;
312
+
313
+ switchContext(name: string, mappings: types.WebviewsMapping[]): Promise<void>;
314
+
315
+ isWebContext(): boolean;
316
+
317
+ startChromedriverProxy(context: string, mappings: types.WebviewsMapping[]): Promise<void>;
318
+ onChromedriverStop(context: string): Promise<void>;
319
+
320
+ isChromedriverContext(viewName: string): boolean;
321
+ shouldDismissChromeWelcome(): boolean;
322
+ dismissChromeWelcome(): Promise<void>;
323
+ startChromeSession(): Promise<void>;
324
+ /**
325
+ * @internal
326
+ */
327
+ setupExistingChromedriver(log: AppiumLogger, chromedriver: Chromedriver): Promise<Chromedriver>;
328
+ /**
329
+ * Find a free port to have Chromedriver listen on.
330
+ *
331
+ * @param portSpec - List of ports.
332
+ * @param log Logger instance
333
+ * @internal
334
+ * @returns free port
335
+ */
336
+ getChromedriverPort(portSpec?: types.PortSpec, log?: AppiumLogger): Promise<number>;
337
+
338
+ /**
339
+ * @internal
340
+ */
341
+ isChromedriverAutodownloadEnabled(): boolean;
342
+
343
+ /**
344
+ * @internal
345
+ * @param opts
346
+ * @param curDeviceId
347
+ * @param adb
348
+ * @param context
349
+ */
350
+ setupNewChromedriver(
351
+ opts: AndroidDriverOpts,
352
+ curDeviceId: string,
353
+ adb: ADB,
354
+ context?: string
355
+ ): Promise<Chromedriver>;
356
+
357
+ suspendChromedriverProxy(): void;
358
+
359
+ stopChromedriverProxies(): Promise<void>;
360
+ }
361
+
362
+ export interface ElementMixin {
363
+ getAttribute(attribute: string, elementId: string): Promise<string>;
364
+ getName(elementId: string): Promise<string>;
365
+ elementDisplayed(elementId: string): Promise<boolean>;
366
+ elementEnabled(elementId: string): Promise<boolean>;
367
+ elementSelected(elementId: string): Promise<boolean>;
368
+ setElementValue(keys: string | string[], elementId: string, replace?: boolean): Promise<void>;
369
+ doSetElementValue(opts: types.DoSetElementValueOpts): Promise<void>;
370
+ setValue(keys: string | string[], elementId: string): Promise<void>;
371
+ replaceValue(keys: string | string[], elementId: string): Promise<void>;
372
+ setValueImmediate(keys: string | string[], elementId: string): Promise<void>;
373
+ getText(elementId: string): Promise<string>;
374
+ clear(elementId: string): Promise<void>;
375
+
376
+ click(elementId: string): Promise<void>;
377
+ getLocation(elementId: string): Promise<Position>;
378
+ getLocationInView(elementId: string): Promise<Position>;
379
+
380
+ getSize(elementId: string): Promise<Size>;
381
+ getElementRect(elementId: string): Promise<Rect>;
382
+
383
+ touchLongClick(elementId: string, x: number, y: number, duration: number): Promise<void>;
384
+ touchDown(elementId: string, x: number, y: number): Promise<void>;
385
+ touchUp(elementId: string, x: number, y: number): Promise<void>;
386
+ touchMove(elementId: string, x: number, y: number): Promise<void>;
387
+ complexTap(
388
+ tapCount: number,
389
+ touchCount: number,
390
+ duration: number,
391
+ x: number,
392
+ y: number
393
+ ): Promise<void>;
394
+ tap(
395
+ elementId?: string | null,
396
+ x?: number | null,
397
+ y?: number | null,
398
+ count?: number
399
+ ): Promise<void>;
400
+ }
401
+
402
+ export interface EmulatorConsoleMixin {
403
+ /**
404
+ * Executes a command through emulator telnet console interface and returns its output.
405
+ * The `emulator_console` server feature must be enabled in order to use this method.
406
+ *
407
+ * @returns The command output
408
+ * @throws {Error} If there was an error while connecting to the Telnet console
409
+ * or if the given command returned non-OK response
410
+ */
411
+ mobileExecEmuConsoleCommand(opts: types.ExecOptions): Promise<string>;
412
+ }
413
+
414
+ export interface ExecuteMixin {
415
+ execute(script: string, args?: unknown[]): Promise<unknown>;
416
+ executeMobile(mobileCommand: string, opts?: StringRecord): Promise<unknown>;
417
+ }
418
+
419
+ export interface FileActionsMixin {
420
+ /**
421
+ * Pulls a remote file from the device.
422
+ *
423
+ * It is required that a package has debugging flag enabled in order to access its files.
424
+ *
425
+ * @param remotePath The full path to the remote file or a specially formatted path, which points to an item inside app bundle
426
+ * @returns Base64 encoded content of the pulled file
427
+ * @throws {Error} If the pull operation failed
428
+ */
429
+ pullFile(remotePath: string): Promise<string>;
430
+
431
+ /**
432
+ * Pulls a remote file from the device.
433
+ *
434
+ * @param opts
435
+ * @returns The same as {@linkcode pullFile}
436
+ */
437
+ mobilePullFile(opts: types.PullFileOpts): Promise<string>;
438
+ /**
439
+ * Pushes the given data to a file on the remote device
440
+ *
441
+ * It is required that a package has debugging flag enabled in order to access
442
+ * its files.
443
+ *
444
+ * After a file is pushed, it gets automatically scanned for possible media
445
+ * occurrences. The file is added to the media library if the scan succeeds.
446
+ *
447
+ * @param remotePath The full path to the remote file or a file
448
+ * inside a package bundle
449
+ * @param base64Data Base64 encoded data to be written to the remote
450
+ * file. The remote file will be silently overridden if it already exists.
451
+ * @throws {Error} If there was an error while pushing the data
452
+ */
453
+ pushFile(remotePath: string, base64Data: string): Promise<void>;
454
+
455
+ /**
456
+ * Pushes the given data to a file on the remote device.
457
+ */
458
+ mobilePushFile(opts: types.PushFileOpts): Promise<void>;
459
+ /**
460
+ * Pulls the whole folder from the remote device
461
+ *
462
+ * @param remotePath The full path to a folder on the remote device or a folder inside an application bundle
463
+ * @returns Base64-encoded and zipped content of the folder
464
+ * @throws {Error} If there was a failure while getting the folder content
465
+ */
466
+ pullFolder(remotePath: string): Promise<string>;
467
+
468
+ /**
469
+ * Pulls the whole folder from the device under test.
470
+ *
471
+ * @returns The same as {@linkcode pullFolder}
472
+ */
473
+ mobilePullFolder(opts: types.PullFolderOpts): Promise<string>;
474
+
475
+ /**
476
+ * Deletes a file on the remote device
477
+ *
478
+ * @returns `true` if the remote file has been successfully deleted. If the
479
+ * path to a remote file is valid, but the file itself does not exist then
480
+ * `false` is returned.
481
+ * @throws {Error} If the argument is invalid or there was an error while
482
+ * deleting the file
483
+ */
484
+ mobileDeleteFile(opts: types.DeleteFileOpts): Promise<boolean>;
485
+ }
486
+
487
+ export interface FindMixin {
488
+ /**
489
+ * @remarks The reason for isolating `doFindElementOrEls` from {@linkcode findElOrEls} is for reusing `findElOrEls`
490
+ * across android-drivers (like `appium-uiautomator2-driver`) to avoid code duplication.
491
+ * Other android-drivers (like `appium-uiautomator2-driver`) need to override `doFindElementOrEls`
492
+ * to facilitate `findElOrEls`.
493
+ */
494
+ doFindElementOrEls(opts: types.FindElementOpts): Promise<Element | Element[]>;
495
+
496
+ /**
497
+ * Find an element or elements
498
+ * @param strategy locator strategy
499
+ * @param selector actual selector for finding an element
500
+ * @param mult multiple elements or just one?
501
+ * @param context finding an element from the root context? or starting from another element
502
+ */
503
+ findElOrEls(strategy: string, selector: string, mult: true, context?: any): Promise<Element[]>;
504
+ findElOrEls(strategy: string, selector: string, mult: false, context?: any): Promise<Element>;
505
+ }
506
+
507
+ export interface GeneralMixin {
508
+ keys(keys: string | string[]): Promise<void>;
509
+ doSendKeys(opts: types.SendKeysOpts): Promise<void>;
510
+ /**
511
+ * Retrieves the current device's timestamp.
512
+ *
513
+ * @param format - The set of format specifiers. Read {@link https://momentjs.com/docs/} to get the full list of supported format specifiers. The default format is `YYYY-MM-DDTHH:mm:ssZ`, which complies to ISO-8601
514
+ * @return Formatted datetime string or the raw command output if formatting fails
515
+ */
516
+ getDeviceTime(format?: string): Promise<string>;
517
+ /**
518
+ * Retrieves the current device time
519
+ *
520
+ * @return Formatted datetime string or the raw command output if formatting fails
521
+ */
522
+ mobileGetDeviceTime(opts: types.DeviceTimeOpts): Promise<string>;
523
+
524
+ getPageSource(): Promise<string>;
525
+
526
+ openSettingsActivity(setting: string): Promise<void>;
527
+
528
+ getWindowSize(): Promise<Size>;
529
+
530
+ back(): Promise<void>;
531
+
532
+ getWindowRect(): Promise<Rect>;
533
+ getCurrentActivity(): Promise<string>;
534
+
535
+ getCurrentPackage(): Promise<string>;
536
+
537
+ background(seconds: number): Promise<string | true>;
538
+
539
+ getStrings(language?: string | null): Promise<StringRecord>;
540
+
541
+ launchApp(): Promise<void>;
542
+
543
+ startActivity(
544
+ appPackage: string,
545
+ appActivity?: string,
546
+ appWaitPackage?: string,
547
+ appWaitActivity?: string,
548
+ intentAction?: string,
549
+ intentCategory?: string,
550
+ intentFlags?: string,
551
+ optionalIntentArguments?: string,
552
+ dontStopAppOnReset?: boolean
553
+ ): Promise<void>;
554
+
555
+ _cachedActivityArgs: StringRecord;
556
+
557
+ reset(): Promise<void>;
558
+
559
+ startAUT(): Promise<void>;
560
+
561
+ setUrl(uri: string): Promise<void>;
562
+
563
+ closeApp(): Promise<void>;
564
+
565
+ getDisplayDensity(): Promise<number>;
566
+
567
+ mobilePerformEditorAction(opts: types.PerformEditorActionOpts): Promise<void>;
568
+ /**
569
+ * Retrieves the list of recent system notifications.
570
+ *
571
+ * @returns See the documentation on `adb.getNotifications` for more details
572
+ */
573
+ mobileGetNotifications(): Promise<StringRecord>;
574
+
575
+ /**
576
+ * Retrieves the list of recent SMS messages with their properties.
577
+ * @returns See the documentation on `adb.getSmsList` for more details
578
+ */
579
+ mobileListSms(opts: types.ListSmsOpts): Promise<SmsListResult>;
580
+
581
+ /**
582
+ * Unlocks the device if it is locked. Noop if the device's screen is not locked.
583
+ *
584
+ * @throws {Error} if unlock operation fails or the provided arguments are not valid
585
+ */
586
+ mobileUnlock(opts: types.UnlockOptions): Promise<void>;
587
+ }
588
+
589
+ export interface IMEMixin {
590
+ isIMEActivated: () => Promise<boolean>;
591
+ availableIMEEngines: () => Promise<string[]>;
592
+ getActiveIMEEngine: () => Promise<string>;
593
+ activateIMEEngine: (imeId: string) => Promise<void>;
594
+ deactivateIMEEngine: () => Promise<void>;
595
+ }
596
+
597
+ export interface ActivityMixin {
598
+ /**
599
+ * Starts the given activity intent.
600
+ *
601
+ * @param opts
602
+ * @returns The command output
603
+ * @throws {Error} If there was a failure while starting the activity
604
+ * or required options are missing
605
+ */
606
+ mobileStartActivity(opts?: types.StartActivityOpts): Promise<string>;
607
+ /**
608
+ * Send a broadcast intent.
609
+ *
610
+ * @returns The command output
611
+ * @throws {Error} If there was a failure while starting the activity
612
+ * or required options are missing
613
+ */
614
+ mobileBroadcast(opts?: types.BroadcastOpts): Promise<string>;
615
+ /**
616
+ * Starts the given service intent.
617
+ *
618
+ * @returns The command output
619
+ * @throws {Error} If there was a failure while starting the service
620
+ * or required options are missing
621
+ */
622
+ mobileStartService(opts?: types.StartServiceOpts): Promise<string>;
623
+ /**
624
+ * Stops the given service intent.
625
+ *
626
+ * @returns The command output
627
+ * @throws {Error} If there was a failure while stopping the service
628
+ * or required options are missing
629
+ */
630
+ mobileStopService(opts?: types.StopServiceOpts): Promise<string>;
631
+ }
632
+
633
+ export interface KeyboardMixin {
634
+ hideKeyboard(): Promise<boolean>;
635
+ isKeyboardShown(): Promise<boolean>;
636
+ }
637
+
638
+ export interface LogMixin {
639
+ supportedLogTypes: Readonly<LogDefRecord>;
640
+ mobileStartLogsBroadcast(): Promise<void>;
641
+ mobileStopLogsBroadcast(): Promise<void>;
642
+ getLogTypes(): Promise<string[]>;
643
+ getLog(logType: string): Promise<any>;
644
+ _logcatWebsocketListener?: LogcatListener;
645
+ }
646
+
647
+ export interface MediaProjectionMixin {
648
+ /**
649
+ * Record the display of a real devices running Android 10 (API level 29) and higher.
650
+ * The screen activity is recorded to a MPEG-4 file. Audio is also recorded by default
651
+ * (only for apps that allow it in their manifests).
652
+ * If another recording has been already started then the command will exit silently.
653
+ * The previously recorded video file is deleted when a new recording session is started.
654
+ * Recording continues it is stopped explicitly or until the timeout happens.
655
+ *
656
+ * @param opts Available options.
657
+ * @returns `true` if a new recording has successfully started.
658
+ * @throws {Error} If recording has failed to start or is not supported on the device under test.
659
+ */
660
+ mobileStartMediaProjectionRecording(
661
+ opts?: types.StartMediaProjectionRecordingOpts
662
+ ): Promise<boolean>;
663
+ /**
664
+ * Checks if a media projection-based recording is currently running.
665
+ *
666
+ * @returns `true` if a recording is in progress.
667
+ * @throws {Error} If a recording is not supported on the device under test.
668
+ */
669
+ mobileIsMediaProjectionRecordingRunning(): Promise<boolean>;
670
+ /**
671
+ * Stop a media projection-based recording.
672
+ * If no recording has been started before then an error is thrown.
673
+ * If the recording has been already finished before this API has been called
674
+ * then the most recent recorded file is returned.
675
+ *
676
+ * @param opts Available options.
677
+ * @returns Base64-encoded content of the recorded media file if 'remotePath'
678
+ * parameter is falsy or an empty string.
679
+ * @throws {Error} If there was an error while stopping a recording,
680
+ * fetching the content of the remote media file,
681
+ * or if a recording is not supported on the device under test.
682
+ */
683
+ mobileStopMediaProjectionRecording(
684
+ opts?: types.StopMediaProjectionRecordingOpts
685
+ ): Promise<string>;
686
+ }
687
+
688
+ export interface NetworkMixin {
689
+ getNetworkConnection(): Promise<number>;
690
+ /**
691
+ * decoupling to override the behaviour in other drivers like UiAutomator2.
692
+ */
693
+ isWifiOn(): Promise<boolean>;
694
+ /**
695
+ * Set the connectivity state for different services
696
+ *
697
+ * @throws {Error} If none of known properties were provided or there was an error
698
+ * while changing connectivity states
699
+ */
700
+ mobileSetConnectivity(opts?: types.SetConnectivityOpts): Promise<void>;
701
+ /**
702
+ * Retrieves the connectivity properties from the device under test
703
+ *
704
+ * @param opts If no service names are provided then the connectivity state is
705
+ * returned for all of them.
706
+ */
707
+ mobileGetConnectivity(opts?: types.GetConnectivityOpts): Promise<types.GetConnectivityResult>;
708
+ setNetworkConnection(type: number): Promise<number>;
709
+ /**
710
+ * decoupling to override behaviour in other drivers like UiAutomator2.
711
+ */
712
+ setWifiState(state: boolean): Promise<void>;
713
+ toggleData(): Promise<void>;
714
+ toggleWiFi(): Promise<void>;
715
+ toggleFlightMode(): Promise<void>;
716
+ setGeoLocation(location: Location): Promise<Location>;
717
+ getGeoLocation(): Promise<Location>;
718
+ /**
719
+ * Sends an async request to refresh the GPS cache.
720
+ *
721
+ * This feature only works if the device under test has Google Play Services
722
+ * installed. In case the vanilla LocationManager is used the device API level
723
+ * must be at version 30 (Android R) or higher.
724
+ *
725
+ */
726
+ mobileRefreshGpsCache(opts: types.GpsCacheRefreshOpts): Promise<void>;
727
+ /**
728
+ * Checks if GPS is enabled
729
+ *
730
+ * @returns True if yes
731
+ */
732
+ isLocationServicesEnabled(): Promise<boolean>;
733
+ /**
734
+ * Toggles GPS state
735
+ */
736
+ toggleLocationServices(): Promise<void>;
737
+
738
+ wrapBootstrapDisconnect(fn: () => Promise<void>): Promise<void>;
739
+ }
740
+
741
+ export interface PerformanceMixin {
742
+ getPerformanceDataTypes(): Promise<types.PerformanceDataType[]>;
743
+
744
+ /**
745
+ * @returns The information type of the system state which is supported to read as like cpu, memory, network traffic, and battery.
746
+ * input - (packageName) the package name of the application
747
+ * (dataType) the type of system state which wants to read. It should be one of the keys of the SUPPORTED_PERFORMANCE_DATA_TYPES
748
+ * (dataReadTimeout) the number of attempts to read
749
+ * output - table of the performance data, The first line of the table represents the type of data. The remaining lines represent the values of the data.
750
+ *
751
+ * in case of battery info : [[power], [23]]
752
+ * in case of memory info : [[totalPrivateDirty, nativePrivateDirty, dalvikPrivateDirty, eglPrivateDirty, glPrivateDirty, totalPss,
753
+ * nativePss, dalvikPss, eglPss, glPss, nativeHeapAllocatedSize, nativeHeapSize], [18360, 8296, 6132, null, null, 42588, 8406, 7024, null, null, 26519, 10344]]
754
+ * in case of network info : [[bucketStart, activeTime, rxBytes, rxPackets, txBytes, txPackets, operations, bucketDuration,],
755
+ * [1478091600000, null, 1099075, 610947, 928, 114362, 769, 0, 3600000], [1478095200000, null, 1306300, 405997, 509, 46359, 370, 0, 3600000]]
756
+ * in case of network info : [[st, activeTime, rb, rp, tb, tp, op, bucketDuration], [1478088000, null, null, 32115296, 34291, 2956805, 25705, 0, 3600],
757
+ * [1478091600, null, null, 2714683, 11821, 1420564, 12650, 0, 3600], [1478095200, null, null, 10079213, 19962, 2487705, 20015, 0, 3600],
758
+ * [1478098800, null, null, 4444433, 10227, 1430356, 10493, 0, 3600]]
759
+ * in case of cpu info : [[user, kernel], [0.9, 1.3]]
760
+ *
761
+ * @privateRemarks XXX: type the result
762
+ */
763
+ getPerformanceData(
764
+ packageName: string,
765
+ dataType: types.PerformanceDataType,
766
+ retries?: number
767
+ ): Promise<any[][]>;
768
+ /**
769
+ * Retrieves performance data about the given Android subsystem.
770
+ * The data is parsed from the output of the dumpsys utility.
771
+ *
772
+ * @returns The output depends on the selected subsystem.
773
+ * It is orginized into a table, where the first row represent column names
774
+ * and the following rows represent the sampled data for each column.
775
+ * Example output for different data types:
776
+ * - batteryinfo: [[power], [23]]
777
+ * - memory info: [[totalPrivateDirty, nativePrivateDirty, dalvikPrivateDirty, eglPrivateDirty, glPrivateDirty, totalPss,
778
+ * nativePss, dalvikPss, eglPss, glPss, nativeHeapAllocatedSize, nativeHeapSize], [18360, 8296, 6132, null, null, 42588, 8406, 7024, null, null, 26519, 10344]]
779
+ * - networkinfo: [[bucketStart, activeTime, rxBytes, rxPackets, txBytes, txPackets, operations, bucketDuration,],
780
+ * [1478091600000, null, 1099075, 610947, 928, 114362, 769, 0, 3600000], [1478095200000, null, 1306300, 405997, 509, 46359, 370, 0, 3600000]]
781
+ *
782
+ * [[st, activeTime, rb, rp, tb, tp, op, bucketDuration], [1478088000, null, null, 32115296, 34291, 2956805, 25705, 0, 3600],
783
+ * [1478091600, null, null, 2714683, 11821, 1420564, 12650, 0, 3600], [1478095200, null, null, 10079213, 19962, 2487705, 20015, 0, 3600],
784
+ * [1478098800, null, null, 4444433, 10227, 1430356, 10493, 0, 3600]]
785
+ * - cpuinfo: [[user, kernel], [0.9, 1.3]]
786
+ */
787
+ mobileGetPerformanceData(opts: types.PerformanceDataOpts): Promise<any[][]>;
788
+ }
789
+
790
+ export interface PermissionsMixin {
791
+ /**
792
+ * Changes package permissions in runtime.
793
+ *
794
+ * @param opts - Available options mapping.
795
+ * @throws {Error} if there was a failure while changing permissions
796
+ */
797
+ mobileChangePermissions(opts: types.ChangePermissionsOpts): Promise<void>;
798
+ /**
799
+ * Gets runtime permissions list for the given application package.
800
+ *
801
+ * opts - Available options mapping.
802
+ * @returns The list of retrieved permissions for the given type
803
+ * (can also be empty).
804
+ * @throws {Error} if there was an error while getting permissions.
805
+ */
806
+ mobileGetPermissions(opts: types.GetPermissionsOpts): Promise<string[]>;
807
+ }
808
+
809
+ export interface RecordScreenMixin {
810
+ /**
811
+ * @privateRemarks FIXME: type this properly
812
+ */
813
+ _screenRecordingProperties?: StringRecord;
814
+ /**
815
+ * Record the display of a real devices running Android 4.4 (API level 19) and
816
+ * higher.
817
+ *
818
+ * Emulators are supported since API level 27 (Android P). It records screen
819
+ * activity to an MPEG-4 file. Audio is not recorded with the video file. If
820
+ * screen recording has been already started then the command will stop it
821
+ * forcefully and start a new one. The previously recorded video file will be
822
+ * deleted.
823
+ *
824
+ * @param opts - The available options.
825
+ * @returns Base64-encoded content of the recorded media file if any screen
826
+ * recording is currently running or an empty string.
827
+ * @throws {Error} If screen recording has failed to start or is not supported
828
+ * on the device under test.
829
+ */
830
+ startRecordingScreen(opts?: types.StartScreenRecordingOpts): Promise<string>;
831
+ /**
832
+ * Stop recording the screen.
833
+ *
834
+ * If no screen recording has been started before then the method returns an
835
+ * empty string.
836
+ *
837
+ * @param opts - The available options.
838
+ * @returns Base64-encoded content of the recorded media file if `remotePath`
839
+ * option is falsy or an empty string.
840
+ * @throws {Error} If there was an error while getting the name of a media
841
+ * file or the file content cannot be uploaded to the remote location or
842
+ * screen recording is not supported on the device under test.
843
+ */
844
+ stopRecordingScreen(opts?: types.StopScreenRecordingOpts): Promise<string>;
845
+ }
846
+
847
+ export interface ShellMixin {
848
+ mobileShell(opts?: types.ShellOpts): Promise<string | {stderr: string; stdout: string}>;
849
+ }
850
+
851
+ export interface StreamScreenMixin {
852
+ _screenStreamingProps?: StringRecord;
853
+ /**
854
+ * Starts device screen broadcast by creating MJPEG server. Multiple calls to
855
+ * this method have no effect unless the previous streaming session is stopped.
856
+ * This method only works if the `adb_screen_streaming` feature is enabled on
857
+ * the server side.
858
+ *
859
+ * @param opts - The available options.
860
+ * @throws {Error} If screen streaming has failed to start or is not
861
+ * supported on the host system or the corresponding server feature is not
862
+ * enabled.
863
+ */
864
+ mobileStartScreenStreaming(opts?: types.StartScreenStreamingOpts): Promise<void>;
865
+
866
+ /**
867
+ * Stop screen streaming.
868
+ *
869
+ * If no screen streaming server has been started then nothing is done.
870
+ */
871
+ mobileStopScreenStreaming(): Promise<void>;
872
+ }
873
+
874
+ export interface SystemBarsMixin {
875
+ getSystemBars(): Promise<StringRecord>;
876
+ /**
877
+ * Performs commands on the system status bar.
878
+ *
879
+ * A thin wrapper over `adb shell cmd statusbar` CLI. Works on Android Oreo and newer.
880
+ *
881
+ * @returns The actual output of the downstream console command.
882
+ */
883
+ mobilePerformStatusBarCommand(opts?: types.StatusBarCommandOpts): Promise<string>;
884
+ }
885
+
886
+ export interface TouchMixin {
887
+ /**
888
+ * @privateRemarks the shape of opts is dependent on the value of action, and
889
+ * this can be further narrowed to avoid all of the type assertions below.
890
+ */
891
+ doTouchAction(action: types.TouchActionKind, opts?: types.TouchActionOpts): Promise<void>;
892
+
893
+ /**
894
+ * @privateRemarks drag is *not* press-move-release, so we need to translate.
895
+ * drag works fine for scroll, as well
896
+ */
897
+ doTouchDrag(gestures: types.TouchDragAction): Promise<void>;
898
+
899
+ /**
900
+ * @privateRemarks Release gesture needs element or co-ordinates to release it
901
+ * from that position or else release gesture is performed from center of the
902
+ * screen, so to fix it This method sets co-ordinates/element to release
903
+ * gesture if it has no options set already.
904
+ */
905
+ fixRelease(gestures: types.TouchAction[]): Promise<types.TouchAction | undefined>;
906
+
907
+ /**
908
+ * Performs a single gesture
909
+ */
910
+ performGesture(gesture: types.TouchAction): Promise<void>;
911
+
912
+ getSwipeOptions(gestures: types.SwipeAction, touchCount?: number): Promise<types.TouchSwipeOpts>;
913
+
914
+ performTouch(gestures: types.TouchAction[]): Promise<void>;
915
+ parseTouch(gestures: types.TouchAction[], mult?: boolean): Promise<types.TouchState[]>;
916
+ performMultiAction(actions: types.TouchAction[], elementId: string): Promise<void>;
917
+ /**
918
+ * @privateRemarks Reason for isolating `doPerformMultiAction` from
919
+ * {@link performMultiAction} is for reusing `performMultiAction` across android-drivers
920
+ * (like `appium-uiautomator2-driver`) and to avoid code duplication. Other
921
+ * android-drivers (like `appium-uiautomator2-driver`) need to override
922
+ * `doPerformMultiAction` to facilitate `performMultiAction`.
923
+ */
924
+ doPerformMultiAction(elementId: string, states: types.TouchState[]): Promise<void>;
925
+ }
926
+
927
+ declare module '../driver' {
928
+ interface AndroidDriver
929
+ extends ActionsMixin,
930
+ AlertMixin,
931
+ AppManagementMixin,
932
+ ContextMixin,
933
+ ElementMixin,
934
+ EmulatorConsoleMixin,
935
+ ExecuteMixin,
936
+ FileActionsMixin,
937
+ FindMixin,
938
+ GeneralMixin,
939
+ IMEMixin,
940
+ ActivityMixin,
941
+ KeyboardMixin,
942
+ LogMixin,
943
+ MediaProjectionMixin,
944
+ NetworkMixin,
945
+ PerformanceMixin,
946
+ PermissionsMixin,
947
+ RecordScreenMixin,
948
+ ShellMixin,
949
+ StreamScreenMixin,
950
+ SystemBarsMixin,
951
+ TouchMixin {}
952
+ }
953
+
954
+ /**
955
+ * This function assigns a mixin `T` to the `AndroidDriver` class' prototype.
956
+ *
957
+ * While each mixin has its own interface which is (in isolation) unrelated to
958
+ * `AndroidDriver`, the constraint on this generic type `T` is that it must be a
959
+ * partial of `AndroidDriver`'s interface. This enforces that it does not
960
+ * conflict with the existing interface of `AndroidDriver`. In that way, you
961
+ * can think of it as a type guard.
962
+ * @param mixin Mixin implementation
963
+ */
964
+ export function mixin<T extends Partial<AndroidDriver>>(mixin: T): void {
965
+ Object.assign(AndroidDriver.prototype, mixin);
966
+ }