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,20 +1,28 @@
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.helpers = exports.commands = void 0;
7
- const logger_1 = __importDefault(require("../logger"));
8
- const os_1 = __importDefault(require("os"));
7
+ const driver_1 = require("appium/driver");
9
8
  const lodash_1 = __importDefault(require("lodash"));
9
+ const node_os_1 = __importDefault(require("node:os"));
10
10
  const ws_1 = __importDefault(require("ws"));
11
- const driver_1 = require("appium/driver");
11
+ const logger_1 = __importDefault(require("../logger"));
12
+ const mixins_1 = require("./mixins");
12
13
  const GET_SERVER_LOGS_FEATURE = 'get_server_logs';
13
- let commands = {}, helpers = {}, extensions = {};
14
- exports.commands = commands;
15
- exports.helpers = helpers;
14
+ /**
15
+ * @param {string} sessionId
16
+ * @returns {string}
17
+ */
16
18
  const WEBSOCKET_ENDPOINT = (sessionId) => `${driver_1.DEFAULT_WS_PATHNAME_PREFIX}/session/${sessionId}/appium/device/logcat`;
17
- // https://github.com/SeleniumHQ/selenium/blob/0d425676b3c9df261dd641917f867d4d5ce7774d/java/client/src/org/openqa/selenium/logging/LogEntry.java
19
+ /**
20
+ *
21
+ * @see {@link https://github.com/SeleniumHQ/selenium/blob/0d425676b3c9df261dd641917f867d4d5ce7774d/java/client/src/org/openqa/selenium/logging/LogEntry.java}
22
+ * @param {number} timestamp
23
+ * @param {string} level
24
+ * @param {string} message
25
+ */
18
26
  function toLogRecord(timestamp, level, message) {
19
27
  return {
20
28
  timestamp,
@@ -22,115 +30,145 @@ function toLogRecord(timestamp, level, message) {
22
30
  message,
23
31
  };
24
32
  }
25
- extensions.supportedLogTypes = {
26
- logcat: {
27
- description: 'Logs for Android applications on real device and emulators via ADB',
28
- getter: async (self) => await self.adb.getLogcatLogs(),
29
- },
30
- bugreport: {
31
- description: `'adb bugreport' output for advanced issues diagnostic`,
32
- getter: async (self) => {
33
- const output = await self.adb.bugreport();
34
- const timestamp = Date.now();
35
- return output.split(os_1.default.EOL)
36
- .map((x) => toLogRecord(timestamp, 'ALL', x));
33
+ /**
34
+ * @type {import('./mixins').LogMixin & ThisType<import('../driver').AndroidDriver>}
35
+ * @satisfies {import('@appium/types').ExternalDriver}
36
+ */
37
+ const LogMixin = {
38
+ supportedLogTypes: {
39
+ logcat: {
40
+ description: 'Logs for Android applications on real device and emulators via ADB',
41
+ /**
42
+ *
43
+ * @param {import('../driver').AndroidDriver} self
44
+ * @returns
45
+ */
46
+ getter: (self) => /** @type {ADB} */ (self.adb).getLogcatLogs(),
37
47
  },
38
- },
39
- server: {
40
- description: 'Appium server logs',
41
- getter: (self) => {
42
- self.ensureFeatureEnabled(GET_SERVER_LOGS_FEATURE);
43
- const timestamp = Date.now();
44
- return logger_1.default.unwrap().record
45
- .map((x) => toLogRecord(timestamp, 'ALL', lodash_1.default.isEmpty(x.prefix) ? x.message : `[${x.prefix}] ${x.message}`));
48
+ bugreport: {
49
+ description: `'adb bugreport' output for advanced issues diagnostic`,
50
+ /**
51
+ *
52
+ * @param {import('../driver').AndroidDriver} self
53
+ * @returns
54
+ */
55
+ getter: async (self) => {
56
+ const output = await /** @type {ADB} */ (self.adb).bugreport();
57
+ const timestamp = Date.now();
58
+ return output.split(node_os_1.default.EOL).map((x) => toLogRecord(timestamp, 'ALL', x));
59
+ },
60
+ },
61
+ server: {
62
+ description: 'Appium server logs',
63
+ /**
64
+ *
65
+ * @param {import('../driver').AndroidDriver} self
66
+ * @returns
67
+ */
68
+ getter: (self) => {
69
+ self.ensureFeatureEnabled(GET_SERVER_LOGS_FEATURE);
70
+ const timestamp = Date.now();
71
+ return logger_1.default
72
+ .unwrap()
73
+ .record.map((x) => toLogRecord(timestamp, 'ALL', lodash_1.default.isEmpty(x.prefix) ? x.message : `[${x.prefix}] ${x.message}`));
74
+ },
46
75
  },
47
76
  },
48
- };
49
- /**
50
- * Starts Android logcat broadcast websocket on the same host and port
51
- * where Appium server is running at `/ws/session/:sessionId:/appium/logcat` endpoint. The method
52
- * will return immediately if the web socket is already listening.
53
- *
54
- * Each connected websocket listener will receive logcat log lines
55
- * as soon as they are visible to Appium.
56
- */
57
- commands.mobileStartLogsBroadcast = async function mobileStartLogsBroadcast() {
58
- const pathname = WEBSOCKET_ENDPOINT(this.sessionId);
59
- if (!lodash_1.default.isEmpty(await this.server.getWebSocketHandlers(pathname))) {
60
- logger_1.default.debug(`The logcat broadcasting web socket server is already listening at ${pathname}`);
61
- return;
62
- }
63
- logger_1.default.info(`Starting logcat broadcasting on web socket server ` +
64
- `${JSON.stringify(this.server.address())} to ${pathname}`);
65
- // https://github.com/websockets/ws/blob/master/doc/ws.md
66
- const wss = new ws_1.default.Server({
67
- noServer: true,
68
- });
69
- wss.on('connection', (ws, req) => {
70
- if (req) {
71
- const remoteIp = lodash_1.default.isEmpty(req.headers['x-forwarded-for'])
72
- ? req.connection?.remoteAddress
73
- : req.headers['x-forwarded-for'];
74
- logger_1.default.debug(`Established a new logcat listener web socket connection from ${remoteIp}`);
77
+ /**
78
+ * Starts Android logcat broadcast websocket on the same host and port
79
+ * where Appium server is running at `/ws/session/:sessionId:/appium/logcat` endpoint. The method
80
+ * will return immediately if the web socket is already listening.
81
+ *
82
+ * Each connected websocket listener will receive logcat log lines
83
+ * as soon as they are visible to Appium.
84
+ */
85
+ async mobileStartLogsBroadcast() {
86
+ const server = /** @type {import('@appium/types').AppiumServer} */ (this.server);
87
+ const adb = /** @type {ADB} */ (this.adb);
88
+ const pathname = WEBSOCKET_ENDPOINT(/** @type {string} */ (this.sessionId));
89
+ if (!lodash_1.default.isEmpty(await server.getWebSocketHandlers(pathname))) {
90
+ logger_1.default.debug(`The logcat broadcasting web socket server is already listening at ${pathname}`);
91
+ return;
75
92
  }
76
- else {
77
- logger_1.default.debug('Established a new logcat listener web socket connection');
78
- }
79
- if (lodash_1.default.isEmpty(this._logcatWebsocketListener)) {
80
- this._logcatWebsocketListener = (logRecord) => {
81
- if (ws?.readyState === ws_1.default.OPEN) {
82
- ws.send(logRecord.message);
83
- }
84
- };
85
- }
86
- this.adb.setLogcatListener(this._logcatWebsocketListener);
87
- ws.on('close', (code, reason) => {
88
- if (!lodash_1.default.isEmpty(this._logcatWebsocketListener)) {
89
- try {
90
- this.adb.removeLogcatListener(this._logcatWebsocketListener);
91
- }
92
- catch (ign) { }
93
- this._logcatWebsocketListener = null;
93
+ logger_1.default.info(`Starting logcat broadcasting on web socket server ` +
94
+ `${JSON.stringify(server.address())} to ${pathname}`);
95
+ // https://github.com/websockets/ws/blob/master/doc/ws.md
96
+ const wss = new ws_1.default.Server({
97
+ noServer: true,
98
+ });
99
+ wss.on('connection', (ws, req) => {
100
+ if (req) {
101
+ const remoteIp = lodash_1.default.isEmpty(req.headers['x-forwarded-for'])
102
+ ? req.connection?.remoteAddress
103
+ : req.headers['x-forwarded-for'];
104
+ logger_1.default.debug(`Established a new logcat listener web socket connection from ${remoteIp}`);
94
105
  }
95
- let closeMsg = 'Logcat listener web socket is closed.';
96
- if (!lodash_1.default.isEmpty(code)) {
97
- closeMsg += ` Code: ${code}.`;
106
+ else {
107
+ logger_1.default.debug('Established a new logcat listener web socket connection');
98
108
  }
99
- if (!lodash_1.default.isEmpty(reason)) {
100
- closeMsg += ` Reason: ${reason.toString()}.`;
109
+ if (lodash_1.default.isEmpty(this._logcatWebsocketListener)) {
110
+ this._logcatWebsocketListener = (logRecord) => {
111
+ if (ws?.readyState === ws_1.default.OPEN) {
112
+ ws.send(logRecord.message);
113
+ }
114
+ };
101
115
  }
102
- logger_1.default.debug(closeMsg);
116
+ adb.setLogcatListener(this._logcatWebsocketListener);
117
+ ws.on('close', (code, reason) => {
118
+ if (!lodash_1.default.isEmpty(this._logcatWebsocketListener)) {
119
+ try {
120
+ adb.removeLogcatListener(this._logcatWebsocketListener);
121
+ }
122
+ catch (ign) { }
123
+ this._logcatWebsocketListener = undefined;
124
+ }
125
+ let closeMsg = 'Logcat listener web socket is closed.';
126
+ if (!lodash_1.default.isEmpty(code)) {
127
+ closeMsg += ` Code: ${code}.`;
128
+ }
129
+ if (!lodash_1.default.isEmpty(reason)) {
130
+ closeMsg += ` Reason: ${reason.toString()}.`;
131
+ }
132
+ logger_1.default.debug(closeMsg);
133
+ });
103
134
  });
104
- });
105
- await this.server.addWebSocketHandler(pathname, wss);
135
+ await server.addWebSocketHandler(pathname,
136
+ /** @type {import('@appium/types').WSServer} */ (wss));
137
+ },
138
+ /**
139
+ * Stops the previously started logcat broadcasting wesocket server.
140
+ * This method will return immediately if no server is running.
141
+ */
142
+ async mobileStopLogsBroadcast() {
143
+ const pathname = WEBSOCKET_ENDPOINT(/** @type {string} */ (this.sessionId));
144
+ const server = /** @type {import('@appium/types').AppiumServer} */ (this.server);
145
+ if (lodash_1.default.isEmpty(await server.getWebSocketHandlers(pathname))) {
146
+ return;
147
+ }
148
+ logger_1.default.debug(`Stopping logcat broadcasting on web socket server ` +
149
+ `${JSON.stringify(server.address())} to ${pathname}`);
150
+ await server.removeWebSocketHandler(pathname);
151
+ },
152
+ async getLogTypes() {
153
+ // XXX why doesn't `super` work here?
154
+ const nativeLogTypes = await driver_1.BaseDriver.prototype.getLogTypes.call(this);
155
+ if (this.isWebContext()) {
156
+ const webLogTypes = /** @type {string[]} */ (await /** @type {import('appium-chromedriver').Chromedriver} */ (this.chromedriver).jwproxy.command('/log/types', 'GET'));
157
+ return [...nativeLogTypes, ...webLogTypes];
158
+ }
159
+ return nativeLogTypes;
160
+ },
161
+ async getLog(logType) {
162
+ if (this.isWebContext() && !lodash_1.default.keys(this.supportedLogTypes).includes(logType)) {
163
+ return await /** @type {import('appium-chromedriver').Chromedriver} */ (this.chromedriver).jwproxy.command('/log', 'POST', { type: logType });
164
+ }
165
+ // XXX why doesn't `super` work here?
166
+ return await driver_1.BaseDriver.prototype.getLog.call(this, logType);
167
+ },
106
168
  };
169
+ (0, mixins_1.mixin)(LogMixin);
170
+ exports.default = LogMixin;
107
171
  /**
108
- * Stops the previously started logcat broadcasting wesocket server.
109
- * This method will return immediately if no server is running.
172
+ * @typedef {import('appium-adb').ADB} ADB
110
173
  */
111
- commands.mobileStopLogsBroadcast = async function mobileStopLogsBroadcast() {
112
- const pathname = WEBSOCKET_ENDPOINT(this.sessionId);
113
- if (lodash_1.default.isEmpty(await this.server.getWebSocketHandlers(pathname))) {
114
- return;
115
- }
116
- logger_1.default.debug(`Stopping logcat broadcasting on web socket server ` +
117
- `${JSON.stringify(this.server.address())} to ${pathname}`);
118
- await this.server.removeWebSocketHandler(pathname);
119
- };
120
- commands.getLogTypes = async function getLogTypes() {
121
- const nativeLogTypes = await driver_1.BaseDriver.prototype.getLogTypes.call(this);
122
- if (this.isWebContext()) {
123
- const webLogTypes = await this.chromedriver.jwproxy.command('/log/types', 'GET');
124
- return [...nativeLogTypes, ...webLogTypes];
125
- }
126
- return nativeLogTypes;
127
- };
128
- commands.getLog = async function getLog(logType) {
129
- if (this.isWebContext() && !lodash_1.default.keys(this.supportedLogTypes).includes(logType)) {
130
- return await this.chromedriver.jwproxy.command('/log', 'POST', { type: logType });
131
- }
132
- return await driver_1.BaseDriver.prototype.getLog.call(this, logType);
133
- };
134
- Object.assign(extensions, commands, helpers);
135
- exports.default = extensions;
136
174
  //# sourceMappingURL=log.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"log.js","sourceRoot":"","sources":["../../../lib/commands/log.js"],"names":[],"mappings":";;;;;;AAAA,uDAA4B;AAC5B,4CAAoB;AACpB,oDAAuB;AACvB,4CAA2B;AAC3B,0CAAuE;AAEvE,MAAM,uBAAuB,GAAG,iBAAiB,C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CAAC,YAAY,EAAE,EAAE;YACvB,MAAM,WAAW,GAAG,uBAAuB,CAAC,CAC1C,MAAM,yDAAyD,CAAC,CAC9D,IAAI,CAAC,YAAY,CAClB,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,EAAE,KAAK,CAAC,CACvC,CAAC;YACF,OAAO,CAAC,GAAG,cAAc,EAAE,GAAG,WAAW,CAAC,CAAC;SAC5C;QACD,OAAO,cAAc,CAAC;IACxB,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,OAAO;QAClB,IAAI,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,gBAAC,CAAC,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE;YAC5E,OAAO,MAAM,yDAAyD,CAAC,CACrE,IAAI,CAAC,YAAY,CAClB,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC,CAAC;SACpD;QACD,qCAAqC;QACrC,OAAO,MAAM,mBAAU,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC/D,CAAC;CACF,CAAC;AAEF,IAAA,cAAK,EAAC,QAAQ,CAAC,CAAC;AAEhB,kBAAe,QAAQ,CAAC;AAExB;;GAEG"}
@@ -1,144 +1,8 @@
1
- export default commands;
2
- export type StartRecordingOptions = {
3
- /**
4
- * Maximum supported resolution on-device (Detected
5
- * automatically by the app itself), which usually equals to Full HD 1920x1080 on most
6
- * phones however you can change it to following supported resolutions
7
- * as well: "1920x1080", "1280x720", "720x480", "320x240", "176x144".
8
- */
9
- resolution: string | null;
10
- /**
11
- * [900] Default value: 900 seconds which means
12
- * maximum allowed duration is 15 minute, you can increase it if your test takes
13
- * longer than that.
14
- */
15
- maxDurationSec: number | null;
16
- /**
17
- * [high] Means recording thread priority is maximum
18
- * however if you face performance drops during testing with recording enabled, you
19
- * can reduce recording priority to "normal" or "low".
20
- */
21
- priority: string | null;
22
- /**
23
- * You can type recording video file name as you want,
24
- * but recording currently supports only "mp4" format so your filename must end with ".mp4".
25
- * An invalid file name will fail to start the recording.
26
- * If not provided then the current timestamp will be used as file name.
27
- */
28
- filename: string | null;
29
- };
30
- export type StopRecordingOptions = {
31
- /**
32
- * The path to the remote location, where the resulting video should be uploaded.
33
- * The following protocols are supported: http/https, ftp.
34
- * Null or empty string value (the default setting) means the content of resulting
35
- * file should be encoded as Base64 and passed as the endpoont response value.
36
- * An exception will be thrown if the generated media file is too big to
37
- * fit into the available process memory.
38
- */
39
- remotePath: string | null;
40
- /**
41
- * The name of the user for the remote authentication.
42
- */
43
- user: string | null;
44
- /**
45
- * The password for the remote authentication.
46
- */
47
- pass: string | null;
48
- /**
49
- * The http multipart upload method name. The 'PUT' one is used by default.
50
- */
51
- method: string | null;
52
- /**
53
- * Additional headers mapping for multipart http(s) uploads
54
- */
55
- headers: any | null;
56
- /**
57
- * [file] The name of the form field, where the file content BLOB should be stored for
58
- * http(s) uploads
59
- */
60
- fileFieldName: string | null;
61
- /**
62
- * Additional form fields for multipart http(s) uploads
63
- */
64
- formFields: any | (Array<Pair> | null);
65
- /**
66
- * - The actual media upload request timeout in milliseconds;
67
- * defaults to
68
- */
69
- uploadTimeout: number | null;
70
- };
71
- export namespace commands {
72
- /**
73
- * @typedef {Object} StartRecordingOptions
74
- *
75
- * @property {string?} resolution Maximum supported resolution on-device (Detected
76
- * automatically by the app itself), which usually equals to Full HD 1920x1080 on most
77
- * phones however you can change it to following supported resolutions
78
- * as well: "1920x1080", "1280x720", "720x480", "320x240", "176x144".
79
- * @property {number?} maxDurationSec [900] Default value: 900 seconds which means
80
- * maximum allowed duration is 15 minute, you can increase it if your test takes
81
- * longer than that.
82
- * @property {string?} priority [high] Means recording thread priority is maximum
83
- * however if you face performance drops during testing with recording enabled, you
84
- * can reduce recording priority to "normal" or "low".
85
- * @property {string?} filename You can type recording video file name as you want,
86
- * but recording currently supports only "mp4" format so your filename must end with ".mp4".
87
- * An invalid file name will fail to start the recording.
88
- * If not provided then the current timestamp will be used as file name.
89
- */
90
- /**
91
- * Record the display of a real devices running Android 10 (API level 29) and higher.
92
- * The screen activity is recorded to a MPEG-4 file. Audio is also recorded by default
93
- * (only for apps that allow it in their manifests).
94
- * If another recording has been already started then the command will exit silently.
95
- * The previously recorded video file is deleted when a new recording session is started.
96
- * Recording continues it is stopped explicitly or until the timeout happens.
97
- *
98
- * @param {?StartRecordingOptions} options Available options.
99
- * @returns {boolean} True if a new recording has successfully started.
100
- * @throws {Error} If recording has failed to start or is not supported on the device under test.
101
- */
102
- function mobileStartMediaProjectionRecording(options?: StartRecordingOptions | null): boolean;
103
- /**
104
- * Checks if a media projection-based recording is currently running.
105
- *
106
- * @returns {boolean} True if a recording is in progress.
107
- * @throws {Error} If a recording is not supported on the device under test.
108
- */
109
- function mobileIsMediaProjectionRecordingRunning(): boolean;
110
- /**
111
- * @typedef {Object} StopRecordingOptions
112
- *
113
- * @property {string?} remotePath The path to the remote location, where the resulting video should be uploaded.
114
- * The following protocols are supported: http/https, ftp.
115
- * Null or empty string value (the default setting) means the content of resulting
116
- * file should be encoded as Base64 and passed as the endpoont response value.
117
- * An exception will be thrown if the generated media file is too big to
118
- * fit into the available process memory.
119
- * @property {string?} user The name of the user for the remote authentication.
120
- * @property {string?} pass The password for the remote authentication.
121
- * @property {string?} method The http multipart upload method name. The 'PUT' one is used by default.
122
- * @property {Object?} headers Additional headers mapping for multipart http(s) uploads
123
- * @property {string?} fileFieldName [file] The name of the form field, where the file content BLOB should be stored for
124
- * http(s) uploads
125
- * @property {Object|Array<Pair>?} formFields Additional form fields for multipart http(s) uploads
126
- * @property {number?} uploadTimeout - The actual media upload request timeout in milliseconds;
127
- * defaults to @appium/support net DEFAULT_TIMEOUT_MS
128
- */
129
- /**
130
- * Stop a media projection-based recording.
131
- * If no recording has been started before then an error is thrown.
132
- * If the recording has been already finished before this API has been called
133
- * then the most recent recorded file is returned.
134
- *
135
- * @param {?StopRecordingOptions} options Available options.
136
- * @returns {string} Base64-encoded content of the recorded media file if 'remotePath'
137
- * parameter is falsy or an empty string.
138
- * @throws {Error} If there was an error while stopping a recording,
139
- * fetching the content of the remote media file,
140
- * or if a recording is not supported on the device under test.
141
- */
142
- function mobileStopMediaProjectionRecording(options?: StopRecordingOptions | null): string;
143
- }
1
+ export default MediaProjectionMixin;
2
+ export type ADB = import('appium-adb').ADB;
3
+ /**
4
+ * @type {import('./mixins').MediaProjectionMixin & ThisType<import('../driver').AndroidDriver>}
5
+ * @satisfies {import('@appium/types').ExternalDriver}
6
+ */
7
+ declare const MediaProjectionMixin: import('./mixins').MediaProjectionMixin & ThisType<import('../driver').AndroidDriver>;
144
8
  //# sourceMappingURL=media-projection.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"media-projection.d.ts","sourceRoot":"","sources":["../../../lib/commands/media-projection.js"],"names":[],"mappings":";;;;;;;;gBAsKc,MAAM;;;;;;oBAIN,MAAM;;;;;;cAGN,MAAM;;;;;;;cAGN,MAAM;;;;;;;;;;;gBAsDN,MAAM;;;;UAMN,MAAM;;;;UACN,MAAM;;;;YACN,MAAM;;;;;;;;;mBAEN,MAAM;;;;gBAEN,OAAO,WAAW,QAAC;;;;;mBACnB,MAAM;;;IAhFpB;;;;;;;;;;;;;;;;;OAiBG;IAEH;;;;;;;;;;;OAWG;IACH,8FAkBC;IAED;;;;;OAKG;IACH,4DAKC;IAED;;;;;;;;;;;;;;;;;;OAkBG;IAEH;;;;;;;;;;;;OAYG;IACH,2FAwBC"}
1
+ {"version":3,"file":"media-projection.d.ts","sourceRoot":"","sources":["../../../lib/commands/media-projection.js"],"names":[],"mappings":";kBAoQa,OAAO,YAAY,EAAE,GAAG;AAzErC;;;GAGG;AACH,oCAHU,OAAO,UAAU,EAAE,oBAAoB,GAAG,SAAS,OAAO,WAAW,EAAE,aAAa,CAAC,CAiE7F"}