appium-android-driver 5.14.7 → 6.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 (192) hide show
  1. package/build/index.d.ts +282 -0
  2. package/build/index.d.ts.map +1 -0
  3. package/build/index.js.map +1 -0
  4. package/build/lib/commands/actions.d.ts +6 -224
  5. package/build/lib/commands/actions.d.ts.map +1 -1
  6. package/build/lib/commands/actions.js +306 -405
  7. package/build/lib/commands/actions.js.map +1 -1
  8. package/build/lib/commands/alert.d.ts +7 -9
  9. package/build/lib/commands/alert.d.ts.map +1 -1
  10. package/build/lib/commands/alert.js +24 -18
  11. package/build/lib/commands/alert.js.map +1 -1
  12. package/build/lib/commands/app-management.d.ts +7 -313
  13. package/build/lib/commands/app-management.d.ts.map +1 -1
  14. package/build/lib/commands/app-management.js +135 -293
  15. package/build/lib/commands/app-management.js.map +1 -1
  16. package/build/lib/commands/context.d.ts +8 -92
  17. package/build/lib/commands/context.d.ts.map +1 -1
  18. package/build/lib/commands/context.js +381 -439
  19. package/build/lib/commands/context.js.map +1 -1
  20. package/build/lib/commands/element.d.ts +8 -35
  21. package/build/lib/commands/element.d.ts.map +1 -1
  22. package/build/lib/commands/element.js +153 -136
  23. package/build/lib/commands/element.js.map +1 -1
  24. package/build/lib/commands/emu-console.d.ts +6 -48
  25. package/build/lib/commands/emu-console.d.ts.map +1 -1
  26. package/build/lib/commands/emu-console.js +19 -34
  27. package/build/lib/commands/emu-console.js.map +1 -1
  28. package/build/lib/commands/execute.d.ts +6 -5
  29. package/build/lib/commands/execute.d.ts.map +1 -1
  30. package/build/lib/commands/execute.js +77 -66
  31. package/build/lib/commands/execute.js.map +1 -1
  32. package/build/lib/commands/file-actions.d.ts +7 -128
  33. package/build/lib/commands/file-actions.d.ts.map +1 -1
  34. package/build/lib/commands/file-actions.js +183 -219
  35. package/build/lib/commands/file-actions.js.map +1 -1
  36. package/build/lib/commands/find.d.ts +8 -12
  37. package/build/lib/commands/find.d.ts.map +1 -1
  38. package/build/lib/commands/find.js +19 -23
  39. package/build/lib/commands/find.js.map +1 -1
  40. package/build/lib/commands/general.d.ts +9 -132
  41. package/build/lib/commands/general.d.ts.map +1 -1
  42. package/build/lib/commands/general.js +281 -312
  43. package/build/lib/commands/general.js.map +1 -1
  44. package/build/lib/commands/ime.d.ts +7 -10
  45. package/build/lib/commands/ime.d.ts.map +1 -1
  46. package/build/lib/commands/ime.js +47 -35
  47. package/build/lib/commands/ime.js.map +1 -1
  48. package/build/lib/commands/index.d.ts +27 -2
  49. package/build/lib/commands/index.d.ts.map +1 -1
  50. package/build/lib/commands/index.js +41 -19
  51. package/build/lib/commands/index.js.map +1 -1
  52. package/build/lib/commands/intent.d.ts +7 -417
  53. package/build/lib/commands/intent.d.ts.map +1 -1
  54. package/build/lib/commands/intent.js +104 -216
  55. package/build/lib/commands/intent.js.map +1 -1
  56. package/build/lib/commands/keyboard.d.ts +6 -5
  57. package/build/lib/commands/keyboard.d.ts.map +1 -1
  58. package/build/lib/commands/keyboard.js +16 -8
  59. package/build/lib/commands/keyboard.js.map +1 -1
  60. package/build/lib/commands/log.d.ts +7 -44
  61. package/build/lib/commands/log.d.ts.map +1 -1
  62. package/build/lib/commands/log.js +146 -108
  63. package/build/lib/commands/log.js.map +1 -1
  64. package/build/lib/commands/media-projection.d.ts +7 -143
  65. package/build/lib/commands/media-projection.d.ts.map +1 -1
  66. package/build/lib/commands/media-projection.js +113 -140
  67. package/build/lib/commands/media-projection.js.map +1 -1
  68. package/build/lib/commands/mixins.d.ts +740 -0
  69. package/build/lib/commands/mixins.d.ts.map +1 -0
  70. package/build/lib/commands/mixins.js +19 -0
  71. package/build/lib/commands/mixins.js.map +1 -0
  72. package/build/lib/commands/network.d.ts +7 -138
  73. package/build/lib/commands/network.d.ts.map +1 -1
  74. package/build/lib/commands/network.js +212 -254
  75. package/build/lib/commands/network.js.map +1 -1
  76. package/build/lib/commands/performance.d.ts +24 -70
  77. package/build/lib/commands/performance.d.ts.map +1 -1
  78. package/build/lib/commands/performance.js +144 -100
  79. package/build/lib/commands/performance.js.map +1 -1
  80. package/build/lib/commands/permissions.d.ts +8 -92
  81. package/build/lib/commands/permissions.d.ts.map +1 -1
  82. package/build/lib/commands/permissions.js +75 -87
  83. package/build/lib/commands/permissions.js.map +1 -1
  84. package/build/lib/commands/recordscreen.d.ts +7 -193
  85. package/build/lib/commands/recordscreen.d.ts.map +1 -1
  86. package/build/lib/commands/recordscreen.js +151 -182
  87. package/build/lib/commands/recordscreen.js.map +1 -1
  88. package/build/lib/commands/shell.d.ts +7 -7
  89. package/build/lib/commands/shell.d.ts.map +1 -1
  90. package/build/lib/commands/shell.js +40 -33
  91. package/build/lib/commands/shell.js.map +1 -1
  92. package/build/lib/commands/streamscreen.d.ts +9 -103
  93. package/build/lib/commands/streamscreen.d.ts.map +1 -1
  94. package/build/lib/commands/streamscreen.js +261 -218
  95. package/build/lib/commands/streamscreen.js.map +1 -1
  96. package/build/lib/commands/system-bars.d.ts +22 -90
  97. package/build/lib/commands/system-bars.d.ts.map +1 -1
  98. package/build/lib/commands/system-bars.js +76 -74
  99. package/build/lib/commands/system-bars.js.map +1 -1
  100. package/build/lib/commands/touch.d.ts +10 -29
  101. package/build/lib/commands/touch.d.ts.map +1 -1
  102. package/build/lib/commands/touch.js +301 -285
  103. package/build/lib/commands/touch.js.map +1 -1
  104. package/build/lib/commands/types.d.ts +978 -0
  105. package/build/lib/commands/types.d.ts.map +1 -0
  106. package/build/lib/commands/types.js +3 -0
  107. package/build/lib/commands/types.js.map +1 -0
  108. package/build/lib/constraints.d.ts +291 -0
  109. package/build/lib/constraints.d.ts.map +1 -0
  110. package/build/lib/constraints.js +300 -0
  111. package/build/lib/constraints.js.map +1 -0
  112. package/build/lib/driver.d.ts +68 -37
  113. package/build/lib/driver.d.ts.map +1 -1
  114. package/build/lib/driver.js +123 -80
  115. package/build/lib/driver.js.map +1 -1
  116. package/build/lib/helpers/android.d.ts +164 -0
  117. package/build/lib/helpers/android.d.ts.map +1 -0
  118. package/build/lib/helpers/android.js +819 -0
  119. package/build/lib/helpers/android.js.map +1 -0
  120. package/build/lib/helpers/index.d.ts +7 -0
  121. package/build/lib/helpers/index.d.ts.map +1 -0
  122. package/build/lib/helpers/index.js +29 -0
  123. package/build/lib/helpers/index.js.map +1 -0
  124. package/build/lib/helpers/types.d.ts +121 -0
  125. package/build/lib/helpers/types.d.ts.map +1 -0
  126. package/build/lib/helpers/types.js +3 -0
  127. package/build/lib/helpers/types.js.map +1 -0
  128. package/build/lib/helpers/unlock.d.ts +32 -0
  129. package/build/lib/helpers/unlock.d.ts.map +1 -0
  130. package/build/lib/helpers/unlock.js +273 -0
  131. package/build/lib/helpers/unlock.js.map +1 -0
  132. package/build/lib/helpers/webview.d.ts +74 -0
  133. package/build/lib/helpers/webview.d.ts.map +1 -0
  134. package/build/lib/helpers/webview.js +421 -0
  135. package/build/lib/helpers/webview.js.map +1 -0
  136. package/build/lib/index.d.ts +9 -0
  137. package/build/lib/index.d.ts.map +1 -0
  138. package/build/lib/index.js +37 -0
  139. package/build/lib/index.js.map +1 -0
  140. package/build/lib/method-map.d.ts +0 -8
  141. package/build/lib/method-map.d.ts.map +1 -1
  142. package/build/lib/method-map.js +63 -74
  143. package/build/lib/method-map.js.map +1 -1
  144. package/build/lib/stubs.d.ts +0 -1
  145. package/build/lib/stubs.d.ts.map +1 -1
  146. package/build/lib/stubs.js +1 -0
  147. package/build/lib/stubs.js.map +1 -1
  148. package/build/lib/utils.d.ts +1 -1
  149. package/build/lib/utils.d.ts.map +1 -1
  150. package/lib/commands/actions.js +351 -464
  151. package/lib/commands/alert.js +27 -17
  152. package/lib/commands/app-management.js +156 -314
  153. package/lib/commands/context.js +457 -441
  154. package/lib/commands/element.js +201 -157
  155. package/lib/commands/emu-console.js +25 -45
  156. package/lib/commands/execute.js +106 -90
  157. package/lib/commands/file-actions.js +222 -240
  158. package/lib/commands/find.ts +103 -0
  159. package/lib/commands/general.js +327 -339
  160. package/lib/commands/ime.js +50 -34
  161. package/lib/commands/{index.js → index.ts} +20 -24
  162. package/lib/commands/intent.js +108 -249
  163. package/lib/commands/keyboard.js +20 -8
  164. package/lib/commands/log.js +172 -116
  165. package/lib/commands/media-projection.js +134 -161
  166. package/lib/commands/mixins.ts +966 -0
  167. package/lib/commands/network.js +252 -281
  168. package/lib/commands/performance.js +203 -132
  169. package/lib/commands/permissions.js +108 -109
  170. package/lib/commands/recordscreen.js +212 -209
  171. package/lib/commands/shell.js +51 -40
  172. package/lib/commands/streamscreen.js +355 -289
  173. package/lib/commands/system-bars.js +92 -83
  174. package/lib/commands/touch.js +357 -294
  175. package/lib/commands/types.ts +1097 -0
  176. package/lib/{desired-caps.js → constraints.ts} +106 -103
  177. package/lib/{driver.js → driver.ts} +278 -132
  178. package/lib/helpers/android.ts +1143 -0
  179. package/lib/helpers/index.ts +6 -0
  180. package/lib/helpers/types.ts +134 -0
  181. package/lib/helpers/unlock.ts +329 -0
  182. package/lib/helpers/webview.ts +582 -0
  183. package/lib/index.ts +18 -0
  184. package/lib/method-map.js +87 -98
  185. package/lib/stubs.ts +0 -1
  186. package/package.json +27 -20
  187. package/index.js +0 -24
  188. package/lib/android-helpers.js +0 -983
  189. package/lib/commands/coverage.js +0 -18
  190. package/lib/commands/find.js +0 -82
  191. package/lib/unlock-helpers.js +0 -278
  192. package/lib/webview-helpers.js +0 -602
@@ -1,20 +1,19 @@
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
7
  const lodash_1 = __importDefault(require("lodash"));
8
8
  const support_1 = require("@appium/support");
9
9
  const path_1 = __importDefault(require("path"));
10
10
  const driver_1 = require("appium/driver");
11
11
  const utils_1 = require("../utils");
12
+ const mixins_1 = require("./mixins");
12
13
  const CONTAINER_PATH_MARKER = '@';
13
14
  // https://regex101.com/r/PLdB0G/2
14
15
  const CONTAINER_PATH_PATTERN = new RegExp(`^${CONTAINER_PATH_MARKER}([^/]+)/(.+)`);
15
16
  const ANDROID_MEDIA_RESCAN_INTENT = 'android.intent.action.MEDIA_SCANNER_SCAN_FILE';
16
- const commands = {};
17
- exports.commands = commands;
18
17
  /**
19
18
  * Parses the actual destination path from the given value
20
19
  *
@@ -38,26 +37,31 @@ function parseContainerPath(remotePath) {
38
37
  * Exceptions are ignored and written into the log.
39
38
  *
40
39
  * @param {ADB} adb ADB instance
41
- * @param {Object?} log Logger instance
42
40
  * @param {string} remotePath The file/folder path on the remote device
41
+ * @param {import('@appium/types').AppiumLogger} [log] Logger instance
43
42
  */
44
- async function scanMedia(adb, remotePath, log = null) {
43
+ async function scanMedia(adb, remotePath, log) {
45
44
  log?.debug(`Performing media scan of '${remotePath}'`);
46
45
  try {
47
46
  // https://github.com/appium/appium/issues/16184
48
- if (await adb.getApiLevel() >= 29) {
47
+ if ((await adb.getApiLevel()) >= 29) {
49
48
  await adb.scanMedia(remotePath);
50
49
  }
51
50
  else {
52
51
  await adb.shell([
53
- 'am', 'broadcast',
54
- '-a', ANDROID_MEDIA_RESCAN_INTENT,
55
- '-d', `file://${remotePath}`
52
+ 'am',
53
+ 'broadcast',
54
+ '-a',
55
+ ANDROID_MEDIA_RESCAN_INTENT,
56
+ '-d',
57
+ `file://${remotePath}`,
56
58
  ]);
57
59
  }
58
60
  }
59
61
  catch (e) {
60
- log?.warn(`Ignoring an unexpected error upon media scanning of '${remotePath}': ${e.stderr || e.message}`);
62
+ const err = /** @type {any} */ (e);
63
+ // FIXME: what has a `stderr` prop?
64
+ log?.warn(`Ignoring an unexpected error upon media scanning of '${remotePath}': ${err.stderr ?? err.message}`);
61
65
  }
62
66
  }
63
67
  /**
@@ -71,187 +75,181 @@ function escapePath(p) {
71
75
  return p.replace(/'/g, `\\'`);
72
76
  }
73
77
  /**
74
- * Pulls a remote file from the device.
75
- * It is required, that a package has debugging flag enabled
76
- * in order to access its files.
77
- *
78
- * @param {string} remotePath The full path to the remote file
79
- * or a specially formatted path, which points to an item inside app bundle
80
- * @returns {string} Base64 encoded content of the pulled file
81
- * @throws {Error} If the pull operation failed
78
+ * @type {import('./mixins').FileActionsMixin & ThisType<import('../driver').AndroidDriver>}
79
+ * @satisfies {import('@appium/types').ExternalDriver}
82
80
  */
83
- commands.pullFile = async function pullFile(remotePath) {
84
- if (remotePath.endsWith('/')) {
85
- throw new driver_1.errors.InvalidArgumentError(`It is expected that remote path points to a file and not to a folder. ` +
86
- `'${remotePath}' is given instead`);
87
- }
88
- let tmpDestination = null;
89
- if (remotePath.startsWith(CONTAINER_PATH_MARKER)) {
90
- const [packageId, pathInContainer] = parseContainerPath(remotePath);
91
- this.log.debug(`Parsed package identifier '${packageId}' from '${remotePath}'. Will get the data from '${pathInContainer}'`);
92
- tmpDestination = `/data/local/tmp/${path_1.default.posix.basename(pathInContainer)}`;
93
- try {
94
- await this.adb.shell(['run-as', packageId, `chmod 777 '${escapePath(pathInContainer)}'`]);
95
- await this.adb.shell([
96
- 'run-as', packageId,
97
- `cp -f '${escapePath(pathInContainer)}' '${escapePath(tmpDestination)}'`
98
- ]);
99
- }
100
- catch (e) {
101
- this.log.errorAndThrow(`Cannot access the container of '${packageId}' application. ` +
102
- `Is the application installed and has 'debuggable' build option set to true? ` +
103
- `Original error: ${e.message}`);
104
- }
105
- }
106
- const localFile = await support_1.tempDir.path({ prefix: 'appium', suffix: '.tmp' });
107
- try {
108
- await this.adb.pull(tmpDestination || remotePath, localFile);
109
- return (await support_1.util.toInMemoryBase64(localFile)).toString();
110
- }
111
- finally {
112
- if (await support_1.fs.exists(localFile)) {
113
- await support_1.fs.unlink(localFile);
114
- }
115
- if (tmpDestination) {
116
- await this.adb.shell(['rm', '-f', tmpDestination]);
81
+ const FileActionsMixin = {
82
+ async pullFile(remotePath) {
83
+ const adb = /** @type {ADB} */ (this.adb);
84
+ if (remotePath.endsWith('/')) {
85
+ throw new driver_1.errors.InvalidArgumentError(`It is expected that remote path points to a file and not to a folder. ` +
86
+ `'${remotePath}' is given instead`);
117
87
  }
118
- }
119
- };
120
- /**
121
- * @typedef {Object} PullFileOptions
122
- * @property {string} remotePath The full path to the remote file
123
- * or a specially formatted path, which points to an item inside an app bundle,
124
- * for example `@my.app.id/my/path`. It is mandatory for the app bundle to have
125
- * debugging enabled in order to use the latter remotePath format.
126
- */
127
- /**
128
- * Pulls a remote file from the device.
129
- *
130
- * @param {PullFileOptions} opts
131
- * @returns {string} The same as `pullFile`
132
- */
133
- commands.mobilePullFile = async function mobilePullFile(opts = {}) {
134
- const { remotePath } = (0, utils_1.requireArgs)('remotePath', opts);
135
- return await this.pullFile(remotePath);
136
- };
137
- /**
138
- * Pushes the given data to a file on the remote device
139
- * It is required, that a package has debugging flag enabled
140
- * in order to access its files.
141
- * After a file is pushed it gets automatically scanned for possible
142
- * media occurrences. If the scan succeeds then the file is added to the
143
- * media library.
144
- *
145
- * @param {string} remotePath The full path to the remote file or
146
- * a file inside a package bundle
147
- * @param {string} base64Data Base64 encoded data to be written to the
148
- * remote file. The remote file will be silently overridden if it already exists.
149
- * @throws {Error} If there was an error while pushing the data
150
- */
151
- commands.pushFile = async function pushFile(remotePath, base64Data) {
152
- if (remotePath.endsWith('/')) {
153
- throw new driver_1.errors.InvalidArgumentError(`It is expected that remote path points to a file and not to a folder. ` +
154
- `'${remotePath}' is given instead`);
155
- }
156
- const localFile = await support_1.tempDir.path({ prefix: 'appium', suffix: '.tmp' });
157
- if (lodash_1.default.isArray(base64Data)) {
158
- // some clients (ahem) java, send a byte array encoding utf8 characters
159
- // instead of a string, which would be infinitely better!
160
- base64Data = Buffer.from(base64Data).toString('utf8');
161
- }
162
- const content = Buffer.from(base64Data, 'base64');
163
- let tmpDestination = null;
164
- try {
165
- await support_1.fs.writeFile(localFile, content.toString('binary'), 'binary');
88
+ let tmpDestination = null;
166
89
  if (remotePath.startsWith(CONTAINER_PATH_MARKER)) {
167
90
  const [packageId, pathInContainer] = parseContainerPath(remotePath);
168
- this.log.debug(`Parsed package identifier '${packageId}' from '${remotePath}'. ` +
169
- `Will put the data into '${pathInContainer}'`);
91
+ this.log.debug(`Parsed package identifier '${packageId}' from '${remotePath}'. Will get the data from '${pathInContainer}'`);
170
92
  tmpDestination = `/data/local/tmp/${path_1.default.posix.basename(pathInContainer)}`;
171
93
  try {
172
- await this.adb.shell(['run-as', packageId, `mkdir -p '${escapePath(path_1.default.posix.dirname(pathInContainer))}'`]);
173
- await this.adb.shell(['run-as', packageId, `touch '${escapePath(pathInContainer)}'`]);
174
- await this.adb.shell(['run-as', packageId, `chmod 777 '${escapePath(pathInContainer)}'`]);
175
- await this.adb.push(localFile, tmpDestination);
176
- await this.adb.shell([
177
- 'run-as', packageId,
178
- `cp -f '${escapePath(tmpDestination)}' '${escapePath(pathInContainer)}'`
94
+ await adb.shell(['run-as', packageId, `chmod 777 '${escapePath(pathInContainer)}'`]);
95
+ await adb.shell([
96
+ 'run-as',
97
+ packageId,
98
+ `cp -f '${escapePath(pathInContainer)}' '${escapePath(tmpDestination)}'`,
179
99
  ]);
180
100
  }
181
101
  catch (e) {
182
102
  this.log.errorAndThrow(`Cannot access the container of '${packageId}' application. ` +
183
103
  `Is the application installed and has 'debuggable' build option set to true? ` +
184
- `Original error: ${e.message}`);
104
+ `Original error: ${ /** @type {Error} */(e).message}`);
185
105
  }
186
106
  }
187
- else {
188
- // adb push creates folders and overwrites existing files.
189
- await this.adb.push(localFile, remotePath);
190
- // if we have pushed a file, it might be a media file, so ensure that
191
- // apps know about it
192
- await scanMedia(this.adb, remotePath, this.log);
107
+ const localFile = await support_1.tempDir.path({ prefix: 'appium', suffix: '.tmp' });
108
+ try {
109
+ await adb.pull(tmpDestination || remotePath, localFile);
110
+ return (await support_1.util.toInMemoryBase64(localFile)).toString();
193
111
  }
194
- }
195
- finally {
196
- if (await support_1.fs.exists(localFile)) {
197
- await support_1.fs.unlink(localFile);
112
+ finally {
113
+ if (await support_1.fs.exists(localFile)) {
114
+ await support_1.fs.unlink(localFile);
115
+ }
116
+ if (tmpDestination) {
117
+ await adb.shell(['rm', '-f', tmpDestination]);
118
+ }
198
119
  }
199
- if (tmpDestination) {
200
- await this.adb.shell(['rm', '-f', tmpDestination]);
120
+ },
121
+ async mobilePullFile(opts) {
122
+ const { remotePath } = (0, utils_1.requireArgs)('remotePath', opts);
123
+ return await this.pullFile(remotePath);
124
+ },
125
+ async pushFile(remotePath, base64Data) {
126
+ if (remotePath.endsWith('/')) {
127
+ throw new driver_1.errors.InvalidArgumentError(`It is expected that remote path points to a file and not to a folder. ` +
128
+ `'${remotePath}' is given instead`);
201
129
  }
202
- }
203
- };
204
- /**
205
- * @typedef {Object} PushFileOptions
206
- * @property {string} remotePath The full path to the remote file
207
- * or a specially formatted path, which points to an item inside an app bundle,
208
- * for example `@my.app.id/my/path`. It is mandatory for the app bundle to have
209
- * debugging enabled in order to use the latter remotePath format.
210
- * @property {string} payload Base64-encoded content of the file to be pushed.
211
- */
212
- /**
213
- * Pushes the given data to a file on the remote device.
214
- *
215
- * @param {PushFileOptions} opts
216
- */
217
- commands.mobilePushFile = async function mobilePushFile(opts = {}) {
218
- const { remotePath, payload } = (0, utils_1.requireArgs)(['remotePath', 'payload'], opts);
219
- return await this.pushFile(remotePath, payload);
220
- };
221
- /**
222
- * Pulls the whole folder from the remote device
223
- *
224
- * @param {string} remotePath The full path to a folder on the
225
- * remote device or a folder inside an application bundle
226
- * @returns {string} Base64-encoded and zipped content of the folder
227
- * @throws {Error} If there was a failure while getting the folder content
228
- */
229
- commands.pullFolder = async function pullFolder(remotePath) {
230
- const tmpRoot = await support_1.tempDir.openDir();
231
- try {
232
- await this.adb.pull(remotePath, tmpRoot);
233
- return (await support_1.zip.toInMemoryZip(tmpRoot, {
234
- encodeToBase64: true,
235
- })).toString();
236
- }
237
- finally {
238
- await support_1.fs.rimraf(tmpRoot);
239
- }
130
+ const localFile = await support_1.tempDir.path({ prefix: 'appium', suffix: '.tmp' });
131
+ if (lodash_1.default.isArray(base64Data)) {
132
+ // some clients (ahem) java, send a byte array encoding utf8 characters
133
+ // instead of a string, which would be infinitely better!
134
+ base64Data = Buffer.from(base64Data).toString('utf8');
135
+ }
136
+ const content = Buffer.from(base64Data, 'base64');
137
+ let tmpDestination = null;
138
+ const adb = /** @type {ADB} */ (this.adb);
139
+ try {
140
+ await support_1.fs.writeFile(localFile, content.toString('binary'), 'binary');
141
+ if (remotePath.startsWith(CONTAINER_PATH_MARKER)) {
142
+ const [packageId, pathInContainer] = parseContainerPath(remotePath);
143
+ this.log.debug(`Parsed package identifier '${packageId}' from '${remotePath}'. ` +
144
+ `Will put the data into '${pathInContainer}'`);
145
+ tmpDestination = `/data/local/tmp/${path_1.default.posix.basename(pathInContainer)}`;
146
+ try {
147
+ await adb.shell([
148
+ 'run-as',
149
+ packageId,
150
+ `mkdir -p '${escapePath(path_1.default.posix.dirname(pathInContainer))}'`,
151
+ ]);
152
+ await adb.shell(['run-as', packageId, `touch '${escapePath(pathInContainer)}'`]);
153
+ await adb.shell(['run-as', packageId, `chmod 777 '${escapePath(pathInContainer)}'`]);
154
+ await adb.push(localFile, tmpDestination);
155
+ await adb.shell([
156
+ 'run-as',
157
+ packageId,
158
+ `cp -f '${escapePath(tmpDestination)}' '${escapePath(pathInContainer)}'`,
159
+ ]);
160
+ }
161
+ catch (e) {
162
+ this.log.errorAndThrow(`Cannot access the container of '${packageId}' application. ` +
163
+ `Is the application installed and has 'debuggable' build option set to true? ` +
164
+ `Original error: ${ /** @type {Error} */(e).message}`);
165
+ }
166
+ }
167
+ else {
168
+ // adb push creates folders and overwrites existing files.
169
+ await adb.push(localFile, remotePath);
170
+ // if we have pushed a file, it might be a media file, so ensure that
171
+ // apps know about it
172
+ await scanMedia(adb, remotePath, this.log);
173
+ }
174
+ }
175
+ finally {
176
+ if (await support_1.fs.exists(localFile)) {
177
+ await support_1.fs.unlink(localFile);
178
+ }
179
+ if (tmpDestination) {
180
+ await adb.shell(['rm', '-f', tmpDestination]);
181
+ }
182
+ }
183
+ },
184
+ async mobilePushFile(opts) {
185
+ const { remotePath, payload } = (0, utils_1.requireArgs)(['remotePath', 'payload'], opts);
186
+ return await this.pushFile(remotePath, payload);
187
+ },
188
+ async pullFolder(remotePath) {
189
+ const tmpRoot = await support_1.tempDir.openDir();
190
+ try {
191
+ await /** @type {ADB} */ (this.adb).pull(remotePath, tmpRoot);
192
+ return (await support_1.zip.toInMemoryZip(tmpRoot, {
193
+ encodeToBase64: true,
194
+ })).toString();
195
+ }
196
+ finally {
197
+ await support_1.fs.rimraf(tmpRoot);
198
+ }
199
+ },
200
+ async mobilePullFolder(opts) {
201
+ const { remotePath } = (0, utils_1.requireArgs)('remotePath', opts);
202
+ return await this.pullFolder(remotePath);
203
+ },
204
+ async mobileDeleteFile(opts) {
205
+ const { remotePath } = (0, utils_1.requireArgs)('remotePath', opts);
206
+ if (remotePath.endsWith('/')) {
207
+ throw new driver_1.errors.InvalidArgumentError(`It is expected that remote path points to a folder and not to a file. ` +
208
+ `'${remotePath}' is given instead`);
209
+ }
210
+ return await deleteFileOrFolder.call(this, /** @type {ADB} */ (this.adb), remotePath);
211
+ },
240
212
  };
241
213
  /**
242
- * @typedef {Object} PullFolderOptions
243
- * @property {string} remotePath The full path to the remote folder.
244
- */
245
- /**
246
- * Pulls the whole folder from the device under test.
247
- *
248
- * @param {PullFolderOptions} opts
249
- * @returns {string} The same as `pullFolder`
214
+ * Factory providing filesystem test functions using ADB
215
+ * @param {ADB} adb
250
216
  */
251
- commands.mobilePullFolder = async function mobilePullFolder(opts = {}) {
252
- const { remotePath } = (0, utils_1.requireArgs)('remotePath', opts);
253
- return await this.pullFolder(remotePath);
254
- };
217
+ function createFSTests(adb) {
218
+ /**
219
+ *
220
+ * @param {string} p
221
+ * @param {'d'|'f'|'e'} op
222
+ * @param {string} [runAs]
223
+ * @returns
224
+ */
225
+ const performRemoteFsCheck = async (p, op, runAs) => {
226
+ const passFlag = '__PASS__';
227
+ const checkCmd = `[ -${op} '${escapePath(p)}' ] && echo ${passFlag}`;
228
+ const fullCmd = runAs ? `run-as ${runAs} ${checkCmd}` : checkCmd;
229
+ try {
230
+ return lodash_1.default.includes(await adb.shell([fullCmd]), passFlag);
231
+ }
232
+ catch (ign) {
233
+ return false;
234
+ }
235
+ };
236
+ /**
237
+ * @param {string} p
238
+ * @param {string} [runAs]
239
+ */
240
+ const isFile = async (p, runAs) => await performRemoteFsCheck(p, 'f', runAs);
241
+ /**
242
+ * @param {string} p
243
+ * @param {string} [runAs]
244
+ */
245
+ const isDir = async (p, runAs) => await performRemoteFsCheck(p, 'd', runAs);
246
+ /**
247
+ * @param {string} p
248
+ * @param {string} [runAs]
249
+ */
250
+ const isPresent = async (p, runAs) => await performRemoteFsCheck(p, 'e', runAs);
251
+ return { isFile, isDir, isPresent };
252
+ }
255
253
  /**
256
254
  * Deletes the given folder or file from the remote device
257
255
  *
@@ -260,27 +258,16 @@ commands.mobilePullFolder = async function mobilePullFolder(opts = {}) {
260
258
  * or file (folder names must end with a single slash)
261
259
  * @throws {Error} If the provided remote path is invalid or
262
260
  * the package content cannot be accessed
263
- * @returns {boolean} `true` if the remote item has been successfully deleted.
261
+ * @returns {Promise<boolean>} `true` if the remote item has been successfully deleted.
264
262
  * If the remote path is valid, but the remote path does not exist
265
263
  * this function return `false`.
264
+ * @this {import('../driver').AndroidDriver}
266
265
  */
267
266
  async function deleteFileOrFolder(adb, remotePath) {
268
- const performRemoteFsCheck = async (p, op, runAs = null) => {
269
- const passFlag = '__PASS__';
270
- const checkCmd = `[ -${op} '${escapePath(p)}' ] && echo ${passFlag}`;
271
- const fullCmd = runAs ? `run-as ${runAs} ${checkCmd}` : checkCmd;
272
- try {
273
- return lodash_1.default.includes(await adb.shell([fullCmd]), passFlag);
274
- }
275
- catch (ign) {
276
- return false;
277
- }
278
- };
279
- const isFile = async (p, runAs = null) => await performRemoteFsCheck(p, 'f', runAs);
280
- const isDir = async (p, runAs = null) => await performRemoteFsCheck(p, 'd', runAs);
281
- const isPresent = async (p, runAs = null) => await performRemoteFsCheck(p, 'e', runAs);
267
+ const { isDir, isPresent, isFile } = createFSTests(adb);
282
268
  let dstPath = remotePath;
283
- let pkgId = null;
269
+ /** @type {string|undefined} */
270
+ let pkgId;
284
271
  if (remotePath.startsWith(CONTAINER_PATH_MARKER)) {
285
272
  const [packageId, pathInContainer] = parseContainerPath(remotePath);
286
273
  this.log.debug(`Parsed package identifier '${packageId}' from '${remotePath}'`);
@@ -294,18 +281,18 @@ async function deleteFileOrFolder(adb, remotePath) {
294
281
  catch (e) {
295
282
  this.log.errorAndThrow(`Cannot access the container of '${pkgId}' application. ` +
296
283
  `Is the application installed and has 'debuggable' build option set to true? ` +
297
- `Original error: ${e.message}`);
284
+ `Original error: ${ /** @type {Error} */(e).message}`);
298
285
  }
299
286
  }
300
- if (!await isPresent(dstPath, pkgId)) {
287
+ if (!(await isPresent(dstPath, pkgId))) {
301
288
  this.log.info(`The item at '${dstPath}' does not exist. Perhaps, already deleted?`);
302
289
  return false;
303
290
  }
304
291
  const expectsFile = !remotePath.endsWith('/');
305
- if (expectsFile && !await isFile(dstPath, pkgId)) {
292
+ if (expectsFile && !(await isFile(dstPath, pkgId))) {
306
293
  this.log.errorAndThrow(`The item at '${dstPath}' is not a file`);
307
294
  }
308
- else if (!expectsFile && !await isDir(dstPath, pkgId)) {
295
+ else if (!expectsFile && !(await isDir(dstPath, pkgId))) {
309
296
  this.log.errorAndThrow(`The item at '${dstPath}' is not a folder`);
310
297
  }
311
298
  if (pkgId) {
@@ -315,36 +302,13 @@ async function deleteFileOrFolder(adb, remotePath) {
315
302
  await adb.shell(['rm', `-f${expectsFile ? '' : 'r'}`, dstPath]);
316
303
  }
317
304
  if (await isPresent(dstPath, pkgId)) {
318
- this.log.errorAndThrow(`The item at '${dstPath}' still exists after being deleted. ` +
319
- `Is it writable?`);
305
+ this.log.errorAndThrow(`The item at '${dstPath}' still exists after being deleted. ` + `Is it writable?`);
320
306
  }
321
307
  return true;
322
308
  }
309
+ (0, mixins_1.mixin)(FileActionsMixin);
323
310
  /**
324
- * @typedef {Object} DeleteFileOpts
325
- * @property {!string} remotePath The full path to the remote file
326
- * or a file inside an application bundle (for example `@my.app.id/path/in/bundle`)
311
+ * @typedef {import('appium-adb').ADB} ADB
327
312
  */
328
- /**
329
- * Deletes a file on the remote device
330
- *
331
- * @param {DeleteFileOpts} opts
332
- * @returns {boolean} `true` if the remote file has been successfully deleted.
333
- * If the path to a remote file is valid, but the file itself does not exist
334
- * then `false` is returned.
335
- * @throws {Error} If the argument is invalid or there was an error while
336
- * deleting the file
337
- */
338
- commands.mobileDeleteFile = async function mobileDeleteFile(opts = {}) {
339
- const { remotePath } = opts;
340
- if (!remotePath) {
341
- throw new driver_1.errors.InvalidArgumentError(`The 'remotePath' argument is mandatory`);
342
- }
343
- if (remotePath.endsWith('/')) {
344
- throw new driver_1.errors.InvalidArgumentError(`It is expected that remote path points to a folder and not to a file. ` +
345
- `'${remotePath}' is given instead`);
346
- }
347
- return await deleteFileOrFolder(this.adb, remotePath);
348
- };
349
- exports.default = commands;
313
+ exports.default = FileActionsMixin;
350
314
  //# sourceMappingURL=file-actions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"file-actions.js","sourceRoot":"","sources":["../../../lib/commands/file-actions.js"],"names":[],"mappings":";;;;;;AAAA,oDAAuB;AACvB,6CAAyD;AACzD,gDAAwB;AACxB,0CAAuC;AACvC,oCAAuC;AAGvC,MAAM,qBAAqB,GAAG,GAAG,CAAC;AAClC,kCAAkC;AAClC,MAAM,sBAAsB,GAAG,IAAI,MAAM,CAAC,IAAI,qBAAqB,cAAc,CAAC,CAAC;AACnF,MAAM,2BAA2B,GAAG,+CAA+C,CAAC;AAGpF,MAAM,QAAQ,GAAG,EAAE,CAAC;AA6VX,4BAAQ;AA3VjB;;;;;;;;GAQG;AACH,SAAS,kBAAkB,CAAE,UAAU;IACrC,MAAM,KAAK,GAAG,sBAAsB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AAO,EAAE,KAAK,CAAC,CAAC,EAAE;QACzD,IAAI,CAAC,GAAG,CAAC,aAAa,CAAC,gBAAgB,OAAO,mBAAmB,CAAC,CAAC;KACpE;IAED,IAAI,KAAK,EAAE;QACT,MAAM,GAAG,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE,KAAK,EAAE,QAAQ,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;KAC/F;SAAM;QACL,MAAM,GAAG,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,KAAK,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,EAAE,OAAO,CAAC,CAAC,CAAC;KACjE;IACD,IAAI,MAAM,SAAS,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE;QACnC,IAAI,CAAC,GAAG,CAAC,aAAa,CACpB,gBAAgB,OAAO,sCAAsC,GAAG,iBAAiB,CAClF,CAAC;KACH;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,IAAA,cAAK,EAAC,gBAAgB,CAAC,CAAC;AAExB;;GAEG;AAEH,kBAAe,gBAAgB,CAAC"}
@@ -1,13 +1,9 @@
1
- export default extensions;
2
- export namespace helpers {
3
- /**
4
- * Reason for isolating doFindElementOrEls from findElOrEls is for reusing findElOrEls
5
- * across android-drivers (like appium-uiautomator2-driver) to avoid code duplication.
6
- * Other android-drivers (like appium-uiautomator2-driver) need to override doFindElementOrEls
7
- * to facilitate findElOrEls.
8
- */
9
- function doFindElementOrEls(params: any): Promise<any>;
10
- function findElOrEls(strategy: any, selector: any, mult: any, context?: string): Promise<any[] | undefined>;
11
- }
12
- declare let extensions: {};
1
+ /**
2
+ * @privateRemarks This file needed to be converted to TS because the overload of `findElOrEls` is seemingly impossible to express in JS since the value of `this` cannot be bound via a type assertion.
3
+ * @module
4
+ */
5
+ import { type FindMixin } from './mixins';
6
+ import type { AndroidDriver } from '../driver';
7
+ declare const FindMixin: FindMixin & ThisType<AndroidDriver>;
8
+ export default FindMixin;
13
9
  //# sourceMappingURL=find.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"find.d.ts","sourceRoot":"","sources":["../../../lib/commands/find.js"],"names":[],"mappings":";;IAMA;;;;;OAKG;IACH,uDAEC;IAMD,4GAyDC;;AAzEiB,2BAAe"}
1
+ {"version":3,"file":"find.d.ts","sourceRoot":"","sources":["../../../lib/commands/find.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAQ,KAAK,SAAS,EAAC,MAAM,UAAU,CAAC;AAE/C,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,WAAW,CAAC;AAoF7C,QAAA,MAAM,SAAS,EAAE,SAAS,GAAG,QAAQ,CAAC,aAAa,CAMlD,CAAC;AAIF,eAAe,SAAS,CAAC"}