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
|
@@ -2,9 +2,9 @@ import {asyncmap} from 'asyncbox';
|
|
|
2
2
|
import {fs, tempDir} from '@appium/support';
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
import type {Location} from '@appium/types';
|
|
5
|
+
import {getThirdPartyPackages} from './app-management.js';
|
|
6
|
+
import type {AndroidDriver} from '../driver.js';
|
|
5
7
|
import {SETTINGS_HELPER_ID} from 'io.appium.settings';
|
|
6
|
-
import {getThirdPartyPackages} from './app-management';
|
|
7
|
-
import type {AndroidDriver} from '../driver';
|
|
8
8
|
|
|
9
9
|
// The value close to zero, but not zero, is needed
|
|
10
10
|
// to trick JSON generation and send a float value instead of an integer,
|
package/lib/commands/gestures.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
import {errors} from 'appium/driver';
|
|
1
|
+
import {errors} from 'appium/driver.js';
|
|
3
2
|
import type {StringRecord} from '@appium/types';
|
|
4
|
-
import type {AndroidDriver} from '../driver';
|
|
3
|
+
import type {AndroidDriver} from '../driver.js';
|
|
5
4
|
|
|
6
5
|
/**
|
|
7
6
|
* Performs a series of actions (gestures) on the device.
|
|
@@ -11,5 +10,6 @@ import type {AndroidDriver} from '../driver';
|
|
|
11
10
|
* @throws {errors.NotImplementedError} This method is not implemented.
|
|
12
11
|
*/
|
|
13
12
|
export async function performActions(this: AndroidDriver, actions: StringRecord[]): Promise<void> {
|
|
13
|
+
void actions;
|
|
14
14
|
throw new errors.NotImplementedError('Not implemented');
|
|
15
15
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {errors} from 'appium/driver';
|
|
1
|
+
import {errors} from 'appium/driver.js';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import {fs, tempDir} from '@appium/support';
|
|
4
4
|
import crypto from 'node:crypto';
|
|
5
|
-
import type {AndroidDriver} from '../driver';
|
|
5
|
+
import type {AndroidDriver} from '../driver.js';
|
|
6
6
|
|
|
7
7
|
const EMULATOR_RESOURCES_ROOT = ['emulator', 'resources'];
|
|
8
8
|
const CONFIG_NAME = 'Toren1BD.posters';
|
package/lib/commands/ime.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {errors} from 'appium/driver';
|
|
2
|
-
import type {AndroidDriver} from '../driver';
|
|
3
|
-
import {SET_STYLUS_HANDWRITING_FEATURE} from '../utils';
|
|
1
|
+
import {errors} from 'appium/driver.js';
|
|
2
|
+
import type {AndroidDriver} from '../driver.js';
|
|
3
|
+
import {SET_STYLUS_HANDWRITING_FEATURE} from '../utils.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Checks if an IME (Input Method Editor) is activated.
|
package/lib/commands/intent.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {errors} from 'appium/driver';
|
|
1
|
+
import {errors} from 'appium/driver.js';
|
|
2
2
|
import {util} from '@appium/support';
|
|
3
|
-
import type {AndroidDriver} from '../driver';
|
|
4
|
-
import type {IntentOpts} from './types';
|
|
3
|
+
import type {AndroidDriver} from '../driver.js';
|
|
4
|
+
import type {IntentOpts} from './types.js';
|
|
5
5
|
|
|
6
6
|
const NO_VALUE_ARG_TYPE = 'sn';
|
|
7
7
|
const SUPPORTED_EXTRA_TYPES = [
|
package/lib/commands/keyboard.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {errors} from 'appium/driver';
|
|
1
|
+
import {errors} from 'appium/driver.js';
|
|
2
2
|
import {UNICODE_IME, EMPTY_IME} from 'io.appium.settings';
|
|
3
|
-
import type {AndroidDriver} from '../driver';
|
|
4
|
-
import type {SendKeysOpts} from './types';
|
|
3
|
+
import type {AndroidDriver} from '../driver.js';
|
|
4
|
+
import type {SendKeysOpts} from './types.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Hides the on-screen keyboard.
|
package/lib/commands/legacy.ts
CHANGED
|
@@ -14,9 +14,9 @@ import {
|
|
|
14
14
|
fingerprintUnlock,
|
|
15
15
|
toCredentialType,
|
|
16
16
|
verifyUnlock,
|
|
17
|
-
} from './helpers';
|
|
18
|
-
import type {AndroidDriver, AndroidDriverCaps} from '../../driver';
|
|
19
|
-
import type {UnlockType} from '../types';
|
|
17
|
+
} from './helpers.js';
|
|
18
|
+
import type {AndroidDriver, AndroidDriverCaps} from '../../driver.js';
|
|
19
|
+
import type {UnlockType} from '../types.js';
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* Locks the device and optionally unlocks it after a specified number of seconds.
|
|
@@ -2,8 +2,8 @@ import {util} from '@appium/support';
|
|
|
2
2
|
import {sleep, waitForCondition} from 'asyncbox';
|
|
3
3
|
import type {ADB} from 'appium-adb';
|
|
4
4
|
import type {Position, StringRecord} from '@appium/types';
|
|
5
|
-
import type {AndroidDriver, AndroidDriverCaps} from '../../driver';
|
|
6
|
-
import type {UnlockType, FastUnlockOptions} from '../types';
|
|
5
|
+
import type {AndroidDriver, AndroidDriverCaps} from '../../driver.js';
|
|
6
|
+
import type {UnlockType, FastUnlockOptions} from '../types.js';
|
|
7
7
|
|
|
8
8
|
export const PIN_UNLOCK = 'pin';
|
|
9
9
|
export const PIN_UNLOCK_KEY_EVENT = 'pinWithKeyEvent';
|
package/lib/commands/log.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {DEFAULT_WS_PATHNAME_PREFIX, BaseDriver} from 'appium/driver';
|
|
1
|
+
import {DEFAULT_WS_PATHNAME_PREFIX, BaseDriver} from 'appium/driver.js';
|
|
2
2
|
import os from 'node:os';
|
|
3
|
-
import WebSocket from 'ws';
|
|
3
|
+
import {WebSocket, WebSocketServer} from 'ws';
|
|
4
4
|
import type {AppiumServer, WSServer} from '@appium/types';
|
|
5
5
|
import type {EventEmitter} from 'node:events';
|
|
6
6
|
import type {ADB} from 'appium-adb';
|
|
@@ -10,11 +10,11 @@ import {
|
|
|
10
10
|
toLogRecord,
|
|
11
11
|
nativeLogEntryToSeleniumEntry,
|
|
12
12
|
type LogEntry,
|
|
13
|
-
} from '../utils';
|
|
14
|
-
import {NATIVE_WIN} from './context/helpers';
|
|
15
|
-
import {BIDI_EVENT_NAME} from './bidi/constants';
|
|
16
|
-
import {makeLogEntryAddedEvent} from './bidi/models';
|
|
17
|
-
import type {AndroidDriver} from '../driver';
|
|
13
|
+
} from '../utils.js';
|
|
14
|
+
import {NATIVE_WIN} from './context/helpers.js';
|
|
15
|
+
import {BIDI_EVENT_NAME} from './bidi/constants.js';
|
|
16
|
+
import {makeLogEntryAddedEvent} from './bidi/models.js';
|
|
17
|
+
import type {AndroidDriver} from '../driver.js';
|
|
18
18
|
import {util} from '@appium/support';
|
|
19
19
|
|
|
20
20
|
export const supportedLogTypes = {
|
|
@@ -62,9 +62,12 @@ export async function mobileStartLogsBroadcast(this: AndroidDriver): Promise<voi
|
|
|
62
62
|
`${JSON.stringify(server.address())} to ${pathname}`,
|
|
63
63
|
);
|
|
64
64
|
// https://github.com/websockets/ws/blob/master/doc/ws.md
|
|
65
|
-
const wss = new
|
|
65
|
+
const wss = new WebSocketServer({
|
|
66
66
|
noServer: true,
|
|
67
67
|
});
|
|
68
|
+
// Tracks every currently connected listener socket so log lines get
|
|
69
|
+
// broadcast to all of them, not just the one that connected first.
|
|
70
|
+
const connectedSockets = new Set<WebSocket>();
|
|
68
71
|
wss.on('connection', (ws, req) => {
|
|
69
72
|
if (req) {
|
|
70
73
|
const remoteIp = util.isEmpty(req.headers['x-forwarded-for'])
|
|
@@ -75,17 +78,21 @@ export async function mobileStartLogsBroadcast(this: AndroidDriver): Promise<voi
|
|
|
75
78
|
this.log.debug('Established a new logcat listener web socket connection');
|
|
76
79
|
}
|
|
77
80
|
|
|
81
|
+
connectedSockets.add(ws);
|
|
78
82
|
if (!this._logcatWebsocketListener) {
|
|
79
83
|
this._logcatWebsocketListener = (logRecord: LogEntry) => {
|
|
80
|
-
|
|
81
|
-
|
|
84
|
+
for (const socket of connectedSockets) {
|
|
85
|
+
if (socket.readyState === WebSocket.OPEN) {
|
|
86
|
+
socket.send(logRecord.message);
|
|
87
|
+
}
|
|
82
88
|
}
|
|
83
89
|
};
|
|
84
90
|
}
|
|
85
91
|
this.adb.setLogcatListener(this._logcatWebsocketListener);
|
|
86
92
|
|
|
87
93
|
ws.on('close', (code, reason) => {
|
|
88
|
-
|
|
94
|
+
connectedSockets.delete(ws);
|
|
95
|
+
if (connectedSockets.size === 0 && this._logcatWebsocketListener) {
|
|
89
96
|
try {
|
|
90
97
|
this.adb.removeLogcatListener(this._logcatWebsocketListener);
|
|
91
98
|
} catch {}
|
|
@@ -3,9 +3,9 @@ import type {NetOptions, HttpUploadOptions} from '@appium/support';
|
|
|
3
3
|
import dayjs from 'dayjs';
|
|
4
4
|
import path from 'node:path';
|
|
5
5
|
import type {HTTPMethod, StringRecord} from '@appium/types';
|
|
6
|
-
import type {AndroidDriver} from '../driver';
|
|
6
|
+
import type {AndroidDriver} from '../driver.js';
|
|
7
7
|
import type {ADB} from 'appium-adb';
|
|
8
|
-
import type {FormFields} from './types';
|
|
8
|
+
import type {FormFields} from './types.js';
|
|
9
9
|
|
|
10
10
|
// https://github.com/appium/io.appium.settings#internal-audio--video-recording
|
|
11
11
|
const DEFAULT_EXT = '.mp4';
|
package/lib/commands/memory.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {errors} from 'appium/driver';
|
|
2
|
-
import type {AndroidDriver} from '../driver';
|
|
3
|
-
import type {TrimMemoryLevel} from './types';
|
|
1
|
+
import {errors} from 'appium/driver.js';
|
|
2
|
+
import type {AndroidDriver} from '../driver.js';
|
|
3
|
+
import type {TrimMemoryLevel} from './types.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Simulates the onTrimMemory() event for the given package.
|
package/lib/commands/misc.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {errors} from 'appium/driver';
|
|
1
|
+
import {errors} from 'appium/driver.js';
|
|
2
2
|
import type {Size, Rect, StringRecord} from '@appium/types';
|
|
3
|
-
import type {AndroidDriver} from '../driver';
|
|
4
|
-
import type {SmsListResult, ListSmsOpts} from './types';
|
|
3
|
+
import type {AndroidDriver} from '../driver.js';
|
|
4
|
+
import type {SmsListResult, ListSmsOpts} from './types.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Gets the window size.
|
package/lib/commands/network.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {errors} from 'appium/driver';
|
|
1
|
+
import {errors} from 'appium/driver.js';
|
|
2
2
|
import {util} from '@appium/support';
|
|
3
|
-
import type {AndroidDriver} from '../driver';
|
|
4
|
-
import type {ServiceType, GetConnectivityResult} from './types';
|
|
3
|
+
import type {AndroidDriver} from '../driver.js';
|
|
4
|
+
import type {ServiceType, GetConnectivityResult} from './types.js';
|
|
5
5
|
|
|
6
6
|
const AIRPLANE_MODE_MASK = 0b001;
|
|
7
7
|
const WIFI_MASK = 0b010;
|
package/lib/commands/nfc.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {errors} from 'appium/driver';
|
|
2
|
-
import type {AndroidDriver} from '../driver';
|
|
3
|
-
import type {NfcAction} from './types';
|
|
1
|
+
import {errors} from 'appium/driver.js';
|
|
2
|
+
import type {AndroidDriver} from '../driver.js';
|
|
3
|
+
import type {NfcAction} from './types.js';
|
|
4
4
|
|
|
5
5
|
const SUPPORTED_ACTIONS = {
|
|
6
6
|
ENABLE: 'enable',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {retryInterval} from 'asyncbox';
|
|
2
2
|
import type {ExecError} from 'teen_process';
|
|
3
|
-
import type {AndroidDriver} from '../driver';
|
|
4
|
-
import type {PerformanceDataType} from './types';
|
|
3
|
+
import type {AndroidDriver} from '../driver.js';
|
|
4
|
+
import type {PerformanceDataType} from './types.js';
|
|
5
5
|
import {util} from '@appium/support';
|
|
6
6
|
|
|
7
7
|
export const NETWORK_KEYS = [
|
|
@@ -187,7 +187,7 @@ export async function getMemoryInfo(
|
|
|
187
187
|
}
|
|
188
188
|
}
|
|
189
189
|
if (valDict.totalPrivateDirty && valDict.totalPrivateDirty !== 'nodex') {
|
|
190
|
-
const headers =
|
|
190
|
+
const headers = [...MEMORY_KEYS];
|
|
191
191
|
const values = headers.map((header) => valDict[header]);
|
|
192
192
|
return [headers, values];
|
|
193
193
|
}
|
|
@@ -458,7 +458,7 @@ export async function getBatteryInfo(this: AndroidDriver, retries: number = 2):
|
|
|
458
458
|
const power = parseInt((data.split(':')[1] || '').trim(), 10);
|
|
459
459
|
|
|
460
460
|
if (!Number.isNaN(power)) {
|
|
461
|
-
return [
|
|
461
|
+
return [[...BATTERY_KEYS], [power.toString()]];
|
|
462
462
|
} else {
|
|
463
463
|
throw new Error(`Unable to parse battery data: '${data}'`);
|
|
464
464
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {errors} from 'appium/driver';
|
|
2
|
-
import {ADB_SHELL_FEATURE} from '../utils';
|
|
3
|
-
import type {AndroidDriver} from '../driver';
|
|
1
|
+
import {errors} from 'appium/driver.js';
|
|
2
|
+
import {ADB_SHELL_FEATURE} from '../utils.js';
|
|
3
|
+
import type {AndroidDriver} from '../driver.js';
|
|
4
4
|
import {util} from '@appium/support';
|
|
5
5
|
|
|
6
6
|
const ALL_PERMISSIONS_MAGIC = 'all';
|
|
@@ -3,13 +3,13 @@ import type {NetOptions, HttpUploadOptions} from '@appium/support';
|
|
|
3
3
|
import {waitForCondition} from 'asyncbox';
|
|
4
4
|
import path from 'node:path';
|
|
5
5
|
import {exec} from 'teen_process';
|
|
6
|
-
import type {AndroidDriver} from '../driver';
|
|
6
|
+
import type {AndroidDriver} from '../driver.js';
|
|
7
7
|
import type {ADB} from 'appium-adb';
|
|
8
8
|
import type {
|
|
9
9
|
StartScreenRecordingOpts,
|
|
10
10
|
StopScreenRecordingOpts,
|
|
11
11
|
ScreenRecordingProperties,
|
|
12
|
-
} from './types';
|
|
12
|
+
} from './types.js';
|
|
13
13
|
|
|
14
14
|
const RETRY_PAUSE = 300;
|
|
15
15
|
const RETRY_TIMEOUT = 5000;
|
|
@@ -65,7 +65,7 @@ export async function startRecordingScreen(
|
|
|
65
65
|
if (this._screenRecordingProperties) {
|
|
66
66
|
// XXX: this doesn't need to be done in serial, does it?
|
|
67
67
|
const props = this._screenRecordingProperties;
|
|
68
|
-
for (const record of props
|
|
68
|
+
for (const record of props?.records || []) {
|
|
69
69
|
await this.adb.rimraf(record);
|
|
70
70
|
}
|
|
71
71
|
this._screenRecordingProperties = undefined;
|
|
@@ -136,7 +136,7 @@ export async function stopRecordingScreen(
|
|
|
136
136
|
return '';
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
-
if (props
|
|
139
|
+
if (props?.recordingProcess?.isRunning) {
|
|
140
140
|
try {
|
|
141
141
|
await props.recordingProcess.stop('SIGINT', PROCESS_SHUTDOWN_TIMEOUT);
|
|
142
142
|
} catch {
|
|
@@ -157,7 +157,7 @@ export async function stopRecordingScreen(
|
|
|
157
157
|
const tmpRoot = await tempDir.openDir();
|
|
158
158
|
try {
|
|
159
159
|
const localRecords: string[] = [];
|
|
160
|
-
for (const pathOnDevice of props
|
|
160
|
+
for (const pathOnDevice of props?.records || []) {
|
|
161
161
|
const relativePath = path.resolve(tmpRoot, path.posix.basename(pathOnDevice));
|
|
162
162
|
localRecords.push(relativePath);
|
|
163
163
|
await this.adb.pull(pathOnDevice, relativePath, {timeout: ADB_PULL_TIMEOUT});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {fs, tempDir, util} from '@appium/support';
|
|
2
2
|
import type {StringRecord} from '@appium/types';
|
|
3
|
-
import type {AndroidDriver, AndroidDriverOpts} from '../driver';
|
|
4
|
-
import type {Locale} from './types';
|
|
3
|
+
import type {AndroidDriver, AndroidDriverOpts} from '../driver.js';
|
|
4
|
+
import type {Locale} from './types.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Gets the localized strings from the application.
|
package/lib/commands/shell.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {util} from '@appium/support';
|
|
2
|
-
import {errors} from 'appium/driver';
|
|
2
|
+
import {errors} from 'appium/driver.js';
|
|
3
3
|
import {exec} from 'teen_process';
|
|
4
4
|
import type {ExecError} from 'teen_process';
|
|
5
|
-
import {ADB_SHELL_FEATURE} from '../utils';
|
|
6
|
-
import type {AndroidDriver} from '../driver';
|
|
5
|
+
import {ADB_SHELL_FEATURE} from '../utils.js';
|
|
6
|
+
import type {AndroidDriver} from '../driver.js';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Executes a shell command on the device via ADB.
|
|
@@ -6,10 +6,10 @@ import net from 'node:net';
|
|
|
6
6
|
import url from 'node:url';
|
|
7
7
|
import {checkPortStatus} from 'portscanner';
|
|
8
8
|
import {SubProcess, exec} from 'teen_process';
|
|
9
|
-
import type {AndroidDriver} from '../driver';
|
|
9
|
+
import type {AndroidDriver} from '../driver.js';
|
|
10
10
|
import type {ADB} from 'appium-adb';
|
|
11
11
|
import type {AppiumLogger} from '@appium/types';
|
|
12
|
-
import type {DeviceInfo, InitGStreamerPipelineOpts} from './types';
|
|
12
|
+
import type {DeviceInfo, InitGStreamerPipelineOpts} from './types.js';
|
|
13
13
|
|
|
14
14
|
const RECORDING_INTERVAL_SEC = 5;
|
|
15
15
|
const STREAMING_STARTUP_TIMEOUT_MS = 5000;
|
|
@@ -225,11 +225,13 @@ export async function mobileStartScreenStreaming(
|
|
|
225
225
|
}
|
|
226
226
|
}
|
|
227
227
|
|
|
228
|
+
// Both are guaranteed to be set at this point, since mjpegServerReadyPromise
|
|
229
|
+
// only resolves after the MJPEG server has started listening.
|
|
228
230
|
this._screenStreamingProps = {
|
|
229
231
|
deviceStreamingProc,
|
|
230
232
|
gstreamerPipeline,
|
|
231
|
-
mjpegSocket,
|
|
232
|
-
mjpegServer,
|
|
233
|
+
mjpegSocket: mjpegSocket as net.Socket,
|
|
234
|
+
mjpegServer: mjpegServer as http.Server,
|
|
233
235
|
};
|
|
234
236
|
}
|
|
235
237
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {errors} from 'appium/driver';
|
|
1
|
+
import {errors} from 'appium/driver.js';
|
|
2
2
|
import type {StringRecord} from '@appium/types';
|
|
3
|
-
import type {AndroidDriver} from '../driver';
|
|
4
|
-
import type {StatusBarCommand, WindowProperties} from './types';
|
|
3
|
+
import type {AndroidDriver} from '../driver.js';
|
|
4
|
+
import type {StatusBarCommand, WindowProperties} from './types.js';
|
|
5
5
|
import {util} from '@appium/support';
|
|
6
6
|
|
|
7
7
|
const WINDOW_TITLE_PATTERN = /^\s+Window\s#\d+\sWindow\{[0-9a-f]+\s\w+\s([\w-]+)\}:$/;
|
|
@@ -142,14 +142,14 @@ export function parseWindowProperties(
|
|
|
142
142
|
export function parseWindows(this: AndroidDriver, lines: string): SystemBarsResult {
|
|
143
143
|
const windows: StringRecord<string[]> = {};
|
|
144
144
|
let currentWindowName: string | null = null;
|
|
145
|
-
for (const line of lines.split('\n').map((line) =>
|
|
146
|
-
const match = WINDOW_TITLE_PATTERN.exec(line
|
|
145
|
+
for (const line of lines.split('\n').map((line) => line.trimEnd())) {
|
|
146
|
+
const match = WINDOW_TITLE_PATTERN.exec(line);
|
|
147
147
|
if (match) {
|
|
148
148
|
currentWindowName = match[1];
|
|
149
149
|
windows[currentWindowName] = [];
|
|
150
150
|
continue;
|
|
151
151
|
}
|
|
152
|
-
if (
|
|
152
|
+
if (line.trim().length === 0) {
|
|
153
153
|
currentWindowName = null;
|
|
154
154
|
continue;
|
|
155
155
|
}
|
package/lib/commands/time.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import dayjs from 'dayjs';
|
|
2
|
-
import utc from 'dayjs/plugin/utc';
|
|
3
|
-
import customParseFormat from 'dayjs/plugin/customParseFormat';
|
|
4
|
-
import type {AndroidDriver} from '../driver';
|
|
2
|
+
import utc from 'dayjs/plugin/utc.js';
|
|
3
|
+
import customParseFormat from 'dayjs/plugin/customParseFormat.js';
|
|
4
|
+
import type {AndroidDriver} from '../driver.js';
|
|
5
5
|
|
|
6
6
|
dayjs.extend(utc);
|
|
7
7
|
dayjs.extend(customParseFormat);
|
package/lib/commands/types.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import type {HTTPMethod, StringRecord} from '@appium/types';
|
|
2
|
-
import type {AndroidDriverCaps} from '../driver';
|
|
2
|
+
import type {AndroidDriverCaps} from '../driver.js';
|
|
3
3
|
import type {SubProcess} from 'teen_process';
|
|
4
4
|
import type {timing} from '@appium/support';
|
|
5
|
+
import type {ChildProcess} from 'node:child_process';
|
|
6
|
+
import type {Socket} from 'node:net';
|
|
7
|
+
import type {Server} from 'node:http';
|
|
5
8
|
|
|
6
9
|
/**
|
|
7
10
|
* @privateRemarks probably better defined in `appium-adb`
|
|
@@ -451,6 +454,17 @@ export interface InitGStreamerPipelineOpts {
|
|
|
451
454
|
considerRotation?: boolean;
|
|
452
455
|
logPipelineDetails?: boolean;
|
|
453
456
|
}
|
|
457
|
+
|
|
458
|
+
/**
|
|
459
|
+
* The screen streaming process handles cached on the driver instance
|
|
460
|
+
* while a `mobile: startScreenStreaming` session is active.
|
|
461
|
+
*/
|
|
462
|
+
export interface ScreenStreamingProps {
|
|
463
|
+
deviceStreamingProc: ChildProcess;
|
|
464
|
+
gstreamerPipeline: SubProcess;
|
|
465
|
+
mjpegSocket: Socket;
|
|
466
|
+
mjpegServer: Server;
|
|
467
|
+
}
|
|
454
468
|
export interface WindowProperties {
|
|
455
469
|
/**
|
|
456
470
|
* Whether the window is visible
|
package/lib/constraints.ts
CHANGED
package/lib/doctor/checks.ts
CHANGED