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.
- package/CHANGELOG.md +7 -0
- package/build/lib/commands/actions.d.ts +6 -224
- package/build/lib/commands/actions.d.ts.map +1 -1
- package/build/lib/commands/actions.js +306 -405
- package/build/lib/commands/actions.js.map +1 -1
- package/build/lib/commands/alert.d.ts +7 -9
- package/build/lib/commands/alert.d.ts.map +1 -1
- package/build/lib/commands/alert.js +24 -18
- package/build/lib/commands/alert.js.map +1 -1
- package/build/lib/commands/app-management.d.ts +7 -313
- package/build/lib/commands/app-management.d.ts.map +1 -1
- package/build/lib/commands/app-management.js +135 -293
- package/build/lib/commands/app-management.js.map +1 -1
- package/build/lib/commands/context.d.ts +8 -92
- package/build/lib/commands/context.d.ts.map +1 -1
- package/build/lib/commands/context.js +381 -439
- package/build/lib/commands/context.js.map +1 -1
- package/build/lib/commands/element.d.ts +8 -35
- package/build/lib/commands/element.d.ts.map +1 -1
- package/build/lib/commands/element.js +153 -136
- package/build/lib/commands/element.js.map +1 -1
- package/build/lib/commands/emu-console.d.ts +6 -48
- package/build/lib/commands/emu-console.d.ts.map +1 -1
- package/build/lib/commands/emu-console.js +19 -34
- package/build/lib/commands/emu-console.js.map +1 -1
- package/build/lib/commands/execute.d.ts +6 -5
- package/build/lib/commands/execute.d.ts.map +1 -1
- package/build/lib/commands/execute.js +77 -66
- package/build/lib/commands/execute.js.map +1 -1
- package/build/lib/commands/file-actions.d.ts +7 -128
- package/build/lib/commands/file-actions.d.ts.map +1 -1
- package/build/lib/commands/file-actions.js +183 -219
- package/build/lib/commands/file-actions.js.map +1 -1
- package/build/lib/commands/find.d.ts +8 -12
- package/build/lib/commands/find.d.ts.map +1 -1
- package/build/lib/commands/find.js +19 -23
- package/build/lib/commands/find.js.map +1 -1
- package/build/lib/commands/general.d.ts +9 -132
- package/build/lib/commands/general.d.ts.map +1 -1
- package/build/lib/commands/general.js +281 -312
- package/build/lib/commands/general.js.map +1 -1
- package/build/lib/commands/ime.d.ts +7 -10
- package/build/lib/commands/ime.d.ts.map +1 -1
- package/build/lib/commands/ime.js +47 -35
- package/build/lib/commands/ime.js.map +1 -1
- package/build/lib/commands/index.d.ts +27 -2
- package/build/lib/commands/index.d.ts.map +1 -1
- package/build/lib/commands/index.js +41 -19
- package/build/lib/commands/index.js.map +1 -1
- package/build/lib/commands/intent.d.ts +7 -417
- package/build/lib/commands/intent.d.ts.map +1 -1
- package/build/lib/commands/intent.js +104 -216
- package/build/lib/commands/intent.js.map +1 -1
- package/build/lib/commands/keyboard.d.ts +6 -5
- package/build/lib/commands/keyboard.d.ts.map +1 -1
- package/build/lib/commands/keyboard.js +16 -8
- package/build/lib/commands/keyboard.js.map +1 -1
- package/build/lib/commands/log.d.ts +7 -44
- package/build/lib/commands/log.d.ts.map +1 -1
- package/build/lib/commands/log.js +146 -108
- package/build/lib/commands/log.js.map +1 -1
- package/build/lib/commands/media-projection.d.ts +7 -143
- package/build/lib/commands/media-projection.d.ts.map +1 -1
- package/build/lib/commands/media-projection.js +113 -140
- package/build/lib/commands/media-projection.js.map +1 -1
- package/build/lib/commands/mixins.d.ts +740 -0
- package/build/lib/commands/mixins.d.ts.map +1 -0
- package/build/lib/commands/mixins.js +19 -0
- package/build/lib/commands/mixins.js.map +1 -0
- package/build/lib/commands/network.d.ts +7 -138
- package/build/lib/commands/network.d.ts.map +1 -1
- package/build/lib/commands/network.js +212 -254
- package/build/lib/commands/network.js.map +1 -1
- package/build/lib/commands/performance.d.ts +24 -70
- package/build/lib/commands/performance.d.ts.map +1 -1
- package/build/lib/commands/performance.js +144 -100
- package/build/lib/commands/performance.js.map +1 -1
- package/build/lib/commands/permissions.d.ts +8 -92
- package/build/lib/commands/permissions.d.ts.map +1 -1
- package/build/lib/commands/permissions.js +75 -87
- package/build/lib/commands/permissions.js.map +1 -1
- package/build/lib/commands/recordscreen.d.ts +7 -193
- package/build/lib/commands/recordscreen.d.ts.map +1 -1
- package/build/lib/commands/recordscreen.js +151 -182
- package/build/lib/commands/recordscreen.js.map +1 -1
- package/build/lib/commands/shell.d.ts +7 -7
- package/build/lib/commands/shell.d.ts.map +1 -1
- package/build/lib/commands/shell.js +40 -33
- package/build/lib/commands/shell.js.map +1 -1
- package/build/lib/commands/streamscreen.d.ts +9 -103
- package/build/lib/commands/streamscreen.d.ts.map +1 -1
- package/build/lib/commands/streamscreen.js +261 -218
- package/build/lib/commands/streamscreen.js.map +1 -1
- package/build/lib/commands/system-bars.d.ts +22 -90
- package/build/lib/commands/system-bars.d.ts.map +1 -1
- package/build/lib/commands/system-bars.js +76 -74
- package/build/lib/commands/system-bars.js.map +1 -1
- package/build/lib/commands/touch.d.ts +10 -29
- package/build/lib/commands/touch.d.ts.map +1 -1
- package/build/lib/commands/touch.js +301 -285
- package/build/lib/commands/touch.js.map +1 -1
- package/build/lib/commands/types.d.ts +978 -0
- package/build/lib/commands/types.d.ts.map +1 -0
- package/build/lib/commands/types.js +3 -0
- package/build/lib/commands/types.js.map +1 -0
- package/build/lib/constraints.d.ts +291 -0
- package/build/lib/constraints.d.ts.map +1 -0
- package/build/lib/{desired-caps.js → constraints.js} +103 -102
- package/build/lib/constraints.js.map +1 -0
- package/build/lib/driver.d.ts +68 -37
- package/build/lib/driver.d.ts.map +1 -1
- package/build/lib/driver.js +123 -80
- package/build/lib/driver.js.map +1 -1
- package/build/lib/helpers/android.d.ts +164 -0
- package/build/lib/helpers/android.d.ts.map +1 -0
- package/build/lib/helpers/android.js +819 -0
- package/build/lib/helpers/android.js.map +1 -0
- package/build/lib/helpers/index.d.ts +7 -0
- package/build/lib/helpers/index.d.ts.map +1 -0
- package/build/lib/helpers/index.js +29 -0
- package/build/lib/helpers/index.js.map +1 -0
- package/build/lib/helpers/types.d.ts +121 -0
- package/build/lib/helpers/types.d.ts.map +1 -0
- package/build/lib/helpers/types.js +3 -0
- package/build/lib/helpers/types.js.map +1 -0
- package/build/lib/helpers/unlock.d.ts +32 -0
- package/build/lib/helpers/unlock.d.ts.map +1 -0
- package/build/lib/helpers/unlock.js +273 -0
- package/build/lib/helpers/unlock.js.map +1 -0
- package/build/lib/helpers/webview.d.ts +74 -0
- package/build/lib/helpers/webview.d.ts.map +1 -0
- package/build/lib/helpers/webview.js +421 -0
- package/build/lib/helpers/webview.js.map +1 -0
- package/build/lib/index.d.ts +9 -0
- package/build/lib/index.d.ts.map +1 -0
- package/build/lib/index.js +37 -0
- package/build/lib/index.js.map +1 -0
- package/build/lib/method-map.d.ts +0 -8
- package/build/lib/method-map.d.ts.map +1 -1
- package/build/lib/method-map.js +63 -74
- package/build/lib/method-map.js.map +1 -1
- package/build/lib/stubs.d.ts +0 -1
- package/build/lib/stubs.d.ts.map +1 -1
- package/build/lib/stubs.js +1 -0
- package/build/lib/stubs.js.map +1 -1
- package/build/lib/utils.d.ts +1 -1
- package/build/lib/utils.d.ts.map +1 -1
- package/lib/commands/actions.js +351 -464
- package/lib/commands/alert.js +27 -17
- package/lib/commands/app-management.js +156 -314
- package/lib/commands/context.js +457 -441
- package/lib/commands/element.js +201 -157
- package/lib/commands/emu-console.js +25 -45
- package/lib/commands/execute.js +106 -90
- package/lib/commands/file-actions.js +222 -240
- package/lib/commands/find.ts +103 -0
- package/lib/commands/general.js +327 -339
- package/lib/commands/ime.js +50 -34
- package/lib/commands/{index.js → index.ts} +20 -24
- package/lib/commands/intent.js +108 -249
- package/lib/commands/keyboard.js +20 -8
- package/lib/commands/log.js +172 -116
- package/lib/commands/media-projection.js +134 -161
- package/lib/commands/mixins.ts +966 -0
- package/lib/commands/network.js +252 -281
- package/lib/commands/performance.js +203 -132
- package/lib/commands/permissions.js +108 -109
- package/lib/commands/recordscreen.js +212 -209
- package/lib/commands/shell.js +51 -40
- package/lib/commands/streamscreen.js +355 -289
- package/lib/commands/system-bars.js +92 -83
- package/lib/commands/touch.js +357 -294
- package/lib/commands/types.ts +1097 -0
- package/lib/{desired-caps.js → constraints.ts} +106 -103
- package/lib/{driver.js → driver.ts} +278 -132
- package/lib/helpers/android.ts +1143 -0
- package/lib/helpers/index.ts +6 -0
- package/lib/helpers/types.ts +134 -0
- package/lib/helpers/unlock.ts +329 -0
- package/lib/helpers/webview.ts +582 -0
- package/lib/index.ts +18 -0
- package/lib/method-map.js +87 -98
- package/lib/stubs.ts +0 -1
- package/package.json +26 -19
- package/build/index.js +0 -51
- package/build/lib/android-helpers.d.ts +0 -136
- package/build/lib/android-helpers.d.ts.map +0 -1
- package/build/lib/android-helpers.js +0 -855
- package/build/lib/android-helpers.js.map +0 -1
- package/build/lib/commands/coverage.d.ts +0 -5
- package/build/lib/commands/coverage.d.ts.map +0 -1
- package/build/lib/commands/coverage.js +0 -19
- package/build/lib/commands/coverage.js.map +0 -1
- package/build/lib/desired-caps.d.ts +0 -353
- package/build/lib/desired-caps.d.ts.map +0 -1
- package/build/lib/desired-caps.js.map +0 -1
- package/build/lib/unlock-helpers.d.ts +0 -38
- package/build/lib/unlock-helpers.d.ts.map +0 -1
- package/build/lib/unlock-helpers.js +0 -266
- package/build/lib/unlock-helpers.js.map +0 -1
- package/build/lib/webview-helpers.d.ts +0 -224
- package/build/lib/webview-helpers.d.ts.map +0 -1
- package/build/lib/webview-helpers.js +0 -528
- package/build/lib/webview-helpers.js.map +0 -1
- package/index.js +0 -24
- package/lib/android-helpers.js +0 -983
- package/lib/commands/coverage.js +0 -18
- package/lib/commands/find.js +0 -82
- package/lib/unlock-helpers.js +0 -278
- 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
|
-
|
|
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
|
|
11
|
+
const logger_1 = __importDefault(require("../logger"));
|
|
12
|
+
const mixins_1 = require("./mixins");
|
|
12
13
|
const GET_SERVER_LOGS_FEATURE = 'get_server_logs';
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
-
|
|
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
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
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
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
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
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
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
|
-
|
|
96
|
-
|
|
97
|
-
closeMsg += ` Code: ${code}.`;
|
|
106
|
+
else {
|
|
107
|
+
logger_1.default.debug('Established a new logcat listener web socket connection');
|
|
98
108
|
}
|
|
99
|
-
if (
|
|
100
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
*
|
|
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":"
|
|
1
|
+
{"version":3,"file":"log.js","sourceRoot":"","sources":["../../../lib/commands/log.js"],"names":[],"mappings":";AAAA,YAAY;;;;;AAEZ,0CAAqE;AACrE,oDAAuB;AACvB,sDAAyB;AACzB,4CAA2B;AAC3B,uDAA4B;AAC5B,qCAA+B;AAE/B,MAAM,uBAAuB,GAAG,iBAAiB,CAAC;AAElD;;;GAGG;AACH,MAAM,kBAAkB,GAAG,CAAC,SAAS,EAAE,EAAE,CACvC,GAAG,mCAA0B,YAAY,SAAS,uBAAuB,CAAC;AAE5E;;;;;;GAMG;AACH,SAAS,WAAW,CAAC,SAAS,EAAE,KAAK,EAAE,OAAO;IAC5C,OAAO;QACL,SAAS;QACT,KAAK;QACL,OAAO;KACR,CAAC;AACJ,CAAC;AACD;;;GAGG;AACH,MAAM,QAAQ,GAAG;IACf,iBAAiB,EAAE;QACjB,MAAM,EAAE;YACN,WAAW,EAAE,oEAAoE;YACjF;;;;eAIG;YACH,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,kBAAkB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,aAAa,EAAE;SAChE;QACD,SAAS,EAAE;YACT,WAAW,EAAE,uDAAuD;YACpE;;;;eAIG;YACH,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;gBACrB,MAAM,MAAM,GAAG,MAAM,kBAAkB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,CAAC;gBAC/D,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;gBAC7B,OAAO,MAAM,CAAC,KAAK,CAAC,iBAAE,CA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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
|
|
2
|
-
export type
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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":"
|
|
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"}
|