appium-android-driver 7.8.3 → 8.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (261) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/build/lib/commands/app-management.d.ts +129 -5
  3. package/build/lib/commands/app-management.d.ts.map +1 -1
  4. package/build/lib/commands/app-management.js +433 -128
  5. package/build/lib/commands/app-management.js.map +1 -1
  6. package/build/lib/commands/appearance.d.ts +17 -4
  7. package/build/lib/commands/appearance.d.ts.map +1 -1
  8. package/build/lib/commands/appearance.js +32 -33
  9. package/build/lib/commands/appearance.js.map +1 -1
  10. package/build/lib/commands/context/cache.d.ts +19 -0
  11. package/build/lib/commands/context/cache.d.ts.map +1 -0
  12. package/build/lib/commands/context/cache.js +32 -0
  13. package/build/lib/commands/context/cache.js.map +1 -0
  14. package/build/lib/commands/context/exports.d.ts +141 -0
  15. package/build/lib/commands/context/exports.d.ts.map +1 -0
  16. package/build/lib/commands/context/exports.js +351 -0
  17. package/build/lib/commands/context/exports.js.map +1 -0
  18. package/build/lib/commands/context/helpers.d.ts +98 -0
  19. package/build/lib/commands/context/helpers.d.ts.map +1 -0
  20. package/build/lib/commands/context/helpers.js +715 -0
  21. package/build/lib/commands/context/helpers.js.map +1 -0
  22. package/build/lib/commands/device/common.d.ts +23 -0
  23. package/build/lib/commands/device/common.d.ts.map +1 -0
  24. package/build/lib/commands/device/common.js +230 -0
  25. package/build/lib/commands/device/common.js.map +1 -0
  26. package/build/lib/commands/device/emulator-actions.d.ts +114 -0
  27. package/build/lib/commands/device/emulator-actions.d.ts.map +1 -0
  28. package/build/lib/commands/device/emulator-actions.js +197 -0
  29. package/build/lib/commands/device/emulator-actions.js.map +1 -0
  30. package/build/lib/commands/device/emulator-console.d.ts +7 -0
  31. package/build/lib/commands/device/emulator-console.d.ts.map +1 -0
  32. package/build/lib/commands/device/emulator-console.js +24 -0
  33. package/build/lib/commands/device/emulator-console.js.map +1 -0
  34. package/build/lib/commands/device/utils.d.ts +50 -0
  35. package/build/lib/commands/device/utils.d.ts.map +1 -0
  36. package/build/lib/commands/device/utils.js +238 -0
  37. package/build/lib/commands/device/utils.js.map +1 -0
  38. package/build/lib/commands/deviceidle.d.ts +8 -5
  39. package/build/lib/commands/deviceidle.d.ts.map +1 -1
  40. package/build/lib/commands/deviceidle.js +31 -37
  41. package/build/lib/commands/deviceidle.js.map +1 -1
  42. package/build/lib/commands/element.d.ts +99 -5
  43. package/build/lib/commands/element.d.ts.map +1 -1
  44. package/build/lib/commands/element.js +152 -116
  45. package/build/lib/commands/element.js.map +1 -1
  46. package/build/lib/commands/execute.d.ts +12 -4
  47. package/build/lib/commands/execute.d.ts.map +1 -1
  48. package/build/lib/commands/execute.js +83 -78
  49. package/build/lib/commands/execute.js.map +1 -1
  50. package/build/lib/commands/file-actions.d.ts +42 -5
  51. package/build/lib/commands/file-actions.d.ts.map +1 -1
  52. package/build/lib/commands/file-actions.js +230 -194
  53. package/build/lib/commands/file-actions.js.map +1 -1
  54. package/build/lib/commands/find.d.ts +5 -4
  55. package/build/lib/commands/find.d.ts.map +1 -1
  56. package/build/lib/commands/find.js +7 -10
  57. package/build/lib/commands/find.js.map +1 -1
  58. package/build/lib/commands/geolocation.d.ts +45 -0
  59. package/build/lib/commands/geolocation.d.ts.map +1 -0
  60. package/build/lib/commands/geolocation.js +182 -0
  61. package/build/lib/commands/geolocation.js.map +1 -0
  62. package/build/lib/commands/ime.d.ts +25 -5
  63. package/build/lib/commands/ime.d.ts.map +1 -1
  64. package/build/lib/commands/ime.js +59 -42
  65. package/build/lib/commands/ime.js.map +1 -1
  66. package/build/lib/commands/intent.d.ts +56 -5
  67. package/build/lib/commands/intent.d.ts.map +1 -1
  68. package/build/lib/commands/intent.js +135 -83
  69. package/build/lib/commands/intent.js.map +1 -1
  70. package/build/lib/commands/keyboard.d.ts +58 -4
  71. package/build/lib/commands/keyboard.d.ts.map +1 -1
  72. package/build/lib/commands/keyboard.js +119 -17
  73. package/build/lib/commands/keyboard.js.map +1 -1
  74. package/build/lib/commands/lock/exports.d.ts +301 -0
  75. package/build/lib/commands/lock/exports.d.ts.map +1 -0
  76. package/build/lib/commands/lock/exports.js +121 -0
  77. package/build/lib/commands/lock/exports.js.map +1 -0
  78. package/build/lib/commands/lock/helpers.d.ts +349 -0
  79. package/build/lib/commands/lock/helpers.d.ts.map +1 -0
  80. package/build/lib/commands/lock/helpers.js +375 -0
  81. package/build/lib/commands/lock/helpers.js.map +1 -0
  82. package/build/lib/commands/log.d.ts +59 -5
  83. package/build/lib/commands/log.d.ts.map +1 -1
  84. package/build/lib/commands/log.js +150 -140
  85. package/build/lib/commands/log.js.map +1 -1
  86. package/build/lib/commands/media-projection.d.ts +16 -5
  87. package/build/lib/commands/media-projection.d.ts.map +1 -1
  88. package/build/lib/commands/media-projection.js +69 -58
  89. package/build/lib/commands/media-projection.js.map +1 -1
  90. package/build/lib/commands/memory.d.ts +9 -5
  91. package/build/lib/commands/memory.d.ts.map +1 -1
  92. package/build/lib/commands/memory.js +19 -24
  93. package/build/lib/commands/memory.js.map +1 -1
  94. package/build/lib/commands/misc.d.ts +42 -0
  95. package/build/lib/commands/misc.d.ts.map +1 -0
  96. package/build/lib/commands/misc.js +100 -0
  97. package/build/lib/commands/misc.js.map +1 -0
  98. package/build/lib/commands/network.d.ts +61 -5
  99. package/build/lib/commands/network.d.ts.map +1 -1
  100. package/build/lib/commands/network.js +196 -189
  101. package/build/lib/commands/network.js.map +1 -1
  102. package/build/lib/commands/performance.d.ts +67 -27
  103. package/build/lib/commands/performance.d.ts.map +1 -1
  104. package/build/lib/commands/performance.js +105 -80
  105. package/build/lib/commands/performance.js.map +1 -1
  106. package/build/lib/commands/permissions.d.ts +12 -6
  107. package/build/lib/commands/permissions.d.ts.map +1 -1
  108. package/build/lib/commands/permissions.js +65 -62
  109. package/build/lib/commands/permissions.js.map +1 -1
  110. package/build/lib/commands/recordscreen.d.ts +44 -5
  111. package/build/lib/commands/recordscreen.d.ts.map +1 -1
  112. package/build/lib/commands/recordscreen.js +131 -126
  113. package/build/lib/commands/recordscreen.js.map +1 -1
  114. package/build/lib/commands/resources.d.ts +16 -0
  115. package/build/lib/commands/resources.d.ts.map +1 -0
  116. package/build/lib/commands/resources.js +91 -0
  117. package/build/lib/commands/resources.js.map +1 -0
  118. package/build/lib/commands/shell.d.ts +8 -5
  119. package/build/lib/commands/shell.d.ts.map +1 -1
  120. package/build/lib/commands/shell.js +29 -33
  121. package/build/lib/commands/shell.js.map +1 -1
  122. package/build/lib/commands/streamscreen.d.ts +34 -6
  123. package/build/lib/commands/streamscreen.d.ts.map +1 -1
  124. package/build/lib/commands/streamscreen.js +166 -162
  125. package/build/lib/commands/streamscreen.js.map +1 -1
  126. package/build/lib/commands/system-bars.d.ts +18 -13
  127. package/build/lib/commands/system-bars.d.ts.map +1 -1
  128. package/build/lib/commands/system-bars.js +68 -64
  129. package/build/lib/commands/system-bars.js.map +1 -1
  130. package/build/lib/commands/time.d.ts +14 -0
  131. package/build/lib/commands/time.d.ts.map +1 -0
  132. package/build/lib/commands/time.js +39 -0
  133. package/build/lib/commands/time.js.map +1 -0
  134. package/build/lib/commands/touch.d.ts +99 -6
  135. package/build/lib/commands/touch.d.ts.map +1 -1
  136. package/build/lib/commands/touch.js +399 -280
  137. package/build/lib/commands/touch.js.map +1 -1
  138. package/build/lib/commands/types.d.ts +110 -2
  139. package/build/lib/commands/types.d.ts.map +1 -1
  140. package/build/lib/doctor/checks.d.ts.map +1 -1
  141. package/build/lib/doctor/checks.js +4 -4
  142. package/build/lib/doctor/checks.js.map +1 -1
  143. package/build/lib/driver.d.ts +224 -27
  144. package/build/lib/driver.d.ts.map +1 -1
  145. package/build/lib/driver.js +232 -7
  146. package/build/lib/driver.js.map +1 -1
  147. package/build/lib/index.d.ts +1 -4
  148. package/build/lib/index.d.ts.map +1 -1
  149. package/build/lib/index.js +1 -13
  150. package/build/lib/index.js.map +1 -1
  151. package/build/lib/logger.js.map +1 -1
  152. package/build/lib/method-map.d.ts +0 -23
  153. package/build/lib/method-map.d.ts.map +1 -1
  154. package/build/lib/method-map.js +0 -11
  155. package/build/lib/method-map.js.map +1 -1
  156. package/build/lib/utils.d.ts +12 -0
  157. package/build/lib/utils.d.ts.map +1 -1
  158. package/build/lib/utils.js +38 -2
  159. package/build/lib/utils.js.map +1 -1
  160. package/lib/commands/app-management.js +470 -145
  161. package/lib/commands/appearance.js +29 -36
  162. package/lib/commands/context/cache.js +29 -0
  163. package/lib/commands/context/exports.js +379 -0
  164. package/lib/commands/context/helpers.js +802 -0
  165. package/lib/commands/device/common.js +264 -0
  166. package/lib/commands/device/emulator-actions.js +194 -0
  167. package/lib/commands/device/emulator-console.js +24 -0
  168. package/lib/commands/device/utils.js +285 -0
  169. package/lib/commands/deviceidle.js +31 -44
  170. package/lib/commands/element.js +149 -142
  171. package/lib/commands/execute.js +86 -87
  172. package/lib/commands/file-actions.js +249 -222
  173. package/lib/commands/find.ts +13 -19
  174. package/lib/commands/geolocation.js +179 -0
  175. package/lib/commands/ime.js +53 -45
  176. package/lib/commands/intent.js +149 -91
  177. package/lib/commands/keyboard.js +114 -17
  178. package/lib/commands/lock/exports.js +139 -0
  179. package/lib/commands/lock/helpers.js +379 -0
  180. package/lib/commands/log.js +170 -166
  181. package/lib/commands/media-projection.js +75 -70
  182. package/lib/commands/memory.js +17 -29
  183. package/lib/commands/misc.js +94 -0
  184. package/lib/commands/network.js +209 -223
  185. package/lib/commands/performance.js +88 -73
  186. package/lib/commands/permissions.js +83 -84
  187. package/lib/commands/recordscreen.js +171 -170
  188. package/lib/commands/resources.js +96 -0
  189. package/lib/commands/shell.js +28 -42
  190. package/lib/commands/streamscreen.js +207 -206
  191. package/lib/commands/system-bars.js +76 -77
  192. package/lib/commands/time.js +36 -0
  193. package/lib/commands/touch.js +442 -346
  194. package/lib/commands/types.ts +123 -2
  195. package/lib/doctor/checks.js +24 -16
  196. package/lib/driver.ts +454 -12
  197. package/lib/index.ts +1 -13
  198. package/lib/logger.js +1 -1
  199. package/lib/method-map.js +0 -11
  200. package/lib/utils.js +40 -3
  201. package/package.json +1 -1
  202. package/build/lib/commands/actions.d.ts +0 -8
  203. package/build/lib/commands/actions.d.ts.map +0 -1
  204. package/build/lib/commands/actions.js +0 -207
  205. package/build/lib/commands/actions.js.map +0 -1
  206. package/build/lib/commands/alert.d.ts +0 -8
  207. package/build/lib/commands/alert.d.ts.map +0 -1
  208. package/build/lib/commands/alert.js +0 -29
  209. package/build/lib/commands/alert.js.map +0 -1
  210. package/build/lib/commands/context.d.ts +0 -10
  211. package/build/lib/commands/context.d.ts.map +0 -1
  212. package/build/lib/commands/context.js +0 -431
  213. package/build/lib/commands/context.js.map +0 -1
  214. package/build/lib/commands/emu-console.d.ts +0 -7
  215. package/build/lib/commands/emu-console.d.ts.map +0 -1
  216. package/build/lib/commands/emu-console.js +0 -27
  217. package/build/lib/commands/emu-console.js.map +0 -1
  218. package/build/lib/commands/general.d.ts +0 -9
  219. package/build/lib/commands/general.d.ts.map +0 -1
  220. package/build/lib/commands/general.js +0 -293
  221. package/build/lib/commands/general.js.map +0 -1
  222. package/build/lib/commands/index.d.ts +0 -28
  223. package/build/lib/commands/index.d.ts.map +0 -1
  224. package/build/lib/commands/index.js +0 -57
  225. package/build/lib/commands/index.js.map +0 -1
  226. package/build/lib/commands/mixins.d.ts +0 -747
  227. package/build/lib/commands/mixins.d.ts.map +0 -1
  228. package/build/lib/commands/mixins.js +0 -19
  229. package/build/lib/commands/mixins.js.map +0 -1
  230. package/build/lib/helpers/android.d.ts +0 -163
  231. package/build/lib/helpers/android.d.ts.map +0 -1
  232. package/build/lib/helpers/android.js +0 -818
  233. package/build/lib/helpers/android.js.map +0 -1
  234. package/build/lib/helpers/index.d.ts +0 -7
  235. package/build/lib/helpers/index.d.ts.map +0 -1
  236. package/build/lib/helpers/index.js +0 -29
  237. package/build/lib/helpers/index.js.map +0 -1
  238. package/build/lib/helpers/types.d.ts +0 -122
  239. package/build/lib/helpers/types.d.ts.map +0 -1
  240. package/build/lib/helpers/types.js +0 -3
  241. package/build/lib/helpers/types.js.map +0 -1
  242. package/build/lib/helpers/unlock.d.ts +0 -32
  243. package/build/lib/helpers/unlock.d.ts.map +0 -1
  244. package/build/lib/helpers/unlock.js +0 -273
  245. package/build/lib/helpers/unlock.js.map +0 -1
  246. package/build/lib/helpers/webview.d.ts +0 -74
  247. package/build/lib/helpers/webview.d.ts.map +0 -1
  248. package/build/lib/helpers/webview.js +0 -448
  249. package/build/lib/helpers/webview.js.map +0 -1
  250. package/lib/commands/actions.js +0 -244
  251. package/lib/commands/alert.js +0 -34
  252. package/lib/commands/context.js +0 -507
  253. package/lib/commands/emu-console.js +0 -31
  254. package/lib/commands/general.js +0 -343
  255. package/lib/commands/index.ts +0 -54
  256. package/lib/commands/mixins.ts +0 -976
  257. package/lib/helpers/android.ts +0 -1153
  258. package/lib/helpers/index.ts +0 -6
  259. package/lib/helpers/types.ts +0 -136
  260. package/lib/helpers/unlock.ts +0 -329
  261. package/lib/helpers/webview.ts +0 -610
@@ -1,19 +1,246 @@
1
1
  "use strict";
2
- // @ts-check
3
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
4
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
5
4
  };
6
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.mobileDeleteFile = exports.mobilePullFolder = exports.pullFolder = exports.mobilePushFile = exports.pushFile = exports.mobilePullFile = exports.pullFile = 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");
13
12
  const CONTAINER_PATH_MARKER = '@';
14
13
  // https://regex101.com/r/PLdB0G/2
15
14
  const CONTAINER_PATH_PATTERN = new RegExp(`^${CONTAINER_PATH_MARKER}([^/]+)/(.+)`);
16
15
  const ANDROID_MEDIA_RESCAN_INTENT = 'android.intent.action.MEDIA_SCANNER_SCAN_FILE';
16
+ /**
17
+ * @this {import('../driver').AndroidDriver}
18
+ * @param {string} remotePath
19
+ * @returns {Promise<string>}
20
+ */
21
+ async function pullFile(remotePath) {
22
+ if (remotePath.endsWith('/')) {
23
+ throw new driver_1.errors.InvalidArgumentError(`It is expected that remote path points to a file and not to a folder. ` +
24
+ `'${remotePath}' is given instead`);
25
+ }
26
+ let tmpDestination = null;
27
+ if (remotePath.startsWith(CONTAINER_PATH_MARKER)) {
28
+ const [packageId, pathInContainer] = parseContainerPath(remotePath);
29
+ this.log.debug(`Parsed package identifier '${packageId}' from '${remotePath}'. Will get the data from '${pathInContainer}'`);
30
+ tmpDestination = `/data/local/tmp/${path_1.default.posix.basename(pathInContainer)}`;
31
+ try {
32
+ await this.adb.shell(['run-as', packageId, `chmod 777 '${escapePath(pathInContainer)}'`]);
33
+ await this.adb.shell([
34
+ 'run-as',
35
+ packageId,
36
+ `cp -f '${escapePath(pathInContainer)}' '${escapePath(tmpDestination)}'`,
37
+ ]);
38
+ }
39
+ catch (e) {
40
+ this.log.errorAndThrow(`Cannot access the container of '${packageId}' application. ` +
41
+ `Is the application installed and has 'debuggable' build option set to true? ` +
42
+ `Original error: ${ /** @type {Error} */(e).message}`);
43
+ }
44
+ }
45
+ const localFile = await support_1.tempDir.path({ prefix: 'appium', suffix: '.tmp' });
46
+ try {
47
+ await this.adb.pull(tmpDestination || remotePath, localFile);
48
+ return (await support_1.util.toInMemoryBase64(localFile)).toString();
49
+ }
50
+ finally {
51
+ if (await support_1.fs.exists(localFile)) {
52
+ await support_1.fs.unlink(localFile);
53
+ }
54
+ if (tmpDestination) {
55
+ await this.adb.shell(['rm', '-f', tmpDestination]);
56
+ }
57
+ }
58
+ }
59
+ exports.pullFile = pullFile;
60
+ /**
61
+ * @this {import('../driver').AndroidDriver}
62
+ * @param {import('./types').PullFileOpts} opts
63
+ * @returns {Promise<string>}
64
+ */
65
+ async function mobilePullFile(opts) {
66
+ const { remotePath } = (0, utils_1.requireArgs)('remotePath', opts);
67
+ return await this.pullFile(remotePath);
68
+ }
69
+ exports.mobilePullFile = mobilePullFile;
70
+ /**
71
+ * @this {import('../driver').AndroidDriver}
72
+ * @param {string} remotePath
73
+ * @param {string} base64Data
74
+ * @returns {Promise<void>}
75
+ */
76
+ async function pushFile(remotePath, base64Data) {
77
+ if (remotePath.endsWith('/')) {
78
+ throw new driver_1.errors.InvalidArgumentError(`It is expected that remote path points to a file and not to a folder. ` +
79
+ `'${remotePath}' is given instead`);
80
+ }
81
+ const localFile = await support_1.tempDir.path({ prefix: 'appium', suffix: '.tmp' });
82
+ if (lodash_1.default.isArray(base64Data)) {
83
+ // some clients (ahem) java, send a byte array encoding utf8 characters
84
+ // instead of a string, which would be infinitely better!
85
+ base64Data = Buffer.from(base64Data).toString('utf8');
86
+ }
87
+ const content = Buffer.from(base64Data, 'base64');
88
+ let tmpDestination = null;
89
+ try {
90
+ await support_1.fs.writeFile(localFile, content.toString('binary'), 'binary');
91
+ if (remotePath.startsWith(CONTAINER_PATH_MARKER)) {
92
+ const [packageId, pathInContainer] = parseContainerPath(remotePath);
93
+ this.log.debug(`Parsed package identifier '${packageId}' from '${remotePath}'. ` +
94
+ `Will put the data into '${pathInContainer}'`);
95
+ tmpDestination = `/data/local/tmp/${path_1.default.posix.basename(pathInContainer)}`;
96
+ try {
97
+ await this.adb.shell([
98
+ 'run-as',
99
+ packageId,
100
+ `mkdir -p '${escapePath(path_1.default.posix.dirname(pathInContainer))}'`,
101
+ ]);
102
+ await this.adb.shell(['run-as', packageId, `touch '${escapePath(pathInContainer)}'`]);
103
+ await this.adb.shell(['run-as', packageId, `chmod 777 '${escapePath(pathInContainer)}'`]);
104
+ await this.adb.push(localFile, tmpDestination);
105
+ await this.adb.shell([
106
+ 'run-as',
107
+ packageId,
108
+ `cp -f '${escapePath(tmpDestination)}' '${escapePath(pathInContainer)}'`,
109
+ ]);
110
+ }
111
+ catch (e) {
112
+ this.log.errorAndThrow(`Cannot access the container of '${packageId}' application. ` +
113
+ `Is the application installed and has 'debuggable' build option set to true? ` +
114
+ `Original error: ${ /** @type {Error} */(e).message}`);
115
+ }
116
+ }
117
+ else {
118
+ // adb push creates folders and overwrites existing files.
119
+ await this.adb.push(localFile, remotePath);
120
+ // if we have pushed a file, it might be a media file, so ensure that
121
+ // apps know about it
122
+ await scanMedia.bind(this)(remotePath);
123
+ }
124
+ }
125
+ finally {
126
+ if (await support_1.fs.exists(localFile)) {
127
+ await support_1.fs.unlink(localFile);
128
+ }
129
+ if (tmpDestination) {
130
+ await this.adb.shell(['rm', '-f', tmpDestination]);
131
+ }
132
+ }
133
+ }
134
+ exports.pushFile = pushFile;
135
+ /**
136
+ * @this {import('../driver').AndroidDriver}
137
+ * @param {import('./types').PushFileOpts} opts
138
+ * @returns {Promise<void>}
139
+ */
140
+ async function mobilePushFile(opts) {
141
+ const { remotePath, payload } = (0, utils_1.requireArgs)(['remotePath', 'payload'], opts);
142
+ return await this.pushFile(remotePath, payload);
143
+ }
144
+ exports.mobilePushFile = mobilePushFile;
145
+ /**
146
+ * @this {import('../driver').AndroidDriver}
147
+ * @param {string} remotePath
148
+ * @returns {Promise<string>}
149
+ */
150
+ async function pullFolder(remotePath) {
151
+ const tmpRoot = await support_1.tempDir.openDir();
152
+ try {
153
+ await this.adb.pull(remotePath, tmpRoot);
154
+ return (await support_1.zip.toInMemoryZip(tmpRoot, {
155
+ encodeToBase64: true,
156
+ })).toString();
157
+ }
158
+ finally {
159
+ await support_1.fs.rimraf(tmpRoot);
160
+ }
161
+ }
162
+ exports.pullFolder = pullFolder;
163
+ /**
164
+ * @this {import('../driver').AndroidDriver}
165
+ * @param {import('./types').PullFolderOpts} opts
166
+ * @returns {Promise<string>}
167
+ */
168
+ async function mobilePullFolder(opts) {
169
+ const { remotePath } = (0, utils_1.requireArgs)('remotePath', opts);
170
+ return await this.pullFolder(remotePath);
171
+ }
172
+ exports.mobilePullFolder = mobilePullFolder;
173
+ /**
174
+ * @this {import('../driver').AndroidDriver}
175
+ * @param {import('./types').DeleteFileOpts} opts
176
+ * @returns {Promise<boolean>}
177
+ */
178
+ async function mobileDeleteFile(opts) {
179
+ const { remotePath } = (0, utils_1.requireArgs)('remotePath', opts);
180
+ if (remotePath.endsWith('/')) {
181
+ throw new driver_1.errors.InvalidArgumentError(`It is expected that remote path points to a folder and not to a file. ` +
182
+ `'${remotePath}' is given instead`);
183
+ }
184
+ return await deleteFileOrFolder.call(this, this.adb, remotePath);
185
+ }
186
+ exports.mobileDeleteFile = mobileDeleteFile;
187
+ /**
188
+ * Deletes the given folder or file from the remote device
189
+ *
190
+ * @param {ADB} adb
191
+ * @param {string} remotePath The full path to the remote folder
192
+ * or file (folder names must end with a single slash)
193
+ * @throws {Error} If the provided remote path is invalid or
194
+ * the package content cannot be accessed
195
+ * @returns {Promise<boolean>} `true` if the remote item has been successfully deleted.
196
+ * If the remote path is valid, but the remote path does not exist
197
+ * this function return `false`.
198
+ * @this {import('../driver').AndroidDriver}
199
+ */
200
+ async function deleteFileOrFolder(adb, remotePath) {
201
+ const { isDir, isPresent, isFile } = createFSTests(adb);
202
+ let dstPath = remotePath;
203
+ /** @type {string|undefined} */
204
+ let pkgId;
205
+ if (remotePath.startsWith(CONTAINER_PATH_MARKER)) {
206
+ const [packageId, pathInContainer] = parseContainerPath(remotePath);
207
+ this.log.debug(`Parsed package identifier '${packageId}' from '${remotePath}'`);
208
+ dstPath = pathInContainer;
209
+ pkgId = packageId;
210
+ }
211
+ if (pkgId) {
212
+ try {
213
+ await adb.shell(['run-as', pkgId, 'ls']);
214
+ }
215
+ catch (e) {
216
+ this.log.errorAndThrow(`Cannot access the container of '${pkgId}' application. ` +
217
+ `Is the application installed and has 'debuggable' build option set to true? ` +
218
+ `Original error: ${ /** @type {Error} */(e).message}`);
219
+ }
220
+ }
221
+ if (!(await isPresent(dstPath, pkgId))) {
222
+ this.log.info(`The item at '${dstPath}' does not exist. Perhaps, already deleted?`);
223
+ return false;
224
+ }
225
+ const expectsFile = !remotePath.endsWith('/');
226
+ if (expectsFile && !(await isFile(dstPath, pkgId))) {
227
+ this.log.errorAndThrow(`The item at '${dstPath}' is not a file`);
228
+ }
229
+ else if (!expectsFile && !(await isDir(dstPath, pkgId))) {
230
+ this.log.errorAndThrow(`The item at '${dstPath}' is not a folder`);
231
+ }
232
+ if (pkgId) {
233
+ await adb.shell(['run-as', pkgId, `rm -f${expectsFile ? '' : 'r'} '${escapePath(dstPath)}'`]);
234
+ }
235
+ else {
236
+ await adb.shell(['rm', `-f${expectsFile ? '' : 'r'}`, dstPath]);
237
+ }
238
+ if (await isPresent(dstPath, pkgId)) {
239
+ this.log.errorAndThrow(`The item at '${dstPath}' still exists after being deleted. ` + `Is it writable?`);
240
+ }
241
+ return true;
242
+ }
243
+ // #region Internal helpers
17
244
  /**
18
245
  * Parses the actual destination path from the given value
19
246
  *
@@ -73,140 +300,6 @@ async function scanMedia(remotePath) {
73
300
  function escapePath(p) {
74
301
  return p.replace(/'/g, `\\'`);
75
302
  }
76
- /**
77
- * @type {import('./mixins').FileActionsMixin & ThisType<import('../driver').AndroidDriver>}
78
- * @satisfies {import('@appium/types').ExternalDriver}
79
- */
80
- const FileActionsMixin = {
81
- async pullFile(remotePath) {
82
- if (remotePath.endsWith('/')) {
83
- throw new driver_1.errors.InvalidArgumentError(`It is expected that remote path points to a file and not to a folder. ` +
84
- `'${remotePath}' is given instead`);
85
- }
86
- let tmpDestination = null;
87
- if (remotePath.startsWith(CONTAINER_PATH_MARKER)) {
88
- const [packageId, pathInContainer] = parseContainerPath(remotePath);
89
- this.log.debug(`Parsed package identifier '${packageId}' from '${remotePath}'. Will get the data from '${pathInContainer}'`);
90
- tmpDestination = `/data/local/tmp/${path_1.default.posix.basename(pathInContainer)}`;
91
- try {
92
- await this.adb.shell(['run-as', packageId, `chmod 777 '${escapePath(pathInContainer)}'`]);
93
- await this.adb.shell([
94
- 'run-as',
95
- packageId,
96
- `cp -f '${escapePath(pathInContainer)}' '${escapePath(tmpDestination)}'`,
97
- ]);
98
- }
99
- catch (e) {
100
- this.log.errorAndThrow(`Cannot access the container of '${packageId}' application. ` +
101
- `Is the application installed and has 'debuggable' build option set to true? ` +
102
- `Original error: ${ /** @type {Error} */(e).message}`);
103
- }
104
- }
105
- const localFile = await support_1.tempDir.path({ prefix: 'appium', suffix: '.tmp' });
106
- try {
107
- await this.adb.pull(tmpDestination || remotePath, localFile);
108
- return (await support_1.util.toInMemoryBase64(localFile)).toString();
109
- }
110
- finally {
111
- if (await support_1.fs.exists(localFile)) {
112
- await support_1.fs.unlink(localFile);
113
- }
114
- if (tmpDestination) {
115
- await this.adb.shell(['rm', '-f', tmpDestination]);
116
- }
117
- }
118
- },
119
- async mobilePullFile(opts) {
120
- const { remotePath } = (0, utils_1.requireArgs)('remotePath', opts);
121
- return await this.pullFile(remotePath);
122
- },
123
- async pushFile(remotePath, base64Data) {
124
- if (remotePath.endsWith('/')) {
125
- throw new driver_1.errors.InvalidArgumentError(`It is expected that remote path points to a file and not to a folder. ` +
126
- `'${remotePath}' is given instead`);
127
- }
128
- const localFile = await support_1.tempDir.path({ prefix: 'appium', suffix: '.tmp' });
129
- if (lodash_1.default.isArray(base64Data)) {
130
- // some clients (ahem) java, send a byte array encoding utf8 characters
131
- // instead of a string, which would be infinitely better!
132
- base64Data = Buffer.from(base64Data).toString('utf8');
133
- }
134
- const content = Buffer.from(base64Data, 'base64');
135
- let tmpDestination = null;
136
- try {
137
- await support_1.fs.writeFile(localFile, content.toString('binary'), 'binary');
138
- if (remotePath.startsWith(CONTAINER_PATH_MARKER)) {
139
- const [packageId, pathInContainer] = parseContainerPath(remotePath);
140
- this.log.debug(`Parsed package identifier '${packageId}' from '${remotePath}'. ` +
141
- `Will put the data into '${pathInContainer}'`);
142
- tmpDestination = `/data/local/tmp/${path_1.default.posix.basename(pathInContainer)}`;
143
- try {
144
- await this.adb.shell([
145
- 'run-as',
146
- packageId,
147
- `mkdir -p '${escapePath(path_1.default.posix.dirname(pathInContainer))}'`,
148
- ]);
149
- await this.adb.shell(['run-as', packageId, `touch '${escapePath(pathInContainer)}'`]);
150
- await this.adb.shell(['run-as', packageId, `chmod 777 '${escapePath(pathInContainer)}'`]);
151
- await this.adb.push(localFile, tmpDestination);
152
- await this.adb.shell([
153
- 'run-as',
154
- packageId,
155
- `cp -f '${escapePath(tmpDestination)}' '${escapePath(pathInContainer)}'`,
156
- ]);
157
- }
158
- catch (e) {
159
- this.log.errorAndThrow(`Cannot access the container of '${packageId}' application. ` +
160
- `Is the application installed and has 'debuggable' build option set to true? ` +
161
- `Original error: ${ /** @type {Error} */(e).message}`);
162
- }
163
- }
164
- else {
165
- // adb push creates folders and overwrites existing files.
166
- await this.adb.push(localFile, remotePath);
167
- // if we have pushed a file, it might be a media file, so ensure that
168
- // apps know about it
169
- await scanMedia.bind(this)(remotePath);
170
- }
171
- }
172
- finally {
173
- if (await support_1.fs.exists(localFile)) {
174
- await support_1.fs.unlink(localFile);
175
- }
176
- if (tmpDestination) {
177
- await this.adb.shell(['rm', '-f', tmpDestination]);
178
- }
179
- }
180
- },
181
- async mobilePushFile(opts) {
182
- const { remotePath, payload } = (0, utils_1.requireArgs)(['remotePath', 'payload'], opts);
183
- return await this.pushFile(remotePath, payload);
184
- },
185
- async pullFolder(remotePath) {
186
- const tmpRoot = await support_1.tempDir.openDir();
187
- try {
188
- await this.adb.pull(remotePath, tmpRoot);
189
- return (await support_1.zip.toInMemoryZip(tmpRoot, {
190
- encodeToBase64: true,
191
- })).toString();
192
- }
193
- finally {
194
- await support_1.fs.rimraf(tmpRoot);
195
- }
196
- },
197
- async mobilePullFolder(opts) {
198
- const { remotePath } = (0, utils_1.requireArgs)('remotePath', opts);
199
- return await this.pullFolder(remotePath);
200
- },
201
- async mobileDeleteFile(opts) {
202
- const { remotePath } = (0, utils_1.requireArgs)('remotePath', opts);
203
- if (remotePath.endsWith('/')) {
204
- throw new driver_1.errors.InvalidArgumentError(`It is expected that remote path points to a folder and not to a file. ` +
205
- `'${remotePath}' is given instead`);
206
- }
207
- return await deleteFileOrFolder.call(this, this.adb, remotePath);
208
- },
209
- };
210
303
  /**
211
304
  * Factory providing filesystem test functions using ADB
212
305
  * @param {ADB} adb
@@ -247,65 +340,8 @@ function createFSTests(adb) {
247
340
  const isPresent = async (p, runAs) => await performRemoteFsCheck(p, 'e', runAs);
248
341
  return { isFile, isDir, isPresent };
249
342
  }
250
- /**
251
- * Deletes the given folder or file from the remote device
252
- *
253
- * @param {ADB} adb
254
- * @param {string} remotePath The full path to the remote folder
255
- * or file (folder names must end with a single slash)
256
- * @throws {Error} If the provided remote path is invalid or
257
- * the package content cannot be accessed
258
- * @returns {Promise<boolean>} `true` if the remote item has been successfully deleted.
259
- * If the remote path is valid, but the remote path does not exist
260
- * this function return `false`.
261
- * @this {import('../driver').AndroidDriver}
262
- */
263
- async function deleteFileOrFolder(adb, remotePath) {
264
- const { isDir, isPresent, isFile } = createFSTests(adb);
265
- let dstPath = remotePath;
266
- /** @type {string|undefined} */
267
- let pkgId;
268
- if (remotePath.startsWith(CONTAINER_PATH_MARKER)) {
269
- const [packageId, pathInContainer] = parseContainerPath(remotePath);
270
- this.log.debug(`Parsed package identifier '${packageId}' from '${remotePath}'`);
271
- dstPath = pathInContainer;
272
- pkgId = packageId;
273
- }
274
- if (pkgId) {
275
- try {
276
- await adb.shell(['run-as', pkgId, 'ls']);
277
- }
278
- catch (e) {
279
- this.log.errorAndThrow(`Cannot access the container of '${pkgId}' application. ` +
280
- `Is the application installed and has 'debuggable' build option set to true? ` +
281
- `Original error: ${ /** @type {Error} */(e).message}`);
282
- }
283
- }
284
- if (!(await isPresent(dstPath, pkgId))) {
285
- this.log.info(`The item at '${dstPath}' does not exist. Perhaps, already deleted?`);
286
- return false;
287
- }
288
- const expectsFile = !remotePath.endsWith('/');
289
- if (expectsFile && !(await isFile(dstPath, pkgId))) {
290
- this.log.errorAndThrow(`The item at '${dstPath}' is not a file`);
291
- }
292
- else if (!expectsFile && !(await isDir(dstPath, pkgId))) {
293
- this.log.errorAndThrow(`The item at '${dstPath}' is not a folder`);
294
- }
295
- if (pkgId) {
296
- await adb.shell(['run-as', pkgId, `rm -f${expectsFile ? '' : 'r'} '${escapePath(dstPath)}'`]);
297
- }
298
- else {
299
- await adb.shell(['rm', `-f${expectsFile ? '' : 'r'}`, dstPath]);
300
- }
301
- if (await isPresent(dstPath, pkgId)) {
302
- this.log.errorAndThrow(`The item at '${dstPath}' still exists after being deleted. ` + `Is it writable?`);
303
- }
304
- return true;
305
- }
306
- (0, mixins_1.mixin)(FileActionsMixin);
343
+ // #endregion
307
344
  /**
308
345
  * @typedef {import('appium-adb').ADB} ADB
309
346
  */
310
- exports.default = FileActionsMixin;
311
347
  //# sourceMappingURL=file-actions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"file-actions.js","sourceRoot":"","sources":["../../../lib/commands/file-actions.js"],"names":[],"mappings":";AAAA,YAAY;;;;;AAEZ,oDAAuB;AACvB,6CAAuD;AACvD,gDAAwB;AACxB,0CAAqC;AACrC,oCAAqC;AACrC,qCAA+B;AAE/B,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;AAEpF;;;;;;;;GAQG;AACH,SAAS,kBAAkB,CAAC,UAAU;IACpC,MAAM,KAAK,GAAG,sBAAsB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACtD,IAAI,CAAC,KAAK,EAAE;QACV,MAAM,IAAI,KAAK,CACb,kGAAkG;YAChG,IAAI,UAAU,oBAAoB,CACrC,CAAC;KACH;IACD,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,cAAI,CAAC,KAAK,CAAC,OAAO,CAAC,cAAc,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC,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MAAM,GAAG,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC,MAAM,oBAAoB,CAAC,CAAC,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;IAC7E;;;OAGG;IACH,MAAM,KAAK,GAAG,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC,MAAM,oBAAoB,CAAC,CAAC,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;IAC5E;;;OAGG;IACH,MAAM,SAAS,GAAG,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC,MAAM,oBAAoB,CAAC,CAAC,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;IAEhF,OAAO,EAAC,MAAM,EAAE,KAAK,EAAE,SAAS,EAAC,CAAC;AACpC,CAAC;AAED,aAAa;AAEb;;GAEG"}
@@ -1,9 +1,10 @@
1
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
2
  * @module
4
3
  */
5
- import { type FindMixin } from './mixins';
6
4
  import type { AndroidDriver } from '../driver';
7
- declare const FindMixin: FindMixin & ThisType<AndroidDriver>;
8
- export default FindMixin;
5
+ import type { Element } from '@appium/types';
6
+ import type { FindElementOpts } from './types';
7
+ export declare function findElOrEls(this: AndroidDriver, strategy: string, selector: string, mult: true, context?: string): Promise<Element[]>;
8
+ export declare function findElOrEls(this: AndroidDriver, strategy: string, selector: string, mult: false, context?: string): Promise<Element>;
9
+ export declare function doFindElementOrEls(this: AndroidDriver, params: FindElementOpts): Promise<Element | Element[]>;
9
10
  //# sourceMappingURL=find.d.ts.map
@@ -1 +1 @@
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;AAmF7C,QAAA,MAAM,SAAS,EAAE,SAAS,GAAG,QAAQ,CAAC,aAAa,CAMlD,CAAC;AAIF,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"find.d.ts","sourceRoot":"","sources":["../../../lib/commands/find.ts"],"names":[],"mappings":"AACA;;GAEG;AAIH,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,WAAW,CAAC;AAC7C,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,eAAe,CAAC;AAC3C,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,SAAS,CAAC;AAE7C,wBAAsB,WAAW,CAC/B,IAAI,EAAE,aAAa,EACnB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,IAAI,EACV,OAAO,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;AACtB,wBAAsB,WAAW,CAC/B,IAAI,EAAE,aAAa,EACnB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,KAAK,EACX,OAAO,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,OAAO,CAAC,CAAC;AAkEpB,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,aAAa,EACnB,MAAM,EAAE,eAAe,GACtB,OAAO,CAAC,OAAO,GAAG,OAAO,EAAE,CAAC,CAE9B"}
@@ -1,14 +1,14 @@
1
1
  "use strict";
2
+ /* eslint-disable @typescript-eslint/no-unused-vars */
2
3
  /**
3
- * @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.
4
4
  * @module
5
5
  */
6
6
  var __importDefault = (this && this.__importDefault) || function (mod) {
7
7
  return (mod && mod.__esModule) ? mod : { "default": mod };
8
8
  };
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.doFindElementOrEls = exports.findElOrEls = void 0;
10
11
  const lodash_1 = __importDefault(require("lodash"));
11
- const mixins_1 = require("./mixins");
12
12
  const driver_1 = require("appium/driver");
13
13
  async function findElOrEls(strategy, selector, mult, context = '') {
14
14
  if (!selector) {
@@ -65,12 +65,9 @@ async function findElOrEls(strategy, selector, mult, context = '') {
65
65
  }
66
66
  return element;
67
67
  }
68
- const FindMixin = {
69
- async doFindElementOrEls(params) {
70
- throw new driver_1.errors.NotImplementedError('Not implemented');
71
- },
72
- findElOrEls,
73
- };
74
- (0, mixins_1.mixin)(FindMixin);
75
- exports.default = FindMixin;
68
+ exports.findElOrEls = findElOrEls;
69
+ async function doFindElementOrEls(params) {
70
+ throw new driver_1.errors.NotImplementedError('Not implemented');
71
+ }
72
+ exports.doFindElementOrEls = doFindElementOrEls;
76
73
  //# sourceMappingURL=find.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"find.js","sourceRoot":"","sources":["../../../lib/commands/find.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;AAEH,oDAAuB;AACvB,qCAA+C;AAC/C,0CAAkD;AAmBlD,KAAK,UAAU,WAAW,CAExB,QAAgB,EAChB,QAAgB,EAChB,IAAa,EACb,OAAO,GAAG,EAAE;IAEZ,IAAI,CAAC,QAAQ,EAAE;QACb,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;KAClE;IAED,MAAM,MAAM,GAAoB;QAC9B,QAAQ;QACR,QAAQ;QACR,OAAO;QACP,QAAQ,EAAE,IAAI;KACf,CAAC;IAEF,IAAI,OAAwC,CAAC;IAC7C,MAAM,MAAM,GAAG,KAAK,IAAI,EAAE;QACxB,IAAI;YACF,OAAO,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC;SACjD;QAAC,OAAO,GAAG,EAAE;YACZ,qEAAqE;YACrE,+CAA+C;YAC/C,IAAI,IAAA,oBAAW,EAAC,GAAG,EAAE,eAAM,CAAC,iBAAiB,CAAC,EAAE;gBAC9C,GAAG,GAAG,GAAG,CAAC,cAAc,EAAE,CAAC,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,IAAI,EAAE;QACR,OAAO,OAAoB,CAAC;KAC7B;IACD,IAAI,gBAAC,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;QACtB,MAAM,IAAI,eAAM,CAAC,kBAAkB,EAAE,CAAC;KACvC;IACD,OAAO,OAAkB,CAAC;AAC5B,CAAC;AA/DD,kCA+DC;AAEM,KAAK,UAAU,kBAAkB,CAEtC,MAAuB;IAEvB,MAAM,IAAI,eAAM,CAAC,mBAAmB,CAAC,iBAAiB,CAAC,CAAC;AAC1D,CAAC;AALD,gDAKC"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * @this {import('../driver').AndroidDriver}
3
+ * @param {import('@appium/types').Location} location
4
+ * @returns {Promise<import('@appium/types').Location>}
5
+ */
6
+ export function setGeoLocation(this: import("../driver").AndroidDriver, location: import('@appium/types').Location): Promise<import('@appium/types').Location>;
7
+ /**
8
+ * Sends an async request to refresh the GPS cache.
9
+ *
10
+ * This feature only works if the device under test has Google Play Services
11
+ * installed. In case the vanilla LocationManager is used the device API level
12
+ * must be at version 30 (Android R) or higher.
13
+ *
14
+ * @this {import('../driver').AndroidDriver}
15
+ * @param {import('./types').GpsCacheRefreshOpts} [opts={}]
16
+ * @returns {Promise<void>}
17
+ */
18
+ export function mobileRefreshGpsCache(this: import("../driver").AndroidDriver, opts?: import("./types").GpsCacheRefreshOpts | undefined): Promise<void>;
19
+ /**
20
+ * @this {import('../driver').AndroidDriver}
21
+ * @returns {Promise<import('@appium/types').Location>}
22
+ */
23
+ export function getGeoLocation(this: import("../driver").AndroidDriver): Promise<import('@appium/types').Location>;
24
+ /**
25
+ * @this {import('../driver').AndroidDriver}
26
+ * @returns {Promise<boolean>}
27
+ */
28
+ export function isLocationServicesEnabled(this: import("../driver").AndroidDriver): Promise<boolean>;
29
+ /**
30
+ * @this {import('../driver').AndroidDriver}
31
+ * @returns {Promise<void>}
32
+ */
33
+ export function toggleLocationServices(this: import("../driver").AndroidDriver): Promise<void>;
34
+ /**
35
+ * @this {import('../driver').AndroidDriver}
36
+ * @param {string} appId
37
+ * @returns {Promise<void>}
38
+ */
39
+ export function setMockLocationApp(this: import("../driver").AndroidDriver, appId: string): Promise<void>;
40
+ /**
41
+ * @this {import('../driver').AndroidDriver}
42
+ * @returns {Promise<void>}
43
+ */
44
+ export function resetMockLocation(this: import("../driver").AndroidDriver): Promise<void>;
45
+ //# sourceMappingURL=geolocation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"geolocation.d.ts","sourceRoot":"","sources":["../../../lib/commands/geolocation.js"],"names":[],"mappings":"AAeA;;;;GAIG;AACH,kFAHW,OAAO,eAAe,EAAE,QAAQ,GAC9B,QAAQ,OAAO,eAAe,EAAE,QAAQ,CAAC,CAiBrD;AAED;;;;;;;;;;GAUG;AACH,0IAFa,QAAQ,IAAI,CAAC,CAKzB;AAED;;;GAGG;AACH,yEAFa,QAAQ,OAAO,eAAe,EAAE,QAAQ,CAAC,CASrD;AAED;;;GAGG;AACH,oFAFa,QAAQ,OAAO,CAAC,CAI5B;AAED;;;GAGG;AACH,iFAFa,QAAQ,IAAI,CAAC,CAUzB;AAID;;;;GAIG;AACH,mFAHW,MAAM,GACJ,QAAQ,IAAI,CAAC,CAoCzB;AAED;;;GAGG;AACH,4EAFa,QAAQ,IAAI,CAAC,CA2CzB"}