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
@@ -1,21 +1,39 @@
1
1
  "use strict";
2
+ // @ts-check
2
3
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
4
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
5
  };
5
6
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.commands = void 0;
7
+ const mixins_1 = require("./mixins");
7
8
  const lodash_1 = __importDefault(require("lodash"));
8
9
  const driver_1 = require("appium/driver");
9
10
  const NO_VALUE_ARG_TYPE = 'sn';
10
11
  const SUPPORTED_EXTRA_TYPES = [
11
- 's', NO_VALUE_ARG_TYPE, 'z', 'i', 'l', 'f', 'u', 'cn',
12
- 'ia', 'ial', 'la', 'lal', 'fa', 'fal', 'sa', 'sal',
12
+ 's',
13
+ NO_VALUE_ARG_TYPE,
14
+ 'z',
15
+ 'i',
16
+ 'l',
17
+ 'f',
18
+ 'u',
19
+ 'cn',
20
+ 'ia',
21
+ 'ial',
22
+ 'la',
23
+ 'lal',
24
+ 'fa',
25
+ 'fal',
26
+ 'sa',
27
+ 'sal',
13
28
  ];
14
29
  const API_LEVEL_ANDROID_8 = 26;
15
- const commands = {};
16
- exports.commands = commands;
30
+ /**
31
+ *
32
+ * @param {import('./types').IntentOpts} opts
33
+ * @returns {string[]}
34
+ */
17
35
  function parseIntentSpec(opts = {}) {
18
- const { intent, action, uri, mimeType, identifier, categories, component, extras, flags, } = opts;
36
+ const { intent, action, uri, mimeType, identifier, categories, component, extras, flags } = opts;
19
37
  const resultArgs = [];
20
38
  if (intent) {
21
39
  resultArgs.push(intent);
@@ -34,7 +52,7 @@ function parseIntentSpec(opts = {}) {
34
52
  }
35
53
  if (categories) {
36
54
  if (lodash_1.default.isArray(categories)) {
37
- resultArgs.push(...(lodash_1.default.flatMap(categories.map((cName) => ['-c', cName]))));
55
+ resultArgs.push(...lodash_1.default.flatMap(categories.map((cName) => ['-c', cName])));
38
56
  }
39
57
  else {
40
58
  resultArgs.push('-c', categories);
@@ -80,217 +98,87 @@ function parseIntentSpec(opts = {}) {
80
98
  return resultArgs;
81
99
  }
82
100
  /**
83
- * @typedef {Object} StartActivityOptions
84
- * @property {?string|number} user ['current'] - The user ID for which the service is started.
85
- * The `current` user id is used by default
86
- * @property {?boolean} wait [false] - Set it to `true` if you want to block the method call
87
- * until the activity manager's process returns the control to the system.
88
- * @property {?boolean} stop [false] - Set it to `true` to force stop the target
89
- * app before starting the activity
90
- * @property {?number|string} windowingMode - The windowing mode to launch the activity into.
91
- * Check https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/app/WindowConfiguration.java
92
- * for more details on possible windowing modes (constants starting with `WINDOWING_MODE_`).
93
- * @property {?number|string} activityType - The activity type to launch the activity as.
94
- * Check https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/app/WindowConfiguration.java
95
- * for more details on possible activity types (constants starting with `ACTIVITY_TYPE_`).
96
- * @property {?number|string} display - The display identifier to launch the activity into.
97
- * @property {?string} intent - The name of the activity intent to start, for example
98
- * `com.some.package.name/.YourServiceSubClassName`
99
- * @property {?string} action - Action name
100
- * @property {?string} package - Package name
101
- * @property {?string} uri - Unified resource identifier
102
- * @property {?string} mimeType - Mime type
103
- * @property {?string} identifier - Optional identifier
104
- * @property {?string|Array<string>} categories - One or more category names
105
- * @property {?string} component - Component name
106
- * @property {Array<string|Array<string>>} extras - Optional intent arguments. Must be represented
107
- * as array of arrays, where each subarray item contains two or three string items:
108
- * value type, key name and the value itself.
109
- * Supported value types are:
110
- * - s: string. Value must be a valid string
111
- * - sn: null. Value is ignored for this type
112
- * - z: boolean. Value must be either `true` or `false`
113
- * - i: integer. Value must be a valid 4-byte integer number
114
- * - l: long. Value must be a valid 8-byte long number
115
- * - f: float: Value must be a valid float number
116
- * - u: uri. Value must be a valid uniform resource identifier string
117
- * - cn: component name. Value must be a valid component name string
118
- * - ia: Integer[]. Value must be a string of comma-separated integers
119
- * - ial: List<Integer>. Value must be a string of comma-separated integers
120
- * - la: Long[]. Value must be a string of comma-separated long numbers
121
- * - lal: List<Long>. Value must be a string of comma-separated long numbers
122
- * - fa: Float[]. Value must be a string of comma-separated float numbers
123
- * - fal: List<Float>. Value must be a string of comma-separated float numbers
124
- * - sa: String[]. Value must be comma-separated strings. To embed a comma into a string,
125
- * escape it using "\,"
126
- * - sal: List<String>. Value must be comma-separated strings. To embed a comma into a string,
127
- * escape it using "\,"
128
- * For example: [['s', 'varName1', 'My String1'], ['s', 'varName2', 'My String2'], ['ia', 'arrName', '1,2,3,4']]
129
- * @property {?string} flags - Intent startup-specific flags as a hexadecimal string.
130
- * See https://developer.android.com/reference/android/content/Intent.html
131
- * for the list of available flag values (constants starting with FLAG_ACTIVITY_).
132
- * Flag values could be merged using the logical 'or' operation.
133
- * For example, 0x10200000 is the combination of two flags:
134
- * 0x10000000 `FLAG_ACTIVITY_NEW_TASK` | 0x00200000 `FLAG_ACTIVITY_RESET_TASK_IF_NEEDED`
101
+ * @type {import('./mixins').ActivityMixin & ThisType<import('../driver').AndroidDriver>}
102
+ * @satisfies {import('@appium/types').ExternalDriver}
135
103
  */
136
- /**
137
- * Starts the given activity intent.
138
- *
139
- * @param {StartActivityOptions} opts
140
- * @returns {string} The command output
141
- * @throws {Error} If there was a failure while starting the activity
142
- * or required options are missing
143
- */
144
- commands.mobileStartActivity = async function mobileStartActivity(opts = {}) {
145
- const { user, wait, stop, windowingMode, activityType, display, } = opts;
146
- const cmd = [
147
- 'am', (await this.adb.getApiLevel() < API_LEVEL_ANDROID_8) ? 'start' : 'start-activity',
148
- ];
149
- if (!lodash_1.default.isNil(user)) {
150
- cmd.push('--user', user);
151
- }
152
- if (wait) {
153
- cmd.push('-W');
154
- }
155
- if (stop) {
156
- cmd.push('-S');
157
- }
158
- if (!lodash_1.default.isNil(windowingMode)) {
159
- cmd.push('--windowingMode', windowingMode);
160
- }
161
- if (!lodash_1.default.isNil(activityType)) {
162
- cmd.push('--activityType', activityType);
163
- }
164
- if (!lodash_1.default.isNil(display)) {
165
- cmd.push('--display', display);
166
- }
167
- cmd.push(...(parseIntentSpec(opts)));
168
- return await this.adb.shell(cmd);
169
- };
170
- /**
171
- * @typedef {Object} BroadcastOptions
172
- * @property {?string|number} user ['all'] - The user ID for which the broadcast is sent.
173
- * The `current` alias assumes the current user ID.
174
- * @property {?string} receiverPermission - Require receiver to hold the given permission.
175
- * @property {?boolean} allowBackgroundActivityStarts [false] - Whether the receiver may
176
- * start activities even if in the background.
177
- * @property {?string} intent - The name of the intent to broadcast to, for example
178
- * `com.some.package.name/.YourServiceSubClassName`.
179
- * @property {?string} action - Action name
180
- * @property {?string} uri - Unified resource identifier
181
- * @property {?string} mimeType - Mime type
182
- * @property {?string} identifier - Optional identifier
183
- * @property {?string|Array<string>} categories - One or more category names
184
- * @property {?string} component - Component name
185
- * @property {?string} package - Package name
186
- * @property {Array<Array<string>>} extras - Optional intent arguments.
187
- * See above for the detailed description.
188
- * @property {?string} flags - Intent startup-specific flags as a hexadecimal string.
189
- * See above for the detailed description.
190
- */
191
- /**
192
- * Send a broadcast intent.
193
- *
194
- * @param {BroadcastOptions} opts
195
- * @returns {string} The command output
196
- * @throws {Error} If there was a failure while starting the activity
197
- * or required options are missing
198
- */
199
- commands.mobileBroadcast = async function mobileBroadcast(opts = {}) {
200
- const { user, receiverPermission, allowBackgroundActivityStarts, } = opts;
201
- const cmd = ['am', 'broadcast'];
202
- if (!lodash_1.default.isNil(user)) {
203
- cmd.push('--user', user);
204
- }
205
- if (receiverPermission) {
206
- cmd.push('--receiver-permission', receiverPermission);
207
- }
208
- if (allowBackgroundActivityStarts) {
209
- cmd.push('--allow-background-activity-starts');
210
- }
211
- cmd.push(...(parseIntentSpec(opts)));
212
- return await this.adb.shell(cmd);
213
- };
214
- /**
215
- * @typedef {Object} StartServiceOptions
216
- * @property {?string|number} user ['current'] - The user ID for which the service is started.
217
- * The `current` user id is used by default
218
- * @property {?boolean} foreground [false] - Set it to `true` if your service must be
219
- * started as foreground service. This option is ignored if the API level of the
220
- * device under test is below 26 (Android 8).
221
- * @property {?string} intent - The name of the service intent to start, for example
222
- * `com.some.package.name/.YourServiceSubClassName`.
223
- * @property {?string} action - Action name
224
- * @property {?string} uri - Unified resource identifier
225
- * @property {?string} mimeType - Mime type
226
- * @property {?string} identifier - Optional identifier
227
- * @property {?string|Array<string>} categories - One or more category names
228
- * @property {?string} component - Component name
229
- * @property {?string} package - Package name
230
- * @property {Array<Array<string>>} extras - Optional intent arguments.
231
- * See above for the detailed description.
232
- * @property {?string} flags - Intent startup-specific flags as a hexadecimal string.
233
- * See above for the detailed description.
234
- */
235
- /**
236
- * Starts the given service intent.
237
- *
238
- * @param {StartServiceOptions} opts
239
- * @returns {string} The command output
240
- * @throws {Error} If there was a failure while starting the service
241
- * or required options are missing
242
- */
243
- commands.mobileStartService = async function mobileStartService(opts = {}) {
244
- const { user, foreground, } = opts;
245
- const cmd = ['am'];
246
- if (await this.adb.getApiLevel() < API_LEVEL_ANDROID_8) {
247
- cmd.push('startservice');
248
- }
249
- else {
250
- cmd.push(foreground ? 'start-foreground-service' : 'start-service');
251
- }
252
- if (!lodash_1.default.isNil(user)) {
253
- cmd.push('--user', user);
254
- }
255
- cmd.push(...(parseIntentSpec(opts)));
256
- return await this.adb.shell(cmd);
104
+ const ActivityMixin = {
105
+ async mobileStartActivity(opts = {}) {
106
+ const { user, wait, stop, windowingMode, activityType, display } = opts;
107
+ const cmd = [
108
+ 'am',
109
+ (await /** @type {ADB} */ (this.adb).getApiLevel()) < API_LEVEL_ANDROID_8
110
+ ? 'start'
111
+ : 'start-activity',
112
+ ];
113
+ if (!lodash_1.default.isNil(user)) {
114
+ cmd.push('--user', String(user));
115
+ }
116
+ if (wait) {
117
+ cmd.push('-W');
118
+ }
119
+ if (stop) {
120
+ cmd.push('-S');
121
+ }
122
+ if (!lodash_1.default.isNil(windowingMode)) {
123
+ cmd.push('--windowingMode', String(windowingMode));
124
+ }
125
+ if (!lodash_1.default.isNil(activityType)) {
126
+ cmd.push('--activityType', String(activityType));
127
+ }
128
+ if (!lodash_1.default.isNil(display)) {
129
+ cmd.push('--display', String(display));
130
+ }
131
+ cmd.push(...parseIntentSpec(opts));
132
+ return await /** @type {ADB} */ (this.adb).shell(cmd);
133
+ },
134
+ async mobileBroadcast(opts = {}) {
135
+ const { user, receiverPermission, allowBackgroundActivityStarts } = opts;
136
+ const cmd = ['am', 'broadcast'];
137
+ if (!lodash_1.default.isNil(user)) {
138
+ cmd.push('--user', String(user));
139
+ }
140
+ if (receiverPermission) {
141
+ cmd.push('--receiver-permission', receiverPermission);
142
+ }
143
+ if (allowBackgroundActivityStarts) {
144
+ cmd.push('--allow-background-activity-starts');
145
+ }
146
+ cmd.push(...parseIntentSpec(opts));
147
+ return await /** @type {ADB} */ (this.adb).shell(cmd);
148
+ },
149
+ async mobileStartService(opts = {}) {
150
+ const { user, foreground } = opts;
151
+ const cmd = ['am'];
152
+ if ((await /** @type {ADB} */ (this.adb).getApiLevel()) < API_LEVEL_ANDROID_8) {
153
+ cmd.push('startservice');
154
+ }
155
+ else {
156
+ cmd.push(foreground ? 'start-foreground-service' : 'start-service');
157
+ }
158
+ if (!lodash_1.default.isNil(user)) {
159
+ cmd.push('--user', String(user));
160
+ }
161
+ cmd.push(...parseIntentSpec(opts));
162
+ return await /** @type {ADB} */ (this.adb).shell(cmd);
163
+ },
164
+ async mobileStopService(opts = {}) {
165
+ const { user } = opts;
166
+ const cmd = [
167
+ 'am',
168
+ (await /** @type {ADB} */ (this.adb).getApiLevel()) < API_LEVEL_ANDROID_8
169
+ ? 'stopservice'
170
+ : 'stop-service',
171
+ ];
172
+ if (!lodash_1.default.isNil(user)) {
173
+ cmd.push('--user', String(user));
174
+ }
175
+ cmd.push(...parseIntentSpec(opts));
176
+ return await /** @type {ADB} */ (this.adb).shell(cmd);
177
+ },
257
178
  };
179
+ (0, mixins_1.mixin)(ActivityMixin);
180
+ exports.default = ActivityMixin;
258
181
  /**
259
- * @typedef {Object} StopServiceOptions
260
- * @property {string|number} user ['current'] - The user ID for which the service is running.
261
- * The `current` user id is used by default
262
- * @property {?string} intent - The name of the service intent to stop, for example
263
- * `com.some.package.name/.YourServiceSubClassName`.
264
- * @property {?string} action - Action name
265
- * @property {?string} uri - Unified resource identifier
266
- * @property {?string} mimeType - Mime type
267
- * @property {?string} identifier - Optional identifier
268
- * @property {?string|Array<string>} categories - One or more category names
269
- * @property {?string} component - Component name
270
- * @property {?string} package - Package name
271
- * @property {Array<Array<string>>} extras - Optional intent arguments.
272
- * See above for the detailed description.
273
- * @property {?string} flags - See above for the detailed description.
274
- */
275
- /**
276
- * Stops the given service intent.
277
- *
278
- * @param {StopServiceOptions} opts
279
- * @returns {string} The command output
280
- * @throws {Error} If there was a failure while stopping the service
281
- * or required options are missing
182
+ * @typedef {import('appium-adb').ADB} ADB
282
183
  */
283
- commands.mobileStopService = async function mobileStopService(opts = {}) {
284
- const { user, } = opts;
285
- const cmd = [
286
- 'am',
287
- (await this.adb.getApiLevel() < API_LEVEL_ANDROID_8) ? 'stopservice' : 'stop-service'
288
- ];
289
- if (!lodash_1.default.isNil(user)) {
290
- cmd.push('--user', user);
291
- }
292
- cmd.push(...(parseIntentSpec(opts)));
293
- return await this.adb.shell(cmd);
294
- };
295
- exports.default = commands;
296
184
  //# sourceMappingURL=intent.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"intent.js","sourceRoot":"","sources":["../../../lib/commands/intent.js"],"names":[],"mappings":";;;;;;AAAA,oDAAuB;AACvB,0CAAuC;AAEvC,MAAM,iBAAiB,GAAG,IAAI,CAAC;AAC/B,MAAM,qBAAqB,GAAG;IAC5B,GAAG,EAAE,iBAAiB,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,E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AAG,EAAE;QAC/B,MAAM,EAAC,IAAI,EAAC,GAAG,IAAI,CAAC;QACpB,MAAM,GAAG,GAAG;YACV,IAAI;YACJ,CAAC,MAAM,kBAAkB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC,GAAG,mBAAmB;gBACvE,CAAC,CAAC,aAAa;gBACf,CAAC,CAAC,cAAc;SACnB,CAAC;QACF,IAAI,CAAC,gBAAC,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE;YAClB,GAAG,CAAC,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;SAClC;QACD,GAAG,CAAC,IAAI,CAAC,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC;QACnC,OAAO,MAAM,kBAAkB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACxD,CAAC;CACF,CAAC;AAEF,IAAA,cAAK,EAAC,aAAa,CAAC,CAAC;AAErB,kBAAe,aAAa,CAAC;AAE7B;;GAEG"}
@@ -1,6 +1,7 @@
1
- export default commands;
2
- declare namespace commands {
3
- function hideKeyboard(): Promise<any>;
4
- function isKeyboardShown(): Promise<any>;
5
- }
1
+ export default KeyboardMixin;
2
+ /**
3
+ * @type {import('./mixins').KeyboardMixin & ThisType<import('../driver').AndroidDriver>}
4
+ * @satisfies {import('@appium/types').ExternalDriver}
5
+ */
6
+ declare const KeyboardMixin: import('./mixins').KeyboardMixin & ThisType<import('../driver').AndroidDriver>;
6
7
  //# sourceMappingURL=keyboard.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"keyboard.d.ts","sourceRoot":"","sources":["../../../lib/commands/keyboard.js"],"names":[],"mappings":";;IAEA,sCAEC;IAED,yCAGC"}
1
+ {"version":3,"file":"keyboard.d.ts","sourceRoot":"","sources":["../../../lib/commands/keyboard.js"],"names":[],"mappings":";AAIA;;;GAGG;AACH,6BAHU,OAAO,UAAU,EAAE,aAAa,GAAG,SAAS,OAAO,WAAW,EAAE,aAAa,CAAC,CActF"}
@@ -1,12 +1,20 @@
1
1
  "use strict";
2
+ // @ts-check
2
3
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const commands = {};
4
- commands.hideKeyboard = async function hideKeyboard() {
5
- return await this.adb.hideKeyboard();
4
+ const mixins_1 = require("./mixins");
5
+ /**
6
+ * @type {import('./mixins').KeyboardMixin & ThisType<import('../driver').AndroidDriver>}
7
+ * @satisfies {import('@appium/types').ExternalDriver}
8
+ */
9
+ const KeyboardMixin = {
10
+ async hideKeyboard() {
11
+ return await /** @type {import('appium-adb').ADB} */ (this.adb).hideKeyboard();
12
+ },
13
+ async isKeyboardShown() {
14
+ const { isKeyboardShown } = await /** @type {import('appium-adb').ADB} */ (this.adb).isSoftKeyboardPresent();
15
+ return isKeyboardShown;
16
+ },
6
17
  };
7
- commands.isKeyboardShown = async function isKeyboardShown() {
8
- const { isKeyboardShown } = await this.adb.isSoftKeyboardPresent();
9
- return isKeyboardShown;
10
- };
11
- exports.default = commands;
18
+ (0, mixins_1.mixin)(KeyboardMixin);
19
+ exports.default = KeyboardMixin;
12
20
  //# sourceMappingURL=keyboard.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"keyboard.js","sourceRoot":"","sources":["../../../lib/commands/keyboard.js"],"names":[],"mappings":";;AAAA,MAAM,QAAQ,GAAG,EAAE,CAAC;AAEpB,QAAQ,CAAC,YAAY,GAAG,KAAK,UAAU,YAAY;IACjD,OAAO,MAAM,IAAI,CAAC,GAAG,CAAC,YAAY,EAAE,CAAC;AACvC,CAAC,CAAC;AAEF,QAAQ,CAAC,eAAe,GAAG,KAAK,UAAU,eAAe;IACvD,MAAM,EAAC,eAAe,EAAC,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,qBAAqB,EAAE,CAAC;IACjE,OAAO,eAAe,CAAC;AACzB,CAAC,CAAC;AAEF,kBAAe,QAAQ,CAAC"}
1
+ {"version":3,"file":"keyboard.js","sourceRoot":"","sources":["../../../lib/commands/keyboard.js"],"names":[],"mappings":";AAAA,YAAY;;AAEZ,qCAA+B;AAE/B;;;GAGG;AACH,MAAM,aAAa,GAAG;IACpB,KAAK,CAAC,YAAY;QAChB,OAAO,MAAM,uCAAuC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,YAAY,EAAE,CAAC;IACjF,CAAC;IAED,KAAK,CAAC,eAAe;QACnB,MAAM,EAAC,eAAe,EAAC,GAAG,MAAM,uCAAuC,CAAC,CACtE,IAAI,CAAC,GAAG,CACT,CAAC,qBAAqB,EAAE,CAAC;QAC1B,OAAO,eAAe,CAAC;IACzB,CAAC;CACF,CAAC;AAEF,IAAA,cAAK,EAAC,aAAa,CAAC,CAAC;AAErB,kBAAe,aAAa,CAAC"}
@@ -1,45 +1,8 @@
1
- export default extensions;
2
- export namespace commands {
3
- /**
4
- * Starts Android logcat broadcast websocket on the same host and port
5
- * where Appium server is running at `/ws/session/:sessionId:/appium/logcat` endpoint. The method
6
- * will return immediately if the web socket is already listening.
7
- *
8
- * Each connected websocket listener will receive logcat log lines
9
- * as soon as they are visible to Appium.
10
- */
11
- function mobileStartLogsBroadcast(): Promise<void>;
12
- /**
13
- * Stops the previously started logcat broadcasting wesocket server.
14
- * This method will return immediately if no server is running.
15
- */
16
- function mobileStopLogsBroadcast(): Promise<void>;
17
- function getLogTypes(): Promise<any>;
18
- function getLog(logType: any): Promise<any>;
19
- }
20
- export let helpers: {};
21
- declare namespace extensions {
22
- namespace supportedLogTypes {
23
- namespace logcat {
24
- let description: string;
25
- function getter(self: any): Promise<any>;
26
- }
27
- namespace bugreport {
28
- let description_1: string;
29
- export { description_1 as description };
30
- export function getter_1(self: any): Promise<any>;
31
- export { getter_1 as getter };
32
- }
33
- namespace server {
34
- let description_2: string;
35
- export { description_2 as description };
36
- export function getter_2(self: any): {
37
- timestamp: any;
38
- level: any;
39
- message: any;
40
- }[];
41
- export { getter_2 as getter };
42
- }
43
- }
44
- }
1
+ export default LogMixin;
2
+ export type ADB = import('appium-adb').ADB;
3
+ /**
4
+ * @type {import('./mixins').LogMixin & ThisType<import('../driver').AndroidDriver>}
5
+ * @satisfies {import('@appium/types').ExternalDriver}
6
+ */
7
+ declare const LogMixin: import('./mixins').LogMixin & ThisType<import('../driver').AndroidDriver>;
45
8
  //# sourceMappingURL=log.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../../lib/commands/log.js"],"names":[],"mappings":";;IAiDA;;;;;;;OAOG;IACH,mDAmDC;IAED;;;OAGG;IACH,kDASC;IAED,qCAOC;IAED,4CAKC;;AAnIkB,uBAAY;;;;;YAgBnB,yCAA8C;;;;;YAI9C,kDAKP;;;;;;YAIO;;;;gBAQP"}
1
+ {"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../../lib/commands/log.js"],"names":[],"mappings":";kBAsMa,OAAO,YAAY,EAAE,GAAG;AAtKrC;;;GAGG;AACH,wBAHU,OAAO,UAAU,EAAE,QAAQ,GAAG,SAAS,OAAO,WAAW,EAAE,aAAa,CAAC,CA8JjF"}