appium-android-driver 13.3.4 → 14.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.
- package/CHANGELOG.md +16 -0
- package/build/lib/commands/app-management.d.ts +2 -2
- package/build/lib/commands/app-management.d.ts.map +1 -1
- package/build/lib/commands/app-management.js +41 -67
- package/build/lib/commands/app-management.js.map +1 -1
- package/build/lib/commands/appearance.d.ts +1 -1
- package/build/lib/commands/appearance.d.ts.map +1 -1
- package/build/lib/commands/appearance.js +2 -6
- package/build/lib/commands/appearance.js.map +1 -1
- package/build/lib/commands/bidi/constants.js +4 -8
- package/build/lib/commands/bidi/constants.js.map +1 -1
- package/build/lib/commands/bidi/models.d.ts +1 -1
- package/build/lib/commands/bidi/models.d.ts.map +1 -1
- package/build/lib/commands/bidi/models.js +7 -13
- package/build/lib/commands/bidi/models.js.map +1 -1
- package/build/lib/commands/bidi/types.js +1 -2
- package/build/lib/commands/bluetooth.d.ts +1 -1
- package/build/lib/commands/bluetooth.d.ts.map +1 -1
- package/build/lib/commands/bluetooth.js +3 -6
- package/build/lib/commands/bluetooth.js.map +1 -1
- package/build/lib/commands/context/cache.d.ts +1 -1
- package/build/lib/commands/context/cache.d.ts.map +1 -1
- package/build/lib/commands/context/cache.js +5 -10
- package/build/lib/commands/context/cache.js.map +1 -1
- package/build/lib/commands/context/exports.d.ts +2 -2
- package/build/lib/commands/context/exports.d.ts.map +1 -1
- package/build/lib/commands/context/exports.js +64 -86
- package/build/lib/commands/context/exports.js.map +1 -1
- package/build/lib/commands/context/helpers.d.ts +2 -2
- package/build/lib/commands/context/helpers.d.ts.map +1 -1
- package/build/lib/commands/context/helpers.js +69 -82
- package/build/lib/commands/context/helpers.js.map +1 -1
- package/build/lib/commands/device/common.d.ts +2 -2
- package/build/lib/commands/device/common.d.ts.map +1 -1
- package/build/lib/commands/device/common.js +47 -77
- package/build/lib/commands/device/common.js.map +1 -1
- package/build/lib/commands/device/emulator-actions.d.ts +2 -2
- package/build/lib/commands/device/emulator-actions.d.ts.map +1 -1
- package/build/lib/commands/device/emulator-actions.js +33 -52
- package/build/lib/commands/device/emulator-actions.js.map +1 -1
- package/build/lib/commands/device/emulator-console.d.ts +1 -1
- package/build/lib/commands/device/emulator-console.d.ts.map +1 -1
- package/build/lib/commands/device/emulator-console.js +3 -6
- package/build/lib/commands/device/emulator-console.js.map +1 -1
- package/build/lib/commands/device/utils.d.ts +1 -1
- package/build/lib/commands/device/utils.d.ts.map +1 -1
- package/build/lib/commands/device/utils.js +27 -37
- package/build/lib/commands/device/utils.js.map +1 -1
- package/build/lib/commands/deviceidle.d.ts +1 -1
- package/build/lib/commands/deviceidle.d.ts.map +1 -1
- package/build/lib/commands/deviceidle.js +4 -7
- package/build/lib/commands/deviceidle.js.map +1 -1
- package/build/lib/commands/element.d.ts +2 -2
- package/build/lib/commands/element.d.ts.map +1 -1
- package/build/lib/commands/element.js +22 -39
- package/build/lib/commands/element.js.map +1 -1
- package/build/lib/commands/execute.d.ts +1 -1
- package/build/lib/commands/execute.d.ts.map +1 -1
- package/build/lib/commands/execute.js +6 -9
- package/build/lib/commands/execute.js.map +1 -1
- package/build/lib/commands/file-actions.d.ts +1 -1
- package/build/lib/commands/file-actions.d.ts.map +1 -1
- package/build/lib/commands/file-actions.js +25 -34
- package/build/lib/commands/file-actions.js.map +1 -1
- package/build/lib/commands/find.d.ts +2 -2
- package/build/lib/commands/find.d.ts.map +1 -1
- package/build/lib/commands/find.js +10 -14
- package/build/lib/commands/find.js.map +1 -1
- package/build/lib/commands/geolocation.d.ts +1 -1
- package/build/lib/commands/geolocation.d.ts.map +1 -1
- package/build/lib/commands/geolocation.js +21 -35
- package/build/lib/commands/geolocation.js.map +1 -1
- package/build/lib/commands/gestures.d.ts +1 -1
- package/build/lib/commands/gestures.d.ts.map +1 -1
- package/build/lib/commands/gestures.js +4 -7
- package/build/lib/commands/gestures.js.map +1 -1
- package/build/lib/commands/image-injection.d.ts +1 -1
- package/build/lib/commands/image-injection.d.ts.map +1 -1
- package/build/lib/commands/image-injection.js +16 -23
- package/build/lib/commands/image-injection.js.map +1 -1
- package/build/lib/commands/ime.d.ts +1 -1
- package/build/lib/commands/ime.d.ts.map +1 -1
- package/build/lib/commands/ime.js +10 -18
- package/build/lib/commands/ime.js.map +1 -1
- package/build/lib/commands/intent.d.ts +1 -1
- package/build/lib/commands/intent.d.ts.map +1 -1
- package/build/lib/commands/intent.js +22 -29
- package/build/lib/commands/intent.js.map +1 -1
- package/build/lib/commands/keyboard.d.ts +2 -2
- package/build/lib/commands/keyboard.d.ts.map +1 -1
- package/build/lib/commands/keyboard.js +21 -33
- package/build/lib/commands/keyboard.js.map +1 -1
- package/build/lib/commands/legacy.d.ts +1 -1
- package/build/lib/commands/legacy.d.ts.map +1 -1
- package/build/lib/commands/legacy.js +7 -12
- package/build/lib/commands/legacy.js.map +1 -1
- package/build/lib/commands/lock/exports.d.ts +2 -2
- package/build/lib/commands/lock/exports.d.ts.map +1 -1
- package/build/lib/commands/lock/exports.js +18 -25
- package/build/lib/commands/lock/exports.js.map +1 -1
- package/build/lib/commands/lock/helpers.d.ts +2 -2
- package/build/lib/commands/lock/helpers.d.ts.map +1 -1
- package/build/lib/commands/lock/helpers.js +48 -64
- package/build/lib/commands/lock/helpers.js.map +1 -1
- package/build/lib/commands/log.d.ts +2 -2
- package/build/lib/commands/log.d.ts.map +1 -1
- package/build/lib/commands/log.js +38 -42
- package/build/lib/commands/log.js.map +1 -1
- package/build/lib/commands/media-projection.d.ts +2 -2
- package/build/lib/commands/media-projection.d.ts.map +1 -1
- package/build/lib/commands/media-projection.js +14 -22
- package/build/lib/commands/media-projection.js.map +1 -1
- package/build/lib/commands/memory.d.ts +2 -2
- package/build/lib/commands/memory.d.ts.map +1 -1
- package/build/lib/commands/memory.js +4 -7
- package/build/lib/commands/memory.js.map +1 -1
- package/build/lib/commands/misc.d.ts +2 -2
- package/build/lib/commands/misc.d.ts.map +1 -1
- package/build/lib/commands/misc.js +10 -19
- package/build/lib/commands/misc.js.map +1 -1
- package/build/lib/commands/network.d.ts +2 -2
- package/build/lib/commands/network.d.ts.map +1 -1
- package/build/lib/commands/network.js +14 -26
- package/build/lib/commands/network.js.map +1 -1
- package/build/lib/commands/nfc.d.ts +2 -2
- package/build/lib/commands/nfc.d.ts.map +1 -1
- package/build/lib/commands/nfc.js +3 -6
- package/build/lib/commands/nfc.js.map +1 -1
- package/build/lib/commands/performance.d.ts +2 -2
- package/build/lib/commands/performance.d.ts.map +1 -1
- package/build/lib/commands/performance.js +48 -58
- package/build/lib/commands/performance.js.map +1 -1
- package/build/lib/commands/permissions.d.ts +1 -1
- package/build/lib/commands/permissions.d.ts.map +1 -1
- package/build/lib/commands/permissions.js +16 -20
- package/build/lib/commands/permissions.js.map +1 -1
- package/build/lib/commands/recordscreen.d.ts +2 -2
- package/build/lib/commands/recordscreen.d.ts.map +1 -1
- package/build/lib/commands/recordscreen.js +32 -39
- package/build/lib/commands/recordscreen.js.map +1 -1
- package/build/lib/commands/resources.d.ts +1 -1
- package/build/lib/commands/resources.d.ts.map +1 -1
- package/build/lib/commands/resources.js +7 -11
- package/build/lib/commands/resources.js.map +1 -1
- package/build/lib/commands/shell.d.ts +1 -1
- package/build/lib/commands/shell.d.ts.map +1 -1
- package/build/lib/commands/shell.js +9 -12
- package/build/lib/commands/shell.js.map +1 -1
- package/build/lib/commands/streamscreen.d.ts +1 -1
- package/build/lib/commands/streamscreen.d.ts.map +1 -1
- package/build/lib/commands/streamscreen.js +32 -37
- package/build/lib/commands/streamscreen.js.map +1 -1
- package/build/lib/commands/system-bars.d.ts +2 -2
- package/build/lib/commands/system-bars.d.ts.map +1 -1
- package/build/lib/commands/system-bars.js +10 -16
- package/build/lib/commands/system-bars.js.map +1 -1
- package/build/lib/commands/time.d.ts +1 -1
- package/build/lib/commands/time.d.ts.map +1 -1
- package/build/lib/commands/time.js +9 -17
- package/build/lib/commands/time.js.map +1 -1
- package/build/lib/commands/types.d.ts +15 -1
- package/build/lib/commands/types.d.ts.map +1 -1
- package/build/lib/commands/types.js +1 -2
- package/build/lib/constraints.d.ts +3 -0
- package/build/lib/constraints.d.ts.map +1 -1
- package/build/lib/constraints.js +5 -5
- package/build/lib/constraints.js.map +1 -1
- package/build/lib/doctor/checks.js +54 -65
- package/build/lib/doctor/checks.js.map +1 -1
- package/build/lib/doctor/utils.js +4 -7
- package/build/lib/doctor/utils.js.map +1 -1
- package/build/lib/driver.d.ts +39 -39
- package/build/lib/driver.d.ts.map +1 -1
- package/build/lib/driver.js +220 -223
- package/build/lib/driver.js.map +1 -1
- package/build/lib/execute-method-map.js +1 -4
- package/build/lib/execute-method-map.js.map +1 -1
- package/build/lib/index.d.ts +7 -7
- package/build/lib/index.d.ts.map +1 -1
- package/build/lib/index.js +11 -51
- package/build/lib/index.js.map +1 -1
- package/build/lib/logger.js +2 -5
- package/build/lib/logger.js.map +1 -1
- package/build/lib/method-map.js +1 -4
- package/build/lib/method-map.js.map +1 -1
- package/build/lib/utils.d.ts +9 -7
- package/build/lib/utils.d.ts.map +1 -1
- package/build/lib/utils.js +22 -28
- package/build/lib/utils.js.map +1 -1
- package/lib/commands/app-management.ts +5 -11
- package/lib/commands/appearance.ts +1 -1
- package/lib/commands/bidi/models.ts +3 -3
- package/lib/commands/bluetooth.ts +2 -2
- package/lib/commands/context/cache.ts +1 -1
- package/lib/commands/context/exports.ts +7 -7
- package/lib/commands/context/helpers.ts +4 -4
- package/lib/commands/device/common.ts +36 -20
- package/lib/commands/device/emulator-actions.ts +4 -4
- package/lib/commands/device/emulator-console.ts +2 -2
- package/lib/commands/device/utils.ts +3 -3
- package/lib/commands/deviceidle.ts +2 -2
- package/lib/commands/element.ts +3 -3
- package/lib/commands/execute.ts +2 -2
- package/lib/commands/file-actions.ts +2 -2
- package/lib/commands/find.ts +4 -4
- package/lib/commands/geolocation.ts +2 -2
- package/lib/commands/gestures.ts +3 -3
- package/lib/commands/image-injection.ts +2 -2
- package/lib/commands/ime.ts +3 -3
- package/lib/commands/intent.ts +3 -3
- package/lib/commands/keyboard.ts +3 -3
- package/lib/commands/legacy.ts +2 -2
- package/lib/commands/lock/exports.ts +3 -3
- package/lib/commands/lock/helpers.ts +2 -2
- package/lib/commands/log.ts +18 -11
- package/lib/commands/media-projection.ts +2 -2
- package/lib/commands/memory.ts +3 -3
- package/lib/commands/misc.ts +3 -3
- package/lib/commands/network.ts +3 -3
- package/lib/commands/nfc.ts +3 -3
- package/lib/commands/performance.ts +4 -4
- package/lib/commands/permissions.ts +3 -3
- package/lib/commands/recordscreen.ts +5 -5
- package/lib/commands/resources.ts +2 -2
- package/lib/commands/shell.ts +3 -3
- package/lib/commands/streamscreen.ts +6 -4
- package/lib/commands/system-bars.ts +6 -6
- package/lib/commands/time.ts +3 -3
- package/lib/commands/types.ts +15 -1
- package/lib/constraints.ts +3 -0
- package/lib/doctor/checks.ts +1 -1
- package/lib/driver.ts +44 -44
- package/lib/index.ts +7 -7
- package/lib/method-map.ts +1 -1
- package/lib/utils.ts +10 -8
- package/package.json +12 -3
|
@@ -1,23 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
exports.assignBiDiLogListener = assignBiDiLogListener;
|
|
11
|
-
exports.getLog = getLog;
|
|
12
|
-
const driver_1 = require("appium/driver");
|
|
13
|
-
const node_os_1 = __importDefault(require("node:os"));
|
|
14
|
-
const ws_1 = __importDefault(require("ws"));
|
|
15
|
-
const utils_1 = require("../utils");
|
|
16
|
-
const helpers_1 = require("./context/helpers");
|
|
17
|
-
const constants_1 = require("./bidi/constants");
|
|
18
|
-
const models_1 = require("./bidi/models");
|
|
19
|
-
const support_1 = require("@appium/support");
|
|
20
|
-
exports.supportedLogTypes = {
|
|
1
|
+
import { DEFAULT_WS_PATHNAME_PREFIX, BaseDriver } from 'appium/driver.js';
|
|
2
|
+
import os from 'node:os';
|
|
3
|
+
import { WebSocket, WebSocketServer } from 'ws';
|
|
4
|
+
import { GET_SERVER_LOGS_FEATURE, toLogRecord, nativeLogEntryToSeleniumEntry, } from '../utils.js';
|
|
5
|
+
import { NATIVE_WIN } from './context/helpers.js';
|
|
6
|
+
import { BIDI_EVENT_NAME } from './bidi/constants.js';
|
|
7
|
+
import { makeLogEntryAddedEvent } from './bidi/models.js';
|
|
8
|
+
import { util } from '@appium/support';
|
|
9
|
+
export const supportedLogTypes = {
|
|
21
10
|
logcat: {
|
|
22
11
|
description: 'Logs for Android applications on real device and emulators via ADB',
|
|
23
12
|
getter: (self) => self.adb.getLogcatLogs(),
|
|
@@ -27,14 +16,14 @@ exports.supportedLogTypes = {
|
|
|
27
16
|
getter: async (self) => {
|
|
28
17
|
const output = await self.adb.bugreport();
|
|
29
18
|
const timestamp = Date.now();
|
|
30
|
-
return output.split(
|
|
19
|
+
return output.split(os.EOL).map((x) => toLogRecord(timestamp, x));
|
|
31
20
|
},
|
|
32
21
|
},
|
|
33
22
|
server: {
|
|
34
23
|
description: 'Appium server logs',
|
|
35
24
|
getter: (self) => {
|
|
36
|
-
self.assertFeatureEnabled(
|
|
37
|
-
return self.log.unwrap().record.map(
|
|
25
|
+
self.assertFeatureEnabled(GET_SERVER_LOGS_FEATURE);
|
|
26
|
+
return self.log.unwrap().record.map(nativeLogEntryToSeleniumEntry);
|
|
38
27
|
},
|
|
39
28
|
},
|
|
40
29
|
};
|
|
@@ -48,22 +37,25 @@ exports.supportedLogTypes = {
|
|
|
48
37
|
*
|
|
49
38
|
* @returns Promise that resolves when the logcat broadcasting websocket is started.
|
|
50
39
|
*/
|
|
51
|
-
async function mobileStartLogsBroadcast() {
|
|
40
|
+
export async function mobileStartLogsBroadcast() {
|
|
52
41
|
const server = this.server;
|
|
53
42
|
const pathname = WEBSOCKET_ENDPOINT(this.sessionId);
|
|
54
|
-
if (!
|
|
43
|
+
if (!util.isEmpty(await server.getWebSocketHandlers(pathname))) {
|
|
55
44
|
this.log.debug(`The logcat broadcasting web socket server is already listening at ${pathname}`);
|
|
56
45
|
return;
|
|
57
46
|
}
|
|
58
47
|
this.log.info(`Starting logcat broadcasting on web socket server ` +
|
|
59
48
|
`${JSON.stringify(server.address())} to ${pathname}`);
|
|
60
49
|
// https://github.com/websockets/ws/blob/master/doc/ws.md
|
|
61
|
-
const wss = new
|
|
50
|
+
const wss = new WebSocketServer({
|
|
62
51
|
noServer: true,
|
|
63
52
|
});
|
|
53
|
+
// Tracks every currently connected listener socket so log lines get
|
|
54
|
+
// broadcast to all of them, not just the one that connected first.
|
|
55
|
+
const connectedSockets = new Set();
|
|
64
56
|
wss.on('connection', (ws, req) => {
|
|
65
57
|
if (req) {
|
|
66
|
-
const remoteIp =
|
|
58
|
+
const remoteIp = util.isEmpty(req.headers['x-forwarded-for'])
|
|
67
59
|
? req.socket.remoteAddress
|
|
68
60
|
: req.headers['x-forwarded-for'];
|
|
69
61
|
this.log.debug(`Established a new logcat listener web socket connection from ${remoteIp}`);
|
|
@@ -71,16 +63,20 @@ async function mobileStartLogsBroadcast() {
|
|
|
71
63
|
else {
|
|
72
64
|
this.log.debug('Established a new logcat listener web socket connection');
|
|
73
65
|
}
|
|
66
|
+
connectedSockets.add(ws);
|
|
74
67
|
if (!this._logcatWebsocketListener) {
|
|
75
68
|
this._logcatWebsocketListener = (logRecord) => {
|
|
76
|
-
|
|
77
|
-
|
|
69
|
+
for (const socket of connectedSockets) {
|
|
70
|
+
if (socket.readyState === WebSocket.OPEN) {
|
|
71
|
+
socket.send(logRecord.message);
|
|
72
|
+
}
|
|
78
73
|
}
|
|
79
74
|
};
|
|
80
75
|
}
|
|
81
76
|
this.adb.setLogcatListener(this._logcatWebsocketListener);
|
|
82
77
|
ws.on('close', (code, reason) => {
|
|
83
|
-
|
|
78
|
+
connectedSockets.delete(ws);
|
|
79
|
+
if (connectedSockets.size === 0 && this._logcatWebsocketListener) {
|
|
84
80
|
try {
|
|
85
81
|
this.adb.removeLogcatListener(this._logcatWebsocketListener);
|
|
86
82
|
}
|
|
@@ -88,10 +84,10 @@ async function mobileStartLogsBroadcast() {
|
|
|
88
84
|
this._logcatWebsocketListener = undefined;
|
|
89
85
|
}
|
|
90
86
|
let closeMsg = 'Logcat listener web socket is closed.';
|
|
91
|
-
if (!
|
|
87
|
+
if (!util.isEmpty(code)) {
|
|
92
88
|
closeMsg += ` Code: ${code}.`;
|
|
93
89
|
}
|
|
94
|
-
if (!
|
|
90
|
+
if (!util.isEmpty(reason)) {
|
|
95
91
|
closeMsg += ` Reason: ${reason.toString()}.`;
|
|
96
92
|
}
|
|
97
93
|
this.log.debug(closeMsg);
|
|
@@ -105,10 +101,10 @@ async function mobileStartLogsBroadcast() {
|
|
|
105
101
|
*
|
|
106
102
|
* @returns Promise that resolves when the logcat broadcasting websocket is stopped.
|
|
107
103
|
*/
|
|
108
|
-
async function mobileStopLogsBroadcast() {
|
|
104
|
+
export async function mobileStopLogsBroadcast() {
|
|
109
105
|
const pathname = WEBSOCKET_ENDPOINT(this.sessionId);
|
|
110
106
|
const server = this.server;
|
|
111
|
-
if (
|
|
107
|
+
if (util.isEmpty(await server.getWebSocketHandlers(pathname))) {
|
|
112
108
|
return;
|
|
113
109
|
}
|
|
114
110
|
this.log.debug(`Stopping logcat broadcasting on web socket server ` +
|
|
@@ -120,9 +116,9 @@ async function mobileStopLogsBroadcast() {
|
|
|
120
116
|
*
|
|
121
117
|
* @returns Promise that resolves to an array of log type names.
|
|
122
118
|
*/
|
|
123
|
-
async function getLogTypes() {
|
|
119
|
+
export async function getLogTypes() {
|
|
124
120
|
// XXX why doesn't `super` work here?
|
|
125
|
-
const nativeLogTypes = await
|
|
121
|
+
const nativeLogTypes = await BaseDriver.prototype.getLogTypes.call(this);
|
|
126
122
|
if (this.isWebContext()) {
|
|
127
123
|
const webLogTypes = (await this.chromedriver.jwproxy.command('/log/types', 'GET'));
|
|
128
124
|
return [...nativeLogTypes, ...webLogTypes];
|
|
@@ -139,11 +135,11 @@ async function getLogTypes() {
|
|
|
139
135
|
* @param properties The BiDi listener properties.
|
|
140
136
|
* @returns A tuple containing the event emitter and the listener function.
|
|
141
137
|
*/
|
|
142
|
-
function assignBiDiLogListener(logEmitter, properties) {
|
|
143
|
-
const { type, context =
|
|
138
|
+
export function assignBiDiLogListener(logEmitter, properties) {
|
|
139
|
+
const { type, context = NATIVE_WIN, srcEventName = 'output', entryTransformer } = properties;
|
|
144
140
|
const listener = (logEntry) => {
|
|
145
141
|
const finalEntry = entryTransformer ? entryTransformer(logEntry) : logEntry;
|
|
146
|
-
this.eventEmitter.emit(
|
|
142
|
+
this.eventEmitter.emit(BIDI_EVENT_NAME, makeLogEntryAddedEvent(finalEntry, context, type));
|
|
147
143
|
};
|
|
148
144
|
logEmitter.on(srcEventName, listener);
|
|
149
145
|
return [logEmitter, listener];
|
|
@@ -154,13 +150,13 @@ function assignBiDiLogListener(logEmitter, properties) {
|
|
|
154
150
|
* @param logType The type of logs to retrieve.
|
|
155
151
|
* @returns Promise that resolves to the logs for the specified type.
|
|
156
152
|
*/
|
|
157
|
-
async function getLog(logType) {
|
|
153
|
+
export async function getLog(logType) {
|
|
158
154
|
if (this.isWebContext() && !Object.keys(this.supportedLogTypes).includes(logType)) {
|
|
159
155
|
return await this.chromedriver.jwproxy.command('/log', 'POST', {
|
|
160
156
|
type: logType,
|
|
161
157
|
});
|
|
162
158
|
}
|
|
163
|
-
return await
|
|
159
|
+
return await BaseDriver.prototype.getLog.call(this, logType);
|
|
164
160
|
}
|
|
165
161
|
// #region Internal helpers
|
|
166
162
|
/**
|
|
@@ -169,5 +165,5 @@ async function getLog(logType) {
|
|
|
169
165
|
* @param sessionId The session ID.
|
|
170
166
|
* @returns The websocket endpoint path.
|
|
171
167
|
*/
|
|
172
|
-
const WEBSOCKET_ENDPOINT = (sessionId) => `${
|
|
168
|
+
const WEBSOCKET_ENDPOINT = (sessionId) => `${DEFAULT_WS_PATHNAME_PREFIX}/session/${sessionId}/appium/device/logcat`;
|
|
173
169
|
//# sourceMappingURL=log.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log.js","sourceRoot":"","sources":["../../../lib/commands/log.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"log.js","sourceRoot":"","sources":["../../../lib/commands/log.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,0BAA0B,EAAE,UAAU,EAAC,MAAM,kBAAkB,CAAC;AACxE,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAC,SAAS,EAAE,eAAe,EAAC,MAAM,IAAI,CAAC;AAK9C,OAAO,EACL,uBAAuB,EACvB,WAAW,EACX,6BAA6B,GAE9B,MAAM,aAAa,CAAC;AACrB,OAAO,EAAC,UAAU,EAAC,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAC,eAAe,EAAC,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAC,sBAAsB,EAAC,MAAM,kBAAkB,CAAC;AAExD,OAAO,EAAC,IAAI,EAAC,MAAM,iBAAiB,CAAC;AAErC,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,MAAM,EAAE;QACN,WAAW,EAAE,oEAAoE;QACjF,MAAM,EAAE,CAAC,IAAmB,EAAE,EAAE,CAAE,IAAI,CAAC,GAAW,CAAC,aAAa,EAAE;KACnE;IACD,SAAS,EAAE;QACT,WAAW,EAAE,uDAAuD;QACpE,MAAM,EAAE,KAAK,EAAE,IAAmB,EAAE,EAAE;YACpC,MAAM,MAAM,GAAG,MAAO,IAAI,CAAC,GAAW,CAAC,SAAS,EAAE,CAAC;YACnD,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;YAC7B,OAAO,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,WAAW,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,CAAC;QACpE,CAAC;KACF;IACD,MAAM,EAAE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E,CACvD,GAAG,0BAA0B,YAAY,SAAS,uBAAuB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { HTTPMethod, StringRecord } from '@appium/types';
|
|
2
|
-
import type { AndroidDriver } from '../driver';
|
|
3
|
-
import type { FormFields } from './types';
|
|
2
|
+
import type { AndroidDriver } from '../driver.js';
|
|
3
|
+
import type { FormFields } from './types.js';
|
|
4
4
|
/**
|
|
5
5
|
* Starts media projection-based screen recording on the Android device.
|
|
6
6
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"media-projection.d.ts","sourceRoot":"","sources":["../../../lib/commands/media-projection.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,UAAU,EAAE,YAAY,EAAC,MAAM,eAAe,CAAC;AAC5D,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"media-projection.d.ts","sourceRoot":"","sources":["../../../lib/commands/media-projection.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,UAAU,EAAE,YAAY,EAAC,MAAM,eAAe,CAAC;AAC5D,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,cAAc,CAAC;AAEhD,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,YAAY,CAAC;AAiB3C;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,mCAAmC,CACvD,IAAI,EAAE,aAAa,EACnB,UAAU,CAAC,EAAE,MAAM,EACnB,QAAQ,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,KAAK,EACpC,cAAc,CAAC,EAAE,MAAM,EACvB,QAAQ,CAAC,EAAE,MAAM,GAChB,OAAO,CAAC,OAAO,CAAC,CAmBlB;AAED;;;;GAIG;AACH,wBAAsB,uCAAuC,CAC3D,IAAI,EAAE,aAAa,GAClB,OAAO,CAAC,OAAO,CAAC,CAKlB;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAsB,kCAAkC,CACtD,IAAI,EAAE,aAAa,EACnB,UAAU,CAAC,EAAE,MAAM,EACnB,IAAI,CAAC,EAAE,MAAM,EACb,IAAI,CAAC,EAAE,MAAM,EACb,MAAM,CAAC,EAAE,UAAU,EACnB,OAAO,CAAC,EAAE,YAAY,EACtB,aAAa,CAAC,EAAE,MAAM,EACtB,UAAU,CAAC,EAAE,UAAU,EACvB,aAAa,CAAC,EAAE,MAAM,GACrB,OAAO,CAAC,MAAM,CAAC,CAiCjB"}
|
|
@@ -1,14 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.mobileStartMediaProjectionRecording = mobileStartMediaProjectionRecording;
|
|
7
|
-
exports.mobileIsMediaProjectionRecordingRunning = mobileIsMediaProjectionRecordingRunning;
|
|
8
|
-
exports.mobileStopMediaProjectionRecording = mobileStopMediaProjectionRecording;
|
|
9
|
-
const support_1 = require("@appium/support");
|
|
10
|
-
const dayjs_1 = __importDefault(require("dayjs"));
|
|
11
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
1
|
+
import { fs, net, util } from '@appium/support';
|
|
2
|
+
import dayjs from 'dayjs';
|
|
3
|
+
import path from 'node:path';
|
|
12
4
|
// https://github.com/appium/io.appium.settings#internal-audio--video-recording
|
|
13
5
|
const DEFAULT_EXT = '.mp4';
|
|
14
6
|
const MIN_API_LEVEL = 29;
|
|
@@ -31,10 +23,10 @@ const DEFAULT_FILENAME_FORMAT = 'YYYY-MM-DDTHH-mm-ss';
|
|
|
31
23
|
* the current timestamp will be used as file name.
|
|
32
24
|
* @returns Promise that resolves to `true` if recording was started, `false` if another recording is already in progress.
|
|
33
25
|
*/
|
|
34
|
-
async function mobileStartMediaProjectionRecording(resolution, priority, maxDurationSec, filename) {
|
|
26
|
+
export async function mobileStartMediaProjectionRecording(resolution, priority, maxDurationSec, filename) {
|
|
35
27
|
await verifyMediaProjectionRecordingIsSupported(this.adb);
|
|
36
28
|
const recorder = this.settingsApp.makeMediaProjectionRecorder();
|
|
37
|
-
const fname = adjustMediaExtension(filename || (
|
|
29
|
+
const fname = adjustMediaExtension(filename || dayjs().format(DEFAULT_FILENAME_FORMAT));
|
|
38
30
|
const didStart = await recorder.start({
|
|
39
31
|
resolution,
|
|
40
32
|
priority,
|
|
@@ -54,7 +46,7 @@ async function mobileStartMediaProjectionRecording(resolution, priority, maxDura
|
|
|
54
46
|
*
|
|
55
47
|
* @returns Promise that resolves to `true` if recording is running, `false` otherwise.
|
|
56
48
|
*/
|
|
57
|
-
async function mobileIsMediaProjectionRecordingRunning() {
|
|
49
|
+
export async function mobileIsMediaProjectionRecordingRunning() {
|
|
58
50
|
await verifyMediaProjectionRecordingIsSupported(this.adb);
|
|
59
51
|
const recorder = this.settingsApp.makeMediaProjectionRecorder();
|
|
60
52
|
return await recorder.isRunning();
|
|
@@ -81,7 +73,7 @@ async function mobileIsMediaProjectionRecordingRunning() {
|
|
|
81
73
|
* if `remotePath` is not provided, or an empty string if the video was uploaded to a remote location.
|
|
82
74
|
* @throws {Error} If no recent recording was found.
|
|
83
75
|
*/
|
|
84
|
-
async function mobileStopMediaProjectionRecording(remotePath, user, pass, method, headers, fileFieldName, formFields, uploadTimeout) {
|
|
76
|
+
export async function mobileStopMediaProjectionRecording(remotePath, user, pass, method, headers, fileFieldName, formFields, uploadTimeout) {
|
|
85
77
|
await verifyMediaProjectionRecordingIsSupported(this.adb);
|
|
86
78
|
const recorder = this.settingsApp.makeMediaProjectionRecorder();
|
|
87
79
|
if (await recorder.stop()) {
|
|
@@ -94,9 +86,9 @@ async function mobileStopMediaProjectionRecording(remotePath, user, pass, method
|
|
|
94
86
|
if (!recentRecordingPath) {
|
|
95
87
|
throw new Error(`No recent media projection recording have been found. Did you start any?`);
|
|
96
88
|
}
|
|
97
|
-
if (
|
|
98
|
-
const { size } = await
|
|
99
|
-
this.log.debug(`The size of the resulting media projection recording is ${
|
|
89
|
+
if (util.isEmpty(remotePath)) {
|
|
90
|
+
const { size } = await fs.stat(recentRecordingPath);
|
|
91
|
+
this.log.debug(`The size of the resulting media projection recording is ${util.toReadableSizeString(size)}`);
|
|
100
92
|
}
|
|
101
93
|
try {
|
|
102
94
|
return await uploadRecordedMedia(recentRecordingPath, remotePath, {
|
|
@@ -110,12 +102,12 @@ async function mobileStopMediaProjectionRecording(remotePath, user, pass, method
|
|
|
110
102
|
});
|
|
111
103
|
}
|
|
112
104
|
finally {
|
|
113
|
-
await
|
|
105
|
+
await fs.rimraf(path.dirname(recentRecordingPath));
|
|
114
106
|
}
|
|
115
107
|
}
|
|
116
108
|
async function uploadRecordedMedia(localFile, remotePath, uploadOptions = {}) {
|
|
117
|
-
if (
|
|
118
|
-
return (await
|
|
109
|
+
if (util.isEmpty(remotePath)) {
|
|
110
|
+
return (await util.toInMemoryBase64(localFile)).toString();
|
|
119
111
|
}
|
|
120
112
|
const { user, pass, method, headers, fileFieldName, formFields, uploadTimeout: timeout, } = uploadOptions;
|
|
121
113
|
const options = {
|
|
@@ -128,7 +120,7 @@ async function uploadRecordedMedia(localFile, remotePath, uploadOptions = {}) {
|
|
|
128
120
|
if (user && pass) {
|
|
129
121
|
options.auth = { user, pass };
|
|
130
122
|
}
|
|
131
|
-
await
|
|
123
|
+
await net.uploadFile(localFile, remotePath, options);
|
|
132
124
|
return '';
|
|
133
125
|
}
|
|
134
126
|
function adjustMediaExtension(name) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"media-projection.js","sourceRoot":"","sources":["../../../lib/commands/media-projection.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"media-projection.js","sourceRoot":"","sources":["../../../lib/commands/media-projection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,EAAE,EAAE,GAAG,EAAE,IAAI,EAAC,MAAM,iBAAiB,CAAC;AAE9C,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,WAAW,CAAC;AAM7B,+E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AAU,CAAC,EAAE,CAAC;QAC7B,OAAO,CAAC,MAAM,IAAI,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;IAC7D,CAAC;IAED,MAAM,EACJ,IAAI,EACJ,IAAI,EACJ,MAAM,EACN,OAAO,EACP,aAAa,EACb,UAAU,EACV,aAAa,EAAE,OAAO,GACvB,GAAG,aAAa,CAAC;IAClB,MAAM,OAAO,GAAmC;QAC9C,MAAM,EAAE,MAAM,IAAI,KAAK;QACvB,OAAO;QACP,aAAa;QACb,UAAU;QACV,OAAO;KACR,CAAC;IACF,IAAI,IAAI,IAAI,IAAI,EAAE,CAAC;QACjB,OAAO,CAAC,IAAI,GAAG,EAAC,IAAI,EAAE,IAAI,EAAC,CAAC;IAC9B,CAAC;IACD,MAAM,GAAG,CAAC,UAAU,CAAC,SAAS,EAAE,UAAoB,EAAE,OAAO,CAAC,CAAC;IAC/D,OAAO,EAAE,CAAC;AACZ,CAAC;AAED,SAAS,oBAAoB,CAAC,IAAY;IACxC,OAAO,IAAI,EAAE,WAAW,EAAE,EAAE,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,WAAW,EAAE,CAAC;AACrF,CAAC;AAED,KAAK,UAAU,yCAAyC,CAAC,GAAQ;IAC/D,MAAM,QAAQ,GAAG,MAAM,GAAG,CAAC,WAAW,EAAE,CAAC;IACzC,IAAI,QAAQ,GAAG,aAAa,EAAE,CAAC;QAC7B,MAAM,IAAI,KAAK,CACb,kEAAkE,QAAQ,IAAI;YAC5E,iCAAiC,aAAa,GAAG,CACpD,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { AndroidDriver } from '../driver';
|
|
2
|
-
import type { TrimMemoryLevel } from './types';
|
|
1
|
+
import type { AndroidDriver } from '../driver.js';
|
|
2
|
+
import type { TrimMemoryLevel } from './types.js';
|
|
3
3
|
/**
|
|
4
4
|
* Simulates the onTrimMemory() event for the given package.
|
|
5
5
|
* Read https://developer.android.com/topic/performance/memory
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../../../lib/commands/memory.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../../../lib/commands/memory.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,cAAc,CAAC;AAChD,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,YAAY,CAAC;AAEhD;;;;;;;;;GASG;AACH,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,aAAa,EACnB,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,eAAe,GACrB,OAAO,CAAC,IAAI,CAAC,CASf"}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.mobileSendTrimMemory = mobileSendTrimMemory;
|
|
4
|
-
const driver_1 = require("appium/driver");
|
|
1
|
+
import { errors } from 'appium/driver.js';
|
|
5
2
|
/**
|
|
6
3
|
* Simulates the onTrimMemory() event for the given package.
|
|
7
4
|
* Read https://developer.android.com/topic/performance/memory
|
|
@@ -12,12 +9,12 @@ const driver_1 = require("appium/driver");
|
|
|
12
9
|
* @returns Promise that resolves when the trim memory event is sent.
|
|
13
10
|
* @throws {errors.InvalidArgumentError} If pkg or level arguments are not provided.
|
|
14
11
|
*/
|
|
15
|
-
async function mobileSendTrimMemory(pkg, level) {
|
|
12
|
+
export async function mobileSendTrimMemory(pkg, level) {
|
|
16
13
|
if (!pkg) {
|
|
17
|
-
throw new
|
|
14
|
+
throw new errors.InvalidArgumentError(`The 'pkg' argument must be provided`);
|
|
18
15
|
}
|
|
19
16
|
if (!level) {
|
|
20
|
-
throw new
|
|
17
|
+
throw new errors.InvalidArgumentError(`The 'level' argument must be provided`);
|
|
21
18
|
}
|
|
22
19
|
await this.adb.shell(['am', 'send-trim-memory', pkg, level]);
|
|
23
20
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory.js","sourceRoot":"","sources":["../../../lib/commands/memory.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"memory.js","sourceRoot":"","sources":["../../../lib/commands/memory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAC,MAAM,kBAAkB,CAAC;AAIxC;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAExC,GAAW,EACX,KAAsB;IAEtB,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,MAAM,IAAI,MAAM,CAAC,oBAAoB,CAAC,qCAAqC,CAAC,CAAC;IAC/E,CAAC;IACD,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,MAAM,CAAC,oBAAoB,CAAC,uCAAuC,CAAC,CAAC;IACjF,CAAC;IAED,MAAM,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,kBAAkB,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;AAC/D,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Size, Rect, StringRecord } from '@appium/types';
|
|
2
|
-
import type { AndroidDriver } from '../driver';
|
|
3
|
-
import type { SmsListResult, ListSmsOpts } from './types';
|
|
2
|
+
import type { AndroidDriver } from '../driver.js';
|
|
3
|
+
import type { SmsListResult, ListSmsOpts } from './types.js';
|
|
4
4
|
/**
|
|
5
5
|
* Gets the window size.
|
|
6
6
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"misc.d.ts","sourceRoot":"","sources":["../../../lib/commands/misc.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,IAAI,EAAE,IAAI,EAAE,YAAY,EAAC,MAAM,eAAe,CAAC;AAC5D,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"misc.d.ts","sourceRoot":"","sources":["../../../lib/commands/misc.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,IAAI,EAAE,IAAI,EAAE,YAAY,EAAC,MAAM,eAAe,CAAC;AAC5D,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,cAAc,CAAC;AAChD,OAAO,KAAK,EAAC,aAAa,EAAE,WAAW,EAAC,MAAM,YAAY,CAAC;AAE3D;;;;;GAKG;AACH,wBAAsB,aAAa,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAEtE;AAED;;;;GAIG;AACH,wBAAsB,aAAa,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAQtE;AAED;;;;;;;;GAQG;AACH,wBAAsB,MAAM,CAAC,IAAI,EAAE,aAAa,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAE5E;AAED;;;;;GAKG;AACH,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,CAsB5E;AAED;;;;GAIG;AACH,wBAAsB,sBAAsB,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC,CAEvF;AAED;;;;;GAKG;AACH,wBAAsB,aAAa,CACjC,IAAI,EAAE,aAAa,EACnB,IAAI,CAAC,EAAE,WAAW,GACjB,OAAO,CAAC,aAAa,CAAC,CAExB;AAED;;;;;GAKG;AACH,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAE1E"}
|
|
@@ -1,28 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getWindowSize = getWindowSize;
|
|
4
|
-
exports.getWindowRect = getWindowRect;
|
|
5
|
-
exports.setUrl = setUrl;
|
|
6
|
-
exports.getDisplayDensity = getDisplayDensity;
|
|
7
|
-
exports.mobileGetNotifications = mobileGetNotifications;
|
|
8
|
-
exports.mobileListSms = mobileListSms;
|
|
9
|
-
exports.openNotifications = openNotifications;
|
|
10
|
-
const driver_1 = require("appium/driver");
|
|
1
|
+
import { errors } from 'appium/driver.js';
|
|
11
2
|
/**
|
|
12
3
|
* Gets the window size.
|
|
13
4
|
*
|
|
14
5
|
* @returns Promise that resolves to the window size (width, height).
|
|
15
6
|
* @throws {errors.NotImplementedError} This method is not implemented.
|
|
16
7
|
*/
|
|
17
|
-
async function getWindowSize() {
|
|
18
|
-
throw new
|
|
8
|
+
export async function getWindowSize() {
|
|
9
|
+
throw new errors.NotImplementedError('Not implemented');
|
|
19
10
|
}
|
|
20
11
|
/**
|
|
21
12
|
* Gets the window rectangle (position and size).
|
|
22
13
|
*
|
|
23
14
|
* @returns Promise that resolves to the window rectangle.
|
|
24
15
|
*/
|
|
25
|
-
async function getWindowRect() {
|
|
16
|
+
export async function getWindowRect() {
|
|
26
17
|
const { width, height } = await this.getWindowSize();
|
|
27
18
|
return {
|
|
28
19
|
width,
|
|
@@ -40,7 +31,7 @@ async function getWindowRect() {
|
|
|
40
31
|
* @param uri The Android URI to navigate to.
|
|
41
32
|
* @returns Promise that resolves when the URI is opened.
|
|
42
33
|
*/
|
|
43
|
-
async function setUrl(uri) {
|
|
34
|
+
export async function setUrl(uri) {
|
|
44
35
|
await this.adb.startUri(uri, this.opts.appPackage);
|
|
45
36
|
}
|
|
46
37
|
/**
|
|
@@ -49,7 +40,7 @@ async function setUrl(uri) {
|
|
|
49
40
|
* @returns Promise that resolves to the display density value.
|
|
50
41
|
* @throws {Error} If the display density cannot be retrieved.
|
|
51
42
|
*/
|
|
52
|
-
async function getDisplayDensity() {
|
|
43
|
+
export async function getDisplayDensity() {
|
|
53
44
|
// first try the property for devices
|
|
54
45
|
let out = await this.adb.shell(['getprop', 'ro.sf.lcd_density']);
|
|
55
46
|
if (out) {
|
|
@@ -77,7 +68,7 @@ async function getDisplayDensity() {
|
|
|
77
68
|
*
|
|
78
69
|
* @returns Promise that resolves to an object containing notification information.
|
|
79
70
|
*/
|
|
80
|
-
async function mobileGetNotifications() {
|
|
71
|
+
export async function mobileGetNotifications() {
|
|
81
72
|
return await this.settingsApp.getNotifications();
|
|
82
73
|
}
|
|
83
74
|
/**
|
|
@@ -86,7 +77,7 @@ async function mobileGetNotifications() {
|
|
|
86
77
|
* @param opts Optional parameters for listing SMS messages.
|
|
87
78
|
* @returns Promise that resolves to the SMS list result.
|
|
88
79
|
*/
|
|
89
|
-
async function mobileListSms(opts) {
|
|
80
|
+
export async function mobileListSms(opts) {
|
|
90
81
|
return await this.settingsApp.getSmsList(opts);
|
|
91
82
|
}
|
|
92
83
|
/**
|
|
@@ -95,7 +86,7 @@ async function mobileListSms(opts) {
|
|
|
95
86
|
* @returns Promise that resolves when the notifications panel is opened.
|
|
96
87
|
* @throws {errors.NotImplementedError} This method is not implemented.
|
|
97
88
|
*/
|
|
98
|
-
async function openNotifications() {
|
|
99
|
-
throw new
|
|
89
|
+
export async function openNotifications() {
|
|
90
|
+
throw new errors.NotImplementedError('Not implemented');
|
|
100
91
|
}
|
|
101
92
|
//# sourceMappingURL=misc.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"misc.js","sourceRoot":"","sources":["../../../lib/commands/misc.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"misc.js","sourceRoot":"","sources":["../../../lib/commands/misc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAC,MAAM,kBAAkB,CAAC;AAKxC;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa;IACjC,MAAM,IAAI,MAAM,CAAC,mBAAmB,CAAC,iBAAiB,CAAC,CAAC;AAC1D,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa;IACjC,MAAM,EA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IACtC,MAAM,IAAI,CAAC,GAAG,CAAC,kBAAkB,CAAC,yCAAyC,CAAC,CAAC;AAC/E,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB;IAC1C,OAAO,MAAM,IAAI,CAAC,WAAW,CAAC,gBAAgB,EAAE,CAAC;AACnD,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAEjC,IAAkB;IAElB,OAAO,MAAM,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;AACjD,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB;IACrC,MAAM,IAAI,MAAM,CAAC,mBAAmB,CAAC,iBAAiB,CAAC,CAAC;AAC1D,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { AndroidDriver } from '../driver';
|
|
2
|
-
import type { ServiceType, GetConnectivityResult } from './types';
|
|
1
|
+
import type { AndroidDriver } from '../driver.js';
|
|
2
|
+
import type { ServiceType, GetConnectivityResult } from './types.js';
|
|
3
3
|
/**
|
|
4
4
|
* Gets the current network connection state.
|
|
5
5
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"network.d.ts","sourceRoot":"","sources":["../../../lib/commands/network.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"network.d.ts","sourceRoot":"","sources":["../../../lib/commands/network.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,cAAc,CAAC;AAChD,OAAO,KAAK,EAAC,WAAW,EAAE,qBAAqB,EAAC,MAAM,YAAY,CAAC;AAcnE;;;;;;;;GAQG;AACH,wBAAsB,oBAAoB,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,CAc/E;AAED;;;;GAIG;AACH,wBAAsB,QAAQ,CAAC,IAAI,EA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exports.mobileGetConnectivity = mobileGetConnectivity;
|
|
7
|
-
exports.setNetworkConnection = setNetworkConnection;
|
|
8
|
-
exports.setWifiState = setWifiState;
|
|
9
|
-
exports.setDataState = setDataState;
|
|
10
|
-
exports.toggleData = toggleData;
|
|
11
|
-
exports.toggleWiFi = toggleWiFi;
|
|
12
|
-
exports.toggleFlightMode = toggleFlightMode;
|
|
13
|
-
const driver_1 = require("appium/driver");
|
|
14
|
-
const support_1 = require("@appium/support");
|
|
1
|
+
import { errors } from 'appium/driver.js';
|
|
2
|
+
import { util } from '@appium/support';
|
|
15
3
|
const AIRPLANE_MODE_MASK = 0b001;
|
|
16
4
|
const WIFI_MASK = 0b010;
|
|
17
5
|
const DATA_MASK = 0b100;
|
|
@@ -32,7 +20,7 @@ const SUPPORTED_SERVICE_NAMES = [
|
|
|
32
20
|
* - Bit 1 (0b010) = Wi-Fi
|
|
33
21
|
* - Bit 2 (0b100) = Data connection
|
|
34
22
|
*/
|
|
35
|
-
async function getNetworkConnection() {
|
|
23
|
+
export async function getNetworkConnection() {
|
|
36
24
|
this.log.info('Getting network connection');
|
|
37
25
|
const airplaneModeOn = await this.adb.isAirplaneModeOn();
|
|
38
26
|
let connection = airplaneModeOn ? AIRPLANE_MODE_MASK : 0;
|
|
@@ -50,7 +38,7 @@ async function getNetworkConnection() {
|
|
|
50
38
|
*
|
|
51
39
|
* @returns Promise that resolves to `true` if Wi-Fi is enabled, `false` otherwise.
|
|
52
40
|
*/
|
|
53
|
-
async function isWifiOn() {
|
|
41
|
+
export async function isWifiOn() {
|
|
54
42
|
return await this.adb.isWifiOn();
|
|
55
43
|
}
|
|
56
44
|
/**
|
|
@@ -66,9 +54,9 @@ async function isWifiOn() {
|
|
|
66
54
|
* @returns Promise that resolves when the connectivity state is set.
|
|
67
55
|
* @throws {errors.InvalidArgumentError} If none of the options are provided.
|
|
68
56
|
*/
|
|
69
|
-
async function mobileSetConnectivity(wifi, data, airplaneMode) {
|
|
57
|
+
export async function mobileSetConnectivity(wifi, data, airplaneMode) {
|
|
70
58
|
if (wifi === undefined && data === undefined && airplaneMode === undefined) {
|
|
71
|
-
throw new
|
|
59
|
+
throw new errors.InvalidArgumentError(`Either one of ${JSON.stringify(SUPPORTED_SERVICE_NAMES)} options must be provided`);
|
|
72
60
|
}
|
|
73
61
|
const connectivityPairs = [
|
|
74
62
|
[wifi, WIFI_KEY_NAME],
|
|
@@ -108,11 +96,11 @@ async function mobileSetConnectivity(wifi, data, airplaneMode) {
|
|
|
108
96
|
* @returns Promise that resolves to an object containing the connectivity state for the requested services.
|
|
109
97
|
* @throws {errors.InvalidArgumentError} If any of the provided service names are not supported.
|
|
110
98
|
*/
|
|
111
|
-
async function mobileGetConnectivity(services = SUPPORTED_SERVICE_NAMES) {
|
|
99
|
+
export async function mobileGetConnectivity(services = SUPPORTED_SERVICE_NAMES) {
|
|
112
100
|
const svcs = Array.isArray(services) ? services : [services];
|
|
113
101
|
const unsupportedServices = svcs.filter((svc) => !SUPPORTED_SERVICE_NAMES.includes(svc));
|
|
114
102
|
if (unsupportedServices.length > 0) {
|
|
115
|
-
throw new
|
|
103
|
+
throw new errors.InvalidArgumentError(`${util.pluralize('Service name', unsupportedServices.length, false)} ${unsupportedServices} ` +
|
|
116
104
|
`${unsupportedServices.length === 1 ? 'is' : 'are'} not known. Only the following services are ` +
|
|
117
105
|
`suported: ${SUPPORTED_SERVICE_NAMES}`);
|
|
118
106
|
}
|
|
@@ -146,7 +134,7 @@ async function mobileGetConnectivity(services = SUPPORTED_SERVICE_NAMES) {
|
|
|
146
134
|
* - Bit 2 (0b100) = Data connection
|
|
147
135
|
* @returns Promise that resolves to the current network connection state after the change.
|
|
148
136
|
*/
|
|
149
|
-
async function setNetworkConnection(type) {
|
|
137
|
+
export async function setNetworkConnection(type) {
|
|
150
138
|
this.log.info('Setting network connection');
|
|
151
139
|
// decode the input
|
|
152
140
|
const shouldEnableAirplaneMode = (type & AIRPLANE_MODE_MASK) !== 0;
|
|
@@ -198,7 +186,7 @@ async function setNetworkConnection(type) {
|
|
|
198
186
|
* @param isOn `true` to enable Wi-Fi, `false` to disable it.
|
|
199
187
|
* @returns Promise that resolves when the Wi-Fi state is set.
|
|
200
188
|
*/
|
|
201
|
-
async function setWifiState(isOn) {
|
|
189
|
+
export async function setWifiState(isOn) {
|
|
202
190
|
await this.settingsApp.setWifiState(isOn, this.isEmulator());
|
|
203
191
|
}
|
|
204
192
|
/**
|
|
@@ -208,7 +196,7 @@ async function setWifiState(isOn) {
|
|
|
208
196
|
* @param isOn `true` to enable mobile data, `false` to disable it.
|
|
209
197
|
* @returns Promise that resolves when the data connection state is set.
|
|
210
198
|
*/
|
|
211
|
-
async function setDataState(isOn) {
|
|
199
|
+
export async function setDataState(isOn) {
|
|
212
200
|
await this.settingsApp.setDataState(isOn, this.isEmulator());
|
|
213
201
|
}
|
|
214
202
|
/**
|
|
@@ -217,7 +205,7 @@ async function setDataState(isOn) {
|
|
|
217
205
|
* @since Android 12 (only real devices, emulators work in all APIs)
|
|
218
206
|
* @returns Promise that resolves when the data connection state is toggled.
|
|
219
207
|
*/
|
|
220
|
-
async function toggleData() {
|
|
208
|
+
export async function toggleData() {
|
|
221
209
|
const isOn = await this.adb.isDataOn();
|
|
222
210
|
this.log.info(`Turning network data ${!isOn ? 'on' : 'off'}`);
|
|
223
211
|
await this.setDataState(!isOn);
|
|
@@ -228,7 +216,7 @@ async function toggleData() {
|
|
|
228
216
|
* @since Android 12 (only real devices, emulators work in all APIs)
|
|
229
217
|
* @returns Promise that resolves when the Wi-Fi state is toggled.
|
|
230
218
|
*/
|
|
231
|
-
async function toggleWiFi() {
|
|
219
|
+
export async function toggleWiFi() {
|
|
232
220
|
const isOn = await this.adb.isWifiOn();
|
|
233
221
|
this.log.info(`Turning WiFi ${!isOn ? 'on' : 'off'}`);
|
|
234
222
|
await this.setWifiState(!isOn);
|
|
@@ -239,7 +227,7 @@ async function toggleWiFi() {
|
|
|
239
227
|
* @since Android 12 (only real devices, emulators work in all APIs)
|
|
240
228
|
* @returns Promise that resolves when the airplane mode state is toggled.
|
|
241
229
|
*/
|
|
242
|
-
async function toggleFlightMode() {
|
|
230
|
+
export async function toggleFlightMode() {
|
|
243
231
|
const flightMode = !(await this.adb.isAirplaneModeOn());
|
|
244
232
|
this.log.info(`Turning flight mode ${flightMode ? 'on' : 'off'}`);
|
|
245
233
|
await this.adb.setAirplaneMode(flightMode);
|