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