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,16 +1,15 @@
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 lodash_1 = __importDefault(require("lodash"));
8
- const asyncbox_1 = require("asyncbox");
9
7
  const support_1 = require("@appium/support");
10
- const teen_process_1 = require("teen_process");
8
+ const asyncbox_1 = require("asyncbox");
9
+ const lodash_1 = __importDefault(require("lodash"));
11
10
  const path_1 = __importDefault(require("path"));
12
- const commands = {};
13
- exports.commands = commands;
11
+ const teen_process_1 = require("teen_process");
12
+ const mixins_1 = require("./mixins");
14
13
  const RETRY_PAUSE = 300;
15
14
  const RETRY_TIMEOUT = 5000;
16
15
  const MAX_RECORDING_TIME_SEC = 60 * 3;
@@ -21,11 +20,21 @@ const SCREENRECORD_BINARY = 'screenrecord';
21
20
  const DEFAULT_EXT = '.mp4';
22
21
  const MIN_EMULATOR_API_LEVEL = 27;
23
22
  const FFMPEG_BINARY = `ffmpeg${support_1.system.isWindows() ? '.exe' : ''}`;
24
- async function uploadRecordedMedia(localFile, remotePath = null, uploadOptions = {}) {
23
+ /**
24
+ *
25
+ * @param {string} localFile
26
+ * @param {string} [remotePath]
27
+ * @param {import('./types').StopScreenRecordingOpts} uploadOptions
28
+ * @returns {Promise<string>}
29
+ */
30
+ async function uploadRecordedMedia(localFile, remotePath, uploadOptions = {}) {
25
31
  if (lodash_1.default.isEmpty(remotePath)) {
26
32
  return (await support_1.util.toInMemoryBase64(localFile)).toString();
27
33
  }
28
34
  const { user, pass, method, headers, fileFieldName, formFields } = uploadOptions;
35
+ /**
36
+ * @type {import('@appium/support').NetOptions & import('@appium/support').HttpUploadOptions}
37
+ */
29
38
  const options = {
30
39
  method: method || 'PUT',
31
40
  headers,
@@ -35,9 +44,14 @@ async function uploadRecordedMedia(localFile, remotePath = null, uploadOptions =
35
44
  if (user && pass) {
36
45
  options.auth = { user, pass };
37
46
  }
38
- await support_1.net.uploadFile(localFile, remotePath, options);
47
+ await support_1.net.uploadFile(localFile, /** @type {string} */ (remotePath), options);
39
48
  return '';
40
49
  }
50
+ /**
51
+ *
52
+ * @param {ADB} adb
53
+ * @param {boolean} isEmulator
54
+ */
41
55
  async function verifyScreenRecordIsSupported(adb, isEmulator) {
42
56
  const apiLevel = await adb.getApiLevel();
43
57
  if (isEmulator && apiLevel < MIN_EMULATOR_API_LEVEL) {
@@ -47,11 +61,18 @@ async function verifyScreenRecordIsSupported(adb, isEmulator) {
47
61
  throw new Error(`Screen recording not available on API Level ${apiLevel}. Minimum API Level is 19.`);
48
62
  }
49
63
  }
50
- async function scheduleScreenRecord(adb, recordingProperties, log = null) {
64
+ /**
65
+ *
66
+ * @param {ADB} adb
67
+ * @param {import('@appium/types').StringRecord} recordingProperties
68
+ * @param {import('@appium/types').AppiumLogger} [log]
69
+ * @returns {Promise<void>}
70
+ */
71
+ async function scheduleScreenRecord(adb, recordingProperties, log) {
51
72
  if (recordingProperties.stopped) {
52
73
  return;
53
74
  }
54
- const { timer, videoSize, bitRate, timeLimit, bugReport, } = recordingProperties;
75
+ const { timer, videoSize, bitRate, timeLimit, bugReport } = recordingProperties;
55
76
  let currentTimeLimit = MAX_RECORDING_TIME_SEC;
56
77
  if (support_1.util.hasValue(recordingProperties.currentTimeLimit)) {
57
78
  const currentTimeLimitInt = parseInt(recordingProperties.currentTimeLimit, 10);
@@ -88,14 +109,17 @@ async function scheduleScreenRecord(adb, recordingProperties, log = null) {
88
109
  await scheduleScreenRecord(adb, recordingProperties, log);
89
110
  }
90
111
  catch (e) {
91
- log?.error(e.stack);
112
+ log?.error(/** @type {Error} */ (e).stack);
92
113
  recordingProperties.stopped = true;
93
114
  }
94
115
  })();
95
116
  });
96
117
  await recordingProc.start(0);
97
118
  try {
98
- await (0, asyncbox_1.waitForCondition)(async () => await adb.fileExists(pathOnDevice), { waitMs: RETRY_TIMEOUT, intervalMs: RETRY_PAUSE });
119
+ await (0, asyncbox_1.waitForCondition)(async () => await adb.fileExists(pathOnDevice), {
120
+ waitMs: RETRY_TIMEOUT,
121
+ intervalMs: RETRY_PAUSE,
122
+ });
99
123
  }
100
124
  catch (e) {
101
125
  throw new Error(`The expected screen record file '${pathOnDevice}' does not exist after ${RETRY_TIMEOUT}ms. ` +
@@ -104,28 +128,37 @@ async function scheduleScreenRecord(adb, recordingProperties, log = null) {
104
128
  recordingProperties.records.push(pathOnDevice);
105
129
  recordingProperties.recordingProcess = recordingProc;
106
130
  }
107
- async function mergeScreenRecords(mediaFiles, log = null) {
131
+ /**
132
+ *
133
+ * @param {string[]} mediaFiles
134
+ * @param {import('@appium/types').AppiumLogger} [log]
135
+ * @returns {Promise<string>}
136
+ */
137
+ async function mergeScreenRecords(mediaFiles, log) {
108
138
  try {
109
139
  await support_1.fs.which(FFMPEG_BINARY);
110
140
  }
111
141
  catch (e) {
112
142
  throw new Error(`${FFMPEG_BINARY} utility is not available in PATH. Please install it from https://www.ffmpeg.org/`);
113
143
  }
114
- const configContent = mediaFiles
115
- .map((x) => `file '${x}'`)
116
- .join('\n');
144
+ const configContent = mediaFiles.map((x) => `file '${x}'`).join('\n');
117
145
  const configFile = path_1.default.resolve(path_1.default.dirname(mediaFiles[0]), 'config.txt');
118
146
  await support_1.fs.writeFile(configFile, configContent, 'utf8');
119
147
  log?.debug(`Generated ffmpeg merging config '${configFile}' with items:\n${configContent}`);
120
- const result = path_1.default.resolve(path_1.default.dirname(mediaFiles[0]), `merge_${Math.floor(new Date())}${DEFAULT_EXT}`);
148
+ const result = path_1.default.resolve(path_1.default.dirname(mediaFiles[0]), `merge_${Math.floor(+new Date())}${DEFAULT_EXT}`);
121
149
  const args = ['-safe', '0', '-f', 'concat', '-i', configFile, '-c', 'copy', result];
122
150
  log?.info(`Initiating screen records merging using the command '${FFMPEG_BINARY} ${args.join(' ')}'`);
123
151
  await (0, teen_process_1.exec)(FFMPEG_BINARY, args);
124
152
  return result;
125
153
  }
154
+ /**
155
+ *
156
+ * @param {ADB} adb
157
+ * @param {boolean} force
158
+ * @returns {Promise<boolean>}
159
+ */
126
160
  async function terminateBackgroundScreenRecording(adb, force = true) {
127
- const pids = (await adb.getPIDsByName(SCREENRECORD_BINARY))
128
- .map((p) => `${p}`);
161
+ const pids = (await adb.getPIDsByName(SCREENRECORD_BINARY)).map((p) => `${p}`);
129
162
  if (lodash_1.default.isEmpty(pids)) {
130
163
  return false;
131
164
  }
@@ -138,185 +171,121 @@ async function terminateBackgroundScreenRecording(adb, force = true) {
138
171
  return true;
139
172
  }
140
173
  catch (err) {
141
- throw new Error(`Unable to stop the background screen recording: ${err.message}`);
174
+ throw new Error(`Unable to stop the background screen recording: ${ /** @type {Error} */(err).message}`);
142
175
  }
143
176
  }
144
177
  /**
145
- * @typedef {Object} StartRecordingOptions
146
- *
147
- * @property {?string} remotePath - The path to the remote location, where the captured video should be uploaded.
148
- * The following protocols are supported: http/https, ftp.
149
- * Null or empty string value (the default setting) means the content of resulting
150
- * file should be encoded as Base64 and passed as the endpount response value.
151
- * An exception will be thrown if the generated media file is too big to
152
- * fit into the available process memory.
153
- * This option only has an effect if there is screen recording process in progreess
154
- * and `forceRestart` parameter is not set to `true`.
155
- * @property {?string} user - The name of the user for the remote authentication. Only works if `remotePath` is provided.
156
- * @property {?string} pass - The password for the remote authentication. Only works if `remotePath` is provided.
157
- * @property {?string} method [PUT] - The http multipart upload method name. Only works if `remotePath` is provided.
158
- * @property {?Object} headers - Additional headers mapping for multipart http(s) uploads
159
- * @property {?string} fileFieldName [file] - The name of the form field, where the file content BLOB should be stored for
160
- * http(s) uploads
161
- * @property {?Object|Array<Pair>} formFields - Additional form fields for multipart http(s) uploads
162
- * @property {?string} videoSize - The format is widthxheight.
163
- * The default value is the device's native display resolution (if supported),
164
- * 1280x720 if not. For best results,
165
- * use a size supported by your device's Advanced Video Coding (AVC) encoder.
166
- * For example, "1280x720"
167
- * @property {?boolean} bugReport - Set it to `true` in order to display additional information on the video overlay,
168
- * such as a timestamp, that is helpful in videos captured to illustrate bugs.
169
- * This option is only supported since API level 27 (Android P).
170
- * @property {?string|number} timeLimit - The maximum recording time, in seconds. The default value is 180 (3 minutes).
171
- * The maximum value is 1800 (30 minutes). If the passed value is greater than 180 then
172
- * the algorithm will try to schedule multiple screen recording chunks and merge the
173
- * resulting videos into a single media file using `ffmpeg` utility.
174
- * If the utility is not available in PATH then the most recent screen recording chunk is
175
- * going to be returned.
176
- * @property {?string|number} bitRate - The video bit rate for the video, in bits per second.
177
- * The default value is 4000000 (4 Mbit/s). You can increase the bit rate to improve video quality,
178
- * but doing so results in larger movie files.
179
- * @property {?boolean} forceRestart - Whether to try to catch and upload/return the currently running screen recording
180
- * (`false`, the default setting) or ignore the result of it and start a new recording
181
- * immediately (`true`).
182
- */
183
- /**
184
- * Record the display of a real devices running Android 4.4 (API level 19) and higher.
185
- * Emulators are supported since API level 27 (Android P).
186
- * It records screen activity to an MPEG-4 file. Audio is not recorded with the video file.
187
- * If screen recording has been already started then the command will stop it forcefully and start a new one.
188
- * The previously recorded video file will be deleted.
189
- *
190
- * @param {?StartRecordingOptions} options - The available options.
191
- * @returns {string} Base64-encoded content of the recorded media file if
192
- * any screen recording is currently running or an empty string.
193
- * @throws {Error} If screen recording has failed to start or is not supported on the device under test.
178
+ * @type {import('./mixins').RecordScreenMixin & ThisType<import('../driver').AndroidDriver>}
179
+ * @satisfies {import('@appium/types').ExternalDriver}
194
180
  */
195
- commands.startRecordingScreen = async function startRecordingScreen(options = {}) {
196
- await verifyScreenRecordIsSupported(this.adb, this.isEmulator());
197
- let result = '';
198
- const { videoSize, timeLimit = DEFAULT_RECORDING_TIME_SEC, bugReport, bitRate, forceRestart } = options;
199
- if (!forceRestart) {
200
- result = await this.stopRecordingScreen(options);
201
- }
202
- if (await terminateBackgroundScreenRecording(this.adb, true)) {
203
- this.log.warn(`There were some ${SCREENRECORD_BINARY} process leftovers running ` +
204
- `in the background. Make sure you stop screen recording each time after it is started, ` +
205
- `otherwise the recorded media might quickly exceed all the free space on the device under test.`);
206
- }
207
- if (!lodash_1.default.isEmpty(this._screenRecordingProperties)) {
208
- for (const record of (this._screenRecordingProperties.records || [])) {
209
- await this.adb.rimraf(record);
181
+ const RecordScreenMixin = {
182
+ async startRecordingScreen(options = {}) {
183
+ const adb = /** @type {ADB} */ (this.adb);
184
+ await verifyScreenRecordIsSupported(adb, this.isEmulator());
185
+ let result = '';
186
+ const { videoSize, timeLimit = DEFAULT_RECORDING_TIME_SEC, bugReport, bitRate, forceRestart, } = options;
187
+ if (!forceRestart) {
188
+ result = await this.stopRecordingScreen(options);
189
+ }
190
+ if (await terminateBackgroundScreenRecording(adb, true)) {
191
+ this.log.warn(`There were some ${SCREENRECORD_BINARY} process leftovers running ` +
192
+ `in the background. Make sure you stop screen recording each time after it is started, ` +
193
+ `otherwise the recorded media might quickly exceed all the free space on the device under test.`);
210
194
  }
211
- this._screenRecordingProperties = null;
212
- }
213
- const timeout = parseFloat(timeLimit);
214
- if (isNaN(timeout) || timeout > MAX_TIME_SEC || timeout <= 0) {
215
- throw new Error(`The timeLimit value must be in range [1, ${MAX_TIME_SEC}] seconds. ` +
216
- `The value of '${timeLimit}' has been passed instead.`);
217
- }
218
- this._screenRecordingProperties = {
219
- timer: new support_1.timing.Timer().start(),
220
- videoSize,
221
- timeLimit,
222
- currentTimeLimit: timeLimit,
223
- bitRate,
224
- bugReport,
225
- records: [],
226
- recordingProcess: null,
227
- stopped: false,
228
- };
229
- await scheduleScreenRecord(this.adb, this._screenRecordingProperties, this.log);
230
- return result;
231
- };
232
- /**
233
- * @typedef {Object} StopRecordingOptions
234
- *
235
- * @property {?string} remotePath - The path to the remote location, where the resulting video should be uploaded.
236
- * The following protocols are supported: http/https, ftp.
237
- * Null or empty string value (the default setting) means the content of resulting
238
- * file should be encoded as Base64 and passed as the endpount response value.
239
- * An exception will be thrown if the generated media file is too big to
240
- * fit into the available process memory.
241
- * @property {?string} user - The name of the user for the remote authentication.
242
- * @property {?string} pass - The password for the remote authentication.
243
- * @property {?string} method - The http multipart upload method name. The 'PUT' one is used by default.
244
- * @property {?Object} headers - Additional headers mapping for multipart http(s) uploads
245
- * @property {?string} fileFieldName [file] - The name of the form field, where the file content BLOB should be stored for
246
- * http(s) uploads
247
- * @property {?Object|Array<Pair>} formFields - Additional form fields for multipart http(s) uploads
248
- */
249
- /**
250
- * Stop recording the screen.
251
- * If no screen recording has been started before then the method returns an empty string.
252
- *
253
- * @param {?StopRecordingOptions} options - The available options.
254
- * @returns {string} Base64-encoded content of the recorded media file if 'remotePath'
255
- * parameter is falsy or an empty string.
256
- * @throws {Error} If there was an error while getting the name of a media file
257
- * or the file content cannot be uploaded to the remote location
258
- * or screen recording is not supported on the device under test.
259
- */
260
- commands.stopRecordingScreen = async function stopRecordingScreen(options = {}) {
261
- await verifyScreenRecordIsSupported(this.adb, this.isEmulator());
262
- if (!lodash_1.default.isEmpty(this._screenRecordingProperties)) {
263
- this._screenRecordingProperties.stopped = true;
264
- }
265
- try {
266
- await terminateBackgroundScreenRecording(this.adb, false);
267
- }
268
- catch (err) {
269
- this.log.warn(err.message);
270
195
  if (!lodash_1.default.isEmpty(this._screenRecordingProperties)) {
271
- this.log.warn('The resulting video might be corrupted');
196
+ // XXX: this doesn't need to be done in serial, does it?
197
+ for (const record of this._screenRecordingProperties.records || []) {
198
+ await /** @type {ADB} */ (this.adb).rimraf(record);
199
+ }
200
+ this._screenRecordingProperties = undefined;
201
+ }
202
+ const timeout = parseFloat(String(timeLimit));
203
+ if (isNaN(timeout) || timeout > MAX_TIME_SEC || timeout <= 0) {
204
+ throw new Error(`The timeLimit value must be in range [1, ${MAX_TIME_SEC}] seconds. ` +
205
+ `The value of '${timeLimit}' has been passed instead.`);
206
+ }
207
+ this._screenRecordingProperties = {
208
+ timer: new support_1.timing.Timer().start(),
209
+ videoSize,
210
+ timeLimit,
211
+ currentTimeLimit: timeLimit,
212
+ bitRate,
213
+ bugReport,
214
+ records: [],
215
+ recordingProcess: null,
216
+ stopped: false,
217
+ };
218
+ await scheduleScreenRecord(adb, this._screenRecordingProperties, this.log);
219
+ return result;
220
+ },
221
+ async stopRecordingScreen(options = {}) {
222
+ const adb = /** @type {ADB} */ (this.adb);
223
+ await verifyScreenRecordIsSupported(adb, this.isEmulator());
224
+ if (!lodash_1.default.isEmpty(this._screenRecordingProperties)) {
225
+ this._screenRecordingProperties.stopped = true;
272
226
  }
273
- }
274
- if (lodash_1.default.isEmpty(this._screenRecordingProperties)) {
275
- this.log.info(`Screen recording has not been previously started by Appium. There is nothing to stop`);
276
- return '';
277
- }
278
- if (this._screenRecordingProperties.recordingProcess && this._screenRecordingProperties.recordingProcess.isRunning) {
279
227
  try {
280
- await this._screenRecordingProperties.recordingProcess.stop('SIGINT', PROCESS_SHUTDOWN_TIMEOUT);
228
+ await terminateBackgroundScreenRecording(adb, false);
281
229
  }
282
- catch (e) {
283
- this.log.errorAndThrow(`Unable to stop screen recording within ${PROCESS_SHUTDOWN_TIMEOUT}ms`);
230
+ catch (err) {
231
+ this.log.warn(/** @type {Error} */ (err).message);
232
+ if (!lodash_1.default.isEmpty(this._screenRecordingProperties)) {
233
+ this.log.warn('The resulting video might be corrupted');
234
+ }
284
235
  }
285
- this._screenRecordingProperties.recordingProcess = null;
286
- }
287
- if (lodash_1.default.isEmpty(this._screenRecordingProperties.records)) {
288
- this.log.errorAndThrow(`No screen recordings have been stored on the device so far. ` +
289
- `Are you sure the ${SCREENRECORD_BINARY} utility works as expected?`);
290
- }
291
- const tmpRoot = await support_1.tempDir.openDir();
292
- try {
293
- const localRecords = [];
294
- for (const pathOnDevice of this._screenRecordingProperties.records) {
295
- localRecords.push(path_1.default.resolve(tmpRoot, path_1.default.posix.basename(pathOnDevice)));
296
- await this.adb.pull(pathOnDevice, lodash_1.default.last(localRecords));
297
- await this.adb.rimraf(pathOnDevice);
236
+ if (lodash_1.default.isEmpty(this._screenRecordingProperties)) {
237
+ this.log.info(`Screen recording has not been previously started by Appium. There is nothing to stop`);
238
+ return '';
298
239
  }
299
- let resultFilePath = lodash_1.default.last(localRecords);
300
- if (localRecords.length > 1) {
301
- this.log.info(`Got ${localRecords.length} screen recordings. Trying to merge them`);
240
+ if (this._screenRecordingProperties.recordingProcess &&
241
+ this._screenRecordingProperties.recordingProcess.isRunning) {
302
242
  try {
303
- resultFilePath = await mergeScreenRecords(localRecords, this.log);
243
+ await this._screenRecordingProperties.recordingProcess.stop('SIGINT', PROCESS_SHUTDOWN_TIMEOUT);
304
244
  }
305
245
  catch (e) {
306
- this.log.warn(`Cannot merge the recorded files. The most recent screen recording is going to be returned as the result. ` +
307
- `Original error: ${e.message}`);
246
+ this.log.errorAndThrow(`Unable to stop screen recording within ${PROCESS_SHUTDOWN_TIMEOUT}ms`);
308
247
  }
248
+ this._screenRecordingProperties.recordingProcess = null;
309
249
  }
310
- if (lodash_1.default.isEmpty(options.remotePath)) {
311
- const { size } = await support_1.fs.stat(resultFilePath);
312
- this.log.debug(`The size of the resulting screen recording is ${support_1.util.toReadableSizeString(size)}`);
250
+ if (lodash_1.default.isEmpty(this._screenRecordingProperties.records)) {
251
+ this.log.errorAndThrow(`No screen recordings have been stored on the device so far. ` +
252
+ `Are you sure the ${SCREENRECORD_BINARY} utility works as expected?`);
313
253
  }
314
- return await uploadRecordedMedia(resultFilePath, options.remotePath, options);
315
- }
316
- finally {
317
- await support_1.fs.rimraf(tmpRoot);
318
- this._screenRecordingProperties = null;
319
- }
254
+ const tmpRoot = await support_1.tempDir.openDir();
255
+ try {
256
+ const localRecords = [];
257
+ for (const pathOnDevice of this._screenRecordingProperties.records) {
258
+ const relativePath = path_1.default.resolve(tmpRoot, path_1.default.posix.basename(pathOnDevice));
259
+ localRecords.push(relativePath);
260
+ await adb.pull(pathOnDevice, relativePath);
261
+ await adb.rimraf(pathOnDevice);
262
+ }
263
+ let resultFilePath = /** @type {string} */ (lodash_1.default.last(localRecords));
264
+ if (localRecords.length > 1) {
265
+ this.log.info(`Got ${localRecords.length} screen recordings. Trying to merge them`);
266
+ try {
267
+ resultFilePath = await mergeScreenRecords(localRecords, this.log);
268
+ }
269
+ catch (e) {
270
+ this.log.warn(`Cannot merge the recorded files. The most recent screen recording is going to be returned as the result. ` +
271
+ `Original error: ${ /** @type {Error} */(e).message}`);
272
+ }
273
+ }
274
+ if (lodash_1.default.isEmpty(options.remotePath)) {
275
+ const { size } = await support_1.fs.stat(resultFilePath);
276
+ this.log.debug(`The size of the resulting screen recording is ${support_1.util.toReadableSizeString(size)}`);
277
+ }
278
+ return await uploadRecordedMedia(resultFilePath, options.remotePath, options);
279
+ }
280
+ finally {
281
+ await support_1.fs.rimraf(tmpRoot);
282
+ this._screenRecordingProperties = undefined;
283
+ }
284
+ },
320
285
  };
321
- exports.default = commands;
286
+ (0, mixins_1.mixin)(RecordScreenMixin);
287
+ exports.default = RecordScreenMixin;
288
+ /**
289
+ * @typedef {import('appium-adb').ADB} ADB
290
+ */
322
291
  //# sourceMappingURL=recordscreen.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"recordscreen.js","sourceRoot":"","sources":["../../../lib/commands/recordscreen.js"],"names":[],"mappings":";;;;;;AAAA,oDAAuB;AACvB,uCAA4C;AAC5C,6CAAyE;AACzE,+CAAoC;AACpC,gDAAwB;AAGxB,MAAM,QAAQ,GAAG,EAAE,CAAC;AAmVX,4BAAQ;AAjVjB,MAAM,WAAW,GAAG,GAAG,CAAC;AACxB,MAAM,aAAa,GAAG,IAAI,CAAC;AAC3B,MAAM,sBAAsB,GAAG,EAAE,GAAG,CAAC,CAAC;AACtC,MAAM,YAAY,GAAG,EAAE,GAAG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gBAAS;YACR,MAAM,YAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;YACzB,IAAI,CAAC,0BAA0B,GAAG,SAAS,CAAC;SAC7C;IACH,CAAC;CACF,CAAC;AAEF,IAAA,cAAK,EAAC,iBAAiB,CAAC,CAAC;AAEzB,kBAAe,iBAAiB,CAAC;AAEjC;;GAEG"}
@@ -1,8 +1,8 @@
1
- export default commands;
2
- export namespace commands {
3
- function mobileShell(opts?: {}): Promise<string | {
4
- stdout: string;
5
- stderr: string;
6
- } | undefined>;
7
- }
1
+ export default ShellMixin;
2
+ export type ADB = import('appium-adb').ADB;
3
+ /**
4
+ * @type {import('./mixins').ShellMixin & ThisType<import('../driver').AndroidDriver>}
5
+ * @satisfies {import('@appium/types').ExternalDriver}
6
+ */
7
+ declare const ShellMixin: import('./mixins').ShellMixin & ThisType<import('../driver').AndroidDriver>;
8
8
  //# sourceMappingURL=shell.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"shell.d.ts","sourceRoot":"","sources":["../../../lib/commands/shell.js"],"names":[],"mappings":";;IAQA;;;mBAmCC"}
1
+ {"version":3,"file":"shell.d.ts","sourceRoot":"","sources":["../../../lib/commands/shell.js"],"names":[],"mappings":";kBAwDa,OAAO,YAAY,EAAE,GAAG;AA/CrC;;;GAGG;AACH,0BAHU,OAAO,UAAU,EAAE,UAAU,GAAG,SAAS,OAAO,WAAW,EAAE,aAAa,CAAC,CAuCnF"}
@@ -1,44 +1,51 @@
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 lodash_1 = __importDefault(require("lodash"));
8
- const teen_process_1 = require("teen_process");
9
7
  const support_1 = require("@appium/support");
10
8
  const driver_1 = require("appium/driver");
9
+ const lodash_1 = __importDefault(require("lodash"));
10
+ const teen_process_1 = require("teen_process");
11
11
  const utils_1 = require("../utils");
12
- const commands = {};
13
- exports.commands = commands;
14
- commands.mobileShell = async function mobileShell(opts = {}) {
15
- this.ensureFeatureEnabled(utils_1.ADB_SHELL_FEATURE);
16
- const { command, args = [], timeout = 20000, includeStderr, } = opts;
17
- if (!lodash_1.default.isString(command)) {
18
- throw new driver_1.errors.InvalidArgumentError(`The 'command' argument is mandatory`);
19
- }
20
- const adbArgs = [
21
- ...this.adb.executable.defaultArgs,
22
- 'shell',
23
- command,
24
- ...(lodash_1.default.isArray(args) ? args : [args])
25
- ];
26
- this.log.debug(`Running '${this.adb.executable.path} ${support_1.util.quote(adbArgs)}'`);
27
- try {
28
- const { stdout, stderr } = await (0, teen_process_1.exec)(this.adb.executable.path, adbArgs, { timeout });
29
- if (includeStderr) {
30
- return {
31
- stdout,
32
- stderr
33
- };
12
+ const mixins_1 = require("./mixins");
13
+ /**
14
+ * @type {import('./mixins').ShellMixin & ThisType<import('../driver').AndroidDriver>}
15
+ * @satisfies {import('@appium/types').ExternalDriver}
16
+ */
17
+ const ShellMixin = {
18
+ async mobileShell(opts) {
19
+ this.ensureFeatureEnabled(utils_1.ADB_SHELL_FEATURE);
20
+ const adb = /** @type {ADB} */ (this.adb);
21
+ const { command, args = /** @type {string[]} */ ([]), timeout = 20000, includeStderr, } = opts ?? {};
22
+ if (!lodash_1.default.isString(command)) {
23
+ throw new driver_1.errors.InvalidArgumentError(`The 'command' argument is mandatory`);
24
+ }
25
+ const adbArgs = [...adb.executable.defaultArgs, 'shell', command, ...lodash_1.default.castArray(args)];
26
+ this.log.debug(`Running '${adb.executable.path} ${support_1.util.quote(adbArgs)}'`);
27
+ try {
28
+ const { stdout, stderr } = await (0, teen_process_1.exec)(adb.executable.path, adbArgs, { timeout });
29
+ if (includeStderr) {
30
+ return {
31
+ stdout,
32
+ stderr,
33
+ };
34
+ }
35
+ return stdout;
36
+ }
37
+ catch (e) {
38
+ const err = /** @type {import('teen_process').ExecError} */ (e);
39
+ this.log.errorAndThrow(`Cannot execute the '${command}' shell command. ` +
40
+ `Original error: ${err.message}. ` +
41
+ `StdOut: ${err.stdout}. StdErr: ${err.stderr}`);
42
+ throw new Error(); // unreachable; for TS
34
43
  }
35
- return stdout;
36
- }
37
- catch (err) {
38
- this.log.errorAndThrow(`Cannot execute the '${command}' shell command. ` +
39
- `Original error: ${err.message}. ` +
40
- `StdOut: ${err.stdout}. StdErr: ${err.stderr}`);
41
- }
44
+ },
42
45
  };
43
- exports.default = commands;
46
+ (0, mixins_1.mixin)(ShellMixin);
47
+ exports.default = ShellMixin;
48
+ /**
49
+ * @typedef {import('appium-adb').ADB} ADB
50
+ */
44
51
  //# sourceMappingURL=shell.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"shell.js","sourceRoot":"","sources":["../../../lib/commands/shell.js"],"names":[],"mappings":";;;;;;AAAA,oDAAuB;AACvB,+CAAoC;AACpC,6CAAuC;AACvC,0CAAuC;AACvC,oCAA6C;AAE7C,MAAM,QAAQ,GAAG,EAAE,CAAC;AAuCX,4BAAQ;AArCjB,QAAQ,CAAC,WAAW,GAAG,KAAK,UAAU,WAAW,CAAE,IAAI,GAAG,EAAE;IAC1D,IAAI,CAAC,oBAAoB,CAAC,yBAAiB,CAAC,CAAC;IAE7C,MAAM,EACJ,OAAO,EACP,IAAI,GAAG,EAAE,EACT,OAAO,GAAG,KAAK,EACf,aAAa,GACd,GAAG,IAAI,CAAC;IAET,IAAI,CAAC,gBAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE;QACxB,MAAM,IAAI,eAAM,CAAC,oBAAoB,CAAC,qCAAqC,CAAC,CAAC;KAC9E;IAED,MAAM,OAAO,GAAG;QACd,GAAG,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,WAAW;QAClC,OAAO;QACP,OAAO;QACP,GAAG,CAAC,gBAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;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