appium-xcuitest-driver 10.8.3 → 10.9.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 +12 -0
- package/build/lib/app-utils.d.ts +2 -2
- package/build/lib/app-utils.d.ts.map +1 -1
- package/build/lib/app-utils.js +4 -1
- package/build/lib/app-utils.js.map +1 -1
- package/build/lib/commands/app-management.js +2 -2
- package/build/lib/commands/app-management.js.map +1 -1
- package/build/lib/commands/appearance.js +2 -2
- package/build/lib/commands/appearance.js.map +1 -1
- package/build/lib/commands/biometric.js +3 -3
- package/build/lib/commands/biometric.js.map +1 -1
- package/build/lib/commands/certificate.d.ts.map +1 -1
- package/build/lib/commands/certificate.js +9 -3
- package/build/lib/commands/certificate.js.map +1 -1
- package/build/lib/commands/context.d.ts +5 -5
- package/build/lib/commands/context.d.ts.map +1 -1
- package/build/lib/commands/context.js +6 -6
- package/build/lib/commands/context.js.map +1 -1
- package/build/lib/commands/file-movement.d.ts.map +1 -1
- package/build/lib/commands/file-movement.js +7 -7
- package/build/lib/commands/file-movement.js.map +1 -1
- package/build/lib/commands/general.js +1 -1
- package/build/lib/commands/general.js.map +1 -1
- package/build/lib/commands/gesture.js +1 -1
- package/build/lib/commands/gesture.js.map +1 -1
- package/build/lib/commands/keychains.js +1 -1
- package/build/lib/commands/keychains.js.map +1 -1
- package/build/lib/commands/localization.js +1 -1
- package/build/lib/commands/localization.js.map +1 -1
- package/build/lib/commands/location.js +1 -1
- package/build/lib/commands/location.js.map +1 -1
- package/build/lib/commands/log.js +7 -7
- package/build/lib/commands/log.js.map +1 -1
- package/build/lib/commands/memory.js +1 -1
- package/build/lib/commands/memory.js.map +1 -1
- package/build/lib/commands/notifications.js +1 -1
- package/build/lib/commands/notifications.js.map +1 -1
- package/build/lib/commands/pasteboard.js +2 -2
- package/build/lib/commands/pasteboard.js.map +1 -1
- package/build/lib/commands/pcap.js +1 -1
- package/build/lib/commands/pcap.js.map +1 -1
- package/build/lib/commands/performance.d.ts.map +1 -1
- package/build/lib/commands/performance.js +13 -4
- package/build/lib/commands/performance.js.map +1 -1
- package/build/lib/commands/permissions.js +2 -2
- package/build/lib/commands/permissions.js.map +1 -1
- package/build/lib/commands/proxy-helper.d.ts.map +1 -1
- package/build/lib/commands/proxy-helper.js +0 -3
- package/build/lib/commands/proxy-helper.js.map +1 -1
- package/build/lib/commands/screenshots.js +1 -1
- package/build/lib/commands/screenshots.js.map +1 -1
- package/build/lib/commands/simctl.d.ts +1 -1
- package/build/lib/commands/simctl.d.ts.map +1 -1
- package/build/lib/commands/simctl.js +1 -1
- package/build/lib/commands/simctl.js.map +1 -1
- package/build/lib/commands/web.js +1 -1
- package/build/lib/commands/web.js.map +1 -1
- package/build/lib/commands/xctest-record-screen.js +2 -2
- package/build/lib/commands/xctest-record-screen.js.map +1 -1
- package/build/lib/desired-caps.d.ts +383 -507
- package/build/lib/desired-caps.d.ts.map +1 -1
- package/build/lib/desired-caps.js +6 -10
- package/build/lib/desired-caps.js.map +1 -1
- package/build/lib/device/clients/base-device-client.d.ts.map +1 -0
- package/build/lib/device/clients/base-device-client.js.map +1 -0
- package/build/lib/{real-device-clients → device/clients}/py-ios-device-client.d.ts +1 -1
- package/build/lib/device/clients/py-ios-device-client.d.ts.map +1 -0
- package/build/lib/device/clients/py-ios-device-client.js.map +1 -0
- package/build/lib/device/device-connections-factory.d.ts +18 -0
- package/build/lib/device/device-connections-factory.d.ts.map +1 -0
- package/build/lib/{device-connections-factory.js → device/device-connections-factory.js} +57 -41
- package/build/lib/device/device-connections-factory.js.map +1 -0
- package/build/lib/{device-log → device/log}/helpers.d.ts +1 -1
- package/build/lib/device/log/helpers.d.ts.map +1 -0
- package/build/lib/device/log/helpers.js.map +1 -0
- package/build/lib/{device-log → device/log}/ios-crash-log.d.ts +1 -1
- package/build/lib/device/log/ios-crash-log.d.ts.map +1 -0
- package/build/lib/{device-log → device/log}/ios-crash-log.js +1 -1
- package/build/lib/device/log/ios-crash-log.js.map +1 -0
- package/build/lib/device/log/ios-device-log.d.ts.map +1 -0
- package/build/lib/device/log/ios-device-log.js.map +1 -0
- package/build/lib/{device-log → device/log}/ios-log.d.ts +1 -1
- package/build/lib/device/log/ios-log.d.ts.map +1 -0
- package/build/lib/device/log/ios-log.js.map +1 -0
- package/build/lib/device/log/ios-performance-log.d.ts.map +1 -0
- package/build/lib/device/log/ios-performance-log.js.map +1 -0
- package/build/lib/device/log/ios-simulator-log.d.ts.map +1 -0
- package/build/lib/device/log/ios-simulator-log.js.map +1 -0
- package/build/lib/{device-log → device/log}/line-consuming-log.d.ts +1 -1
- package/build/lib/device/log/line-consuming-log.d.ts.map +1 -0
- package/build/lib/device/log/line-consuming-log.js.map +1 -0
- package/build/lib/{device-log → device/log}/safari-console-log.d.ts +1 -1
- package/build/lib/device/log/safari-console-log.d.ts.map +1 -0
- package/build/lib/device/log/safari-console-log.js.map +1 -0
- package/build/lib/device/log/safari-network-log.d.ts.map +1 -0
- package/build/lib/device/log/safari-network-log.js.map +1 -0
- package/build/lib/device/real-device-management.d.ts +146 -0
- package/build/lib/device/real-device-management.d.ts.map +1 -0
- package/build/lib/device/real-device-management.js +728 -0
- package/build/lib/device/real-device-management.js.map +1 -0
- package/build/lib/device/simulator-management.d.ts +65 -0
- package/build/lib/device/simulator-management.d.ts.map +1 -0
- package/build/lib/{simulator-management.js → device/simulator-management.js} +24 -43
- package/build/lib/device/simulator-management.js.map +1 -0
- package/build/lib/driver.d.ts +129 -1385
- package/build/lib/driver.d.ts.map +1 -1
- package/build/lib/driver.js +476 -600
- package/build/lib/driver.js.map +1 -1
- package/build/lib/method-map.d.ts +1 -1
- package/build/lib/method-map.d.ts.map +1 -1
- package/build/lib/method-map.js +2 -2
- package/build/lib/method-map.js.map +1 -1
- package/lib/app-utils.js +5 -1
- package/lib/commands/app-management.js +2 -2
- package/lib/commands/appearance.js +2 -2
- package/lib/commands/biometric.js +3 -3
- package/lib/commands/certificate.js +9 -3
- package/lib/commands/context.js +6 -6
- package/lib/commands/file-movement.js +11 -7
- package/lib/commands/general.js +1 -1
- package/lib/commands/gesture.js +1 -1
- package/lib/commands/keychains.js +1 -1
- package/lib/commands/localization.js +1 -1
- package/lib/commands/location.js +1 -1
- package/lib/commands/log.js +7 -7
- package/lib/commands/memory.js +1 -1
- package/lib/commands/notifications.js +1 -1
- package/lib/commands/pasteboard.js +2 -2
- package/lib/commands/pcap.js +1 -1
- package/lib/commands/performance.js +12 -1
- package/lib/commands/permissions.js +2 -2
- package/lib/commands/proxy-helper.js +0 -3
- package/lib/commands/screenshots.js +1 -1
- package/lib/commands/simctl.js +1 -1
- package/lib/commands/web.js +1 -1
- package/lib/commands/xctest-record-screen.js +2 -2
- package/lib/{desired-caps.js → desired-caps.ts} +7 -6
- package/lib/{real-device-clients → device/clients}/py-ios-device-client.ts +1 -1
- package/lib/{device-connections-factory.js → device/device-connections-factory.ts} +96 -60
- package/lib/{device-log → device/log}/helpers.ts +1 -1
- package/lib/{device-log → device/log}/ios-crash-log.ts +3 -3
- package/lib/{device-log → device/log}/ios-log.ts +1 -1
- package/lib/{device-log → device/log}/line-consuming-log.ts +1 -1
- package/lib/{device-log → device/log}/safari-console-log.ts +1 -1
- package/lib/device/real-device-management.ts +819 -0
- package/lib/{simulator-management.js → device/simulator-management.ts} +69 -62
- package/lib/{driver.js → driver.ts} +619 -713
- package/lib/{method-map.js → method-map.ts} +5 -2
- package/npm-shrinkwrap.json +5 -5
- package/package.json +1 -1
- package/build/lib/device-connections-factory.d.ts +0 -13
- package/build/lib/device-connections-factory.d.ts.map +0 -1
- package/build/lib/device-connections-factory.js.map +0 -1
- package/build/lib/device-log/helpers.d.ts.map +0 -1
- package/build/lib/device-log/helpers.js.map +0 -1
- package/build/lib/device-log/ios-crash-log.d.ts.map +0 -1
- package/build/lib/device-log/ios-crash-log.js.map +0 -1
- package/build/lib/device-log/ios-device-log.d.ts.map +0 -1
- package/build/lib/device-log/ios-device-log.js.map +0 -1
- package/build/lib/device-log/ios-log.d.ts.map +0 -1
- package/build/lib/device-log/ios-log.js.map +0 -1
- package/build/lib/device-log/ios-performance-log.d.ts.map +0 -1
- package/build/lib/device-log/ios-performance-log.js.map +0 -1
- package/build/lib/device-log/ios-simulator-log.d.ts.map +0 -1
- package/build/lib/device-log/ios-simulator-log.js.map +0 -1
- package/build/lib/device-log/line-consuming-log.d.ts.map +0 -1
- package/build/lib/device-log/line-consuming-log.js.map +0 -1
- package/build/lib/device-log/safari-console-log.d.ts.map +0 -1
- package/build/lib/device-log/safari-console-log.js.map +0 -1
- package/build/lib/device-log/safari-network-log.d.ts.map +0 -1
- package/build/lib/device-log/safari-network-log.js.map +0 -1
- package/build/lib/ios-fs-helpers.d.ts +0 -75
- package/build/lib/ios-fs-helpers.d.ts.map +0 -1
- package/build/lib/ios-fs-helpers.js +0 -370
- package/build/lib/ios-fs-helpers.js.map +0 -1
- package/build/lib/real-device-clients/base-device-client.d.ts.map +0 -1
- package/build/lib/real-device-clients/base-device-client.js.map +0 -1
- package/build/lib/real-device-clients/py-ios-device-client.d.ts.map +0 -1
- package/build/lib/real-device-clients/py-ios-device-client.js.map +0 -1
- package/build/lib/real-device-management.d.ts +0 -53
- package/build/lib/real-device-management.d.ts.map +0 -1
- package/build/lib/real-device-management.js +0 -128
- package/build/lib/real-device-management.js.map +0 -1
- package/build/lib/real-device.d.ts +0 -112
- package/build/lib/real-device.d.ts.map +0 -1
- package/build/lib/real-device.js +0 -352
- package/build/lib/real-device.js.map +0 -1
- package/build/lib/simulator-management.d.ts +0 -96
- package/build/lib/simulator-management.d.ts.map +0 -1
- package/build/lib/simulator-management.js.map +0 -1
- package/build/lib/xcrun.d.ts +0 -3
- package/build/lib/xcrun.d.ts.map +0 -1
- package/build/lib/xcrun.js +0 -17
- package/build/lib/xcrun.js.map +0 -1
- package/lib/ios-fs-helpers.js +0 -355
- package/lib/real-device-management.js +0 -133
- package/lib/real-device.js +0 -347
- package/lib/xcrun.js +0 -16
- /package/build/lib/{real-device-clients → device/clients}/base-device-client.d.ts +0 -0
- /package/build/lib/{real-device-clients → device/clients}/base-device-client.js +0 -0
- /package/build/lib/{real-device-clients → device/clients}/py-ios-device-client.js +0 -0
- /package/build/lib/{device-log → device/log}/helpers.js +0 -0
- /package/build/lib/{device-log → device/log}/ios-device-log.d.ts +0 -0
- /package/build/lib/{device-log → device/log}/ios-device-log.js +0 -0
- /package/build/lib/{device-log → device/log}/ios-log.js +0 -0
- /package/build/lib/{device-log → device/log}/ios-performance-log.d.ts +0 -0
- /package/build/lib/{device-log → device/log}/ios-performance-log.js +0 -0
- /package/build/lib/{device-log → device/log}/ios-simulator-log.d.ts +0 -0
- /package/build/lib/{device-log → device/log}/ios-simulator-log.js +0 -0
- /package/build/lib/{device-log → device/log}/line-consuming-log.js +0 -0
- /package/build/lib/{device-log → device/log}/safari-console-log.js +0 -0
- /package/build/lib/{device-log → device/log}/safari-network-log.d.ts +0 -0
- /package/build/lib/{device-log → device/log}/safari-network-log.js +0 -0
- /package/lib/{real-device-clients → device/clients}/base-device-client.ts +0 -0
- /package/lib/{device-log → device/log}/ios-device-log.ts +0 -0
- /package/lib/{device-log → device/log}/ios-performance-log.ts +0 -0
- /package/lib/{device-log → device/log}/ios-simulator-log.ts +0 -0
- /package/lib/{device-log → device/log}/safari-network-log.ts +0 -0
package/lib/commands/log.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import _ from 'lodash';
|
|
2
2
|
import B from 'bluebird';
|
|
3
3
|
import {DEFAULT_WS_PATHNAME_PREFIX} from 'appium/driver';
|
|
4
|
-
import {IOSCrashLog} from '../device
|
|
5
|
-
import {IOSSimulatorLog} from '../device
|
|
6
|
-
import {IOSDeviceLog} from '../device
|
|
4
|
+
import {IOSCrashLog} from '../device/log/ios-crash-log';
|
|
5
|
+
import {IOSSimulatorLog} from '../device/log/ios-simulator-log';
|
|
6
|
+
import {IOSDeviceLog} from '../device/log/ios-device-log';
|
|
7
7
|
import WebSocket from 'ws';
|
|
8
|
-
import { SafariConsoleLog } from '../device
|
|
9
|
-
import { SafariNetworkLog } from '../device
|
|
10
|
-
import { toLogEntry } from '../device
|
|
8
|
+
import { SafariConsoleLog } from '../device/log/safari-console-log';
|
|
9
|
+
import { SafariNetworkLog } from '../device/log/safari-network-log';
|
|
10
|
+
import { toLogEntry } from '../device/log/helpers';
|
|
11
11
|
import { NATIVE_WIN } from '../utils';
|
|
12
12
|
import { BIDI_EVENT_NAME } from './bidi/constants';
|
|
13
13
|
import { makeLogEntryAddedEvent } from './bidi/models';
|
|
@@ -119,7 +119,7 @@ export async function startLogCapture() {
|
|
|
119
119
|
[this.logs.syslog,] = assignBiDiLogListener.bind(this)(
|
|
120
120
|
this.isRealDevice()
|
|
121
121
|
? new IOSDeviceLog({
|
|
122
|
-
udid: this.opts.udid,
|
|
122
|
+
udid: /** @type {string} */ (this.opts.udid),
|
|
123
123
|
showLogs: this.opts.showIOSLog,
|
|
124
124
|
log: this.log,
|
|
125
125
|
})
|
package/lib/commands/memory.js
CHANGED
|
@@ -14,7 +14,7 @@ export async function mobileSendMemoryWarning(bundleId) {
|
|
|
14
14
|
throw new Error('Memory warning simulation is only supported on real devices');
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
const device = /** @type {import('../real-device').RealDevice} */ (this.device);
|
|
17
|
+
const device = /** @type {import('../device/real-device-management').RealDevice} */ (this.device);
|
|
18
18
|
|
|
19
19
|
const appInfos = await device.devicectl.listApps(bundleId);
|
|
20
20
|
if (_.isEmpty(appInfos)) {
|
|
@@ -34,7 +34,7 @@ export async function mobilePushNotification(bundleId, payload) {
|
|
|
34
34
|
`Got ${JSON.stringify(payload.aps)} instead`,
|
|
35
35
|
);
|
|
36
36
|
}
|
|
37
|
-
return await /** @type {import('
|
|
37
|
+
return await /** @type {import('appium-ios-simulator').Simulator} */ (this.device).pushNotification({
|
|
38
38
|
...payload,
|
|
39
39
|
'Simulator Target Bundle': bundleId,
|
|
40
40
|
});
|
|
@@ -16,7 +16,7 @@ export async function mobileSetPasteboard(content, encoding = 'utf8') {
|
|
|
16
16
|
// can be empty string
|
|
17
17
|
throw new Error('Pasteboard content is mandatory to set');
|
|
18
18
|
}
|
|
19
|
-
return await /** @type {import('
|
|
19
|
+
return await /** @type {import('appium-ios-simulator').Simulator} */ (this.device).simctl.setPasteboard(
|
|
20
20
|
content, /** @type {BufferEncoding} */ (encoding)
|
|
21
21
|
);
|
|
22
22
|
}
|
|
@@ -34,7 +34,7 @@ export async function mobileGetPasteboard(encoding = 'utf8') {
|
|
|
34
34
|
if (!this.isSimulator()) {
|
|
35
35
|
throw new Error('Getting pasteboard content is not supported on real devices');
|
|
36
36
|
}
|
|
37
|
-
return await /** @type {import('
|
|
37
|
+
return await /** @type {import('appium-ios-simulator').Simulator} */ (this.device).simctl.getPasteboard(encoding);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
/**
|
package/lib/commands/pcap.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Pyidevice } from '../
|
|
1
|
+
import { Pyidevice } from '../device/clients/py-ios-device-client';
|
|
2
2
|
import {fs, tempDir, util} from 'appium/support';
|
|
3
3
|
import {encodeBase64OrUpload} from '../utils';
|
|
4
4
|
import {errors} from 'appium/driver';
|
|
@@ -3,7 +3,6 @@ import path from 'path';
|
|
|
3
3
|
import {fs, zip, logger, util, tempDir} from 'appium/support';
|
|
4
4
|
import {SubProcess, exec} from 'teen_process';
|
|
5
5
|
import {encodeBase64OrUpload} from '../utils';
|
|
6
|
-
import { XCRUN, requireXcrun } from '../xcrun';
|
|
7
6
|
import {waitForCondition} from 'asyncbox';
|
|
8
7
|
import B from 'bluebird';
|
|
9
8
|
|
|
@@ -20,6 +19,7 @@ const DEFAULT_EXT = '.trace';
|
|
|
20
19
|
const DEFAULT_PID = 'current';
|
|
21
20
|
const INSTRUMENTS = 'instruments';
|
|
22
21
|
const XCTRACE = 'xctrace';
|
|
22
|
+
const XCRUN = 'xcrun';
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
25
|
* Starts performance profiling for the device under test.
|
|
@@ -387,6 +387,17 @@ export class PerfRecorder {
|
|
|
387
387
|
}
|
|
388
388
|
}
|
|
389
389
|
|
|
390
|
+
async function requireXcrun() {
|
|
391
|
+
try {
|
|
392
|
+
return await fs.which(XCRUN);
|
|
393
|
+
} catch {
|
|
394
|
+
throw new Error(
|
|
395
|
+
`${XCRUN} has not been found in PATH. ` +
|
|
396
|
+
`Please make sure XCode development tools are installed`,
|
|
397
|
+
);
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
|
|
390
401
|
/**
|
|
391
402
|
* @typedef {import('../driver').XCUITestDriver} XCUITestDriver
|
|
392
403
|
*/
|
|
@@ -55,7 +55,7 @@ export async function mobileGetPermission(bundleId, service) {
|
|
|
55
55
|
assertSimulator(this);
|
|
56
56
|
|
|
57
57
|
return /** @type {import('./types').PermissionState} */ (
|
|
58
|
-
await /** @type {import('
|
|
58
|
+
await /** @type {import('appium-ios-simulator').Simulator} */ (this.device).getPermission(
|
|
59
59
|
bundleId, String(service)
|
|
60
60
|
)
|
|
61
61
|
);
|
|
@@ -77,7 +77,7 @@ export async function mobileSetPermissions(access, bundleId) {
|
|
|
77
77
|
}
|
|
78
78
|
assertSimulator(this);
|
|
79
79
|
|
|
80
|
-
await /** @type {import('
|
|
80
|
+
await /** @type {import('appium-ios-simulator').Simulator} */ (this.device).setPermissions(bundleId, access);
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
/**
|
|
@@ -69,9 +69,6 @@ export async function proxyCommand(url, method, body, isSessionCommand = true) {
|
|
|
69
69
|
);
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
if (!this.wda) {
|
|
73
|
-
throw new Error('Cannot call proxyCommand without WDA driver active');
|
|
74
|
-
}
|
|
75
72
|
const proxy = isSessionCommand ? this.wda.jwproxy : this.wda.noSessionProxy;
|
|
76
73
|
if (!proxy) {
|
|
77
74
|
throw new Error('Cannot call proxyCommand without WDA proxy active');
|
|
@@ -60,7 +60,7 @@ export async function getScreenshot() {
|
|
|
60
60
|
// simulator attempt
|
|
61
61
|
if (this.isSimulator()) {
|
|
62
62
|
this.log.info(`Falling back to 'simctl io screenshot' API`);
|
|
63
|
-
const payload = await /** @type {import('
|
|
63
|
+
const payload = await /** @type {import('appium-ios-simulator').Simulator} */ (this.device).simctl.getScreenshot();
|
|
64
64
|
if (!payload) {
|
|
65
65
|
throw new errors.UnableToCaptureScreen();
|
|
66
66
|
}
|
package/lib/commands/simctl.js
CHANGED
|
@@ -53,7 +53,7 @@ export async function mobileSimctl(command, args = [], timeout = undefined) {
|
|
|
53
53
|
`Available subcommands are ${SUBCOMMANDS_HAS_DEVICE.join(',')}`);
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
return await /** @type {import('
|
|
56
|
+
return await /** @type {import('appium-ios-simulator').Simulator} */ (this.device).simctl.exec(
|
|
57
57
|
command,
|
|
58
58
|
{args: [this.opts.udid, ...args], timeout}
|
|
59
59
|
);
|
package/lib/commands/web.js
CHANGED
|
@@ -960,7 +960,7 @@ export async function mobileUpdateSafariPreferences(preferences) {
|
|
|
960
960
|
}
|
|
961
961
|
|
|
962
962
|
this.log.debug(`About to update Safari preferences: ${JSON.stringify(preferences)}`);
|
|
963
|
-
await /** @type {import('
|
|
963
|
+
await /** @type {import('appium-ios-simulator').Simulator} */ (this.device).updateSafariSettings(preferences);
|
|
964
964
|
}
|
|
965
965
|
|
|
966
966
|
/**
|
|
@@ -32,7 +32,7 @@ const SUBDIRECTORY = 'Attachments';
|
|
|
32
32
|
* @returns {Promise<string>} The full path to the screen recording movie
|
|
33
33
|
*/
|
|
34
34
|
async function retrieveRecodingFromSimulator(uuid) {
|
|
35
|
-
const device = /** @type {import('
|
|
35
|
+
const device = /** @type {import('appium-ios-simulator').Simulator} */ (this.device);
|
|
36
36
|
const dataRoot = /** @type {string} */ (device.getDir());
|
|
37
37
|
// On Simulators the path looks like
|
|
38
38
|
// $HOME/Library/Developer/CoreSimulator/Devices/F8E1968A-8443-4A9A-AB86-27C54C36A2F6/data/Containers/Data/InternalDaemon/4E3FE8DF-AD0A-41DA-B6EC-C35E5798C219/Attachments/A044DAF7-4A58-4CD5-95C3-29B4FE80C377
|
|
@@ -58,7 +58,7 @@ async function retrieveRecodingFromSimulator(uuid) {
|
|
|
58
58
|
* @returns {Promise<string>} The full path to the screen recording movie
|
|
59
59
|
*/
|
|
60
60
|
async function retrieveRecodingFromRealDevice(uuid) {
|
|
61
|
-
const device = /** @type {import('../real-device').RealDevice} */ (this.device);
|
|
61
|
+
const device = /** @type {import('../device/real-device-management').RealDevice} */ (this.device);
|
|
62
62
|
|
|
63
63
|
const fileNames = await device.devicectl.listFiles(DOMAIN_TYPE, DOMAIN_IDENTIFIER, {
|
|
64
64
|
username: USERNAME,
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import type {Constraints} from '@appium/types';
|
|
2
|
+
|
|
1
3
|
// These platform names should be valid in simulator name
|
|
2
|
-
const PLATFORM_NAME_IOS = 'iOS';
|
|
3
|
-
const PLATFORM_NAME_TVOS = 'tvOS';
|
|
4
|
+
export const PLATFORM_NAME_IOS = 'iOS';
|
|
5
|
+
export const PLATFORM_NAME_TVOS = 'tvOS';
|
|
4
6
|
|
|
5
|
-
const desiredCapConstraints =
|
|
7
|
+
export const desiredCapConstraints = {
|
|
6
8
|
platformName: {
|
|
7
9
|
// override
|
|
8
10
|
presence: true,
|
|
@@ -391,7 +393,6 @@ const desiredCapConstraints = /** @type {const} */ ({
|
|
|
391
393
|
isString: true,
|
|
392
394
|
inclusionCaseInsensitive: ['none', 'eager', 'normal']
|
|
393
395
|
}
|
|
394
|
-
}
|
|
396
|
+
} as const satisfies Constraints;
|
|
395
397
|
|
|
396
|
-
export
|
|
397
|
-
export default desiredCapConstraints;
|
|
398
|
+
export type XCUITestDriverConstraints = typeof desiredCapConstraints;
|
|
@@ -4,7 +4,7 @@ import path from 'path';
|
|
|
4
4
|
import { BaseDeviceClient } from './base-device-client';
|
|
5
5
|
import type { BaseDeviceClientOptions, InstallProfileArgs } from './base-device-client';
|
|
6
6
|
import type { TeenProcessExecResult } from 'teen_process';
|
|
7
|
-
import type { CertificateList } from '
|
|
7
|
+
import type { CertificateList } from '../../commands/types';
|
|
8
8
|
|
|
9
9
|
// https://github.com/YueChen-C/py-ios-device
|
|
10
10
|
|
|
@@ -5,30 +5,39 @@ import {logger, util, timing} from 'appium/support';
|
|
|
5
5
|
import {utilities} from 'appium-ios-device';
|
|
6
6
|
import {checkPortStatus} from 'portscanner';
|
|
7
7
|
import {waitForCondition} from 'asyncbox';
|
|
8
|
+
import type { AppiumLogger } from '@appium/types';
|
|
8
9
|
|
|
9
10
|
const LOCALHOST = '127.0.0.1';
|
|
10
11
|
|
|
11
12
|
class iProxy {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
private readonly localport: number;
|
|
14
|
+
private readonly deviceport: number;
|
|
15
|
+
private readonly udid: string;
|
|
16
|
+
private localServer: net.Server | null;
|
|
17
|
+
private readonly log: AppiumLogger;
|
|
18
|
+
private onBeforeProcessExit: (() => void) | null;
|
|
19
|
+
|
|
20
|
+
constructor(udid: string, localport: string | number, deviceport: string | number) {
|
|
21
|
+
this.localport = parseInt(String(localport), 10);
|
|
22
|
+
this.deviceport = parseInt(String(deviceport), 10);
|
|
15
23
|
this.udid = udid;
|
|
16
24
|
this.localServer = null;
|
|
17
25
|
this.log = logger.getLogger(`iProxy@${udid.substring(0, 8)}:${this.localport}`);
|
|
26
|
+
this.onBeforeProcessExit = null;
|
|
18
27
|
}
|
|
19
28
|
|
|
20
|
-
async start() {
|
|
29
|
+
async start(): Promise<void> {
|
|
21
30
|
if (this.localServer) {
|
|
22
31
|
return;
|
|
23
32
|
}
|
|
24
33
|
|
|
25
|
-
this.localServer = net.createServer(async (localSocket) => {
|
|
26
|
-
let remoteSocket;
|
|
34
|
+
this.localServer = net.createServer(async (localSocket: net.Socket) => {
|
|
35
|
+
let remoteSocket: any;
|
|
27
36
|
try {
|
|
28
37
|
// We can only connect to the remote socket after the local socket connection succeeds
|
|
29
38
|
remoteSocket = await utilities.connectPort(this.udid, this.deviceport);
|
|
30
39
|
} catch (e) {
|
|
31
|
-
this.log.debug(e.message);
|
|
40
|
+
this.log.debug((e as Error).message);
|
|
32
41
|
localSocket.destroy();
|
|
33
42
|
return;
|
|
34
43
|
}
|
|
@@ -42,19 +51,23 @@ class iProxy {
|
|
|
42
51
|
localSocket.destroy();
|
|
43
52
|
});
|
|
44
53
|
// not all remote socket errors are critical for the user
|
|
45
|
-
remoteSocket.on('error', (e) => this.log.debug(e));
|
|
54
|
+
remoteSocket.on('error', (e: Error) => this.log.debug(e));
|
|
46
55
|
localSocket.once('end', destroyCommChannel);
|
|
47
56
|
localSocket.once('close', () => {
|
|
48
57
|
destroyCommChannel();
|
|
49
58
|
remoteSocket.destroy();
|
|
50
59
|
});
|
|
51
|
-
localSocket.on('error', (e) => this.log.warn(e.message));
|
|
60
|
+
localSocket.on('error', (e: Error) => this.log.warn(e.message));
|
|
52
61
|
localSocket.pipe(remoteSocket);
|
|
53
62
|
remoteSocket.pipe(localSocket);
|
|
54
63
|
});
|
|
55
|
-
const listeningPromise = new B((resolve, reject) => {
|
|
56
|
-
|
|
57
|
-
|
|
64
|
+
const listeningPromise = new B<void>((resolve, reject) => {
|
|
65
|
+
if (this.localServer) {
|
|
66
|
+
this.localServer.once('listening', resolve);
|
|
67
|
+
this.localServer.once('error', reject);
|
|
68
|
+
} else {
|
|
69
|
+
reject(new Error('Local server is not initialized'));
|
|
70
|
+
}
|
|
58
71
|
});
|
|
59
72
|
this.localServer.listen(this.localport);
|
|
60
73
|
try {
|
|
@@ -63,8 +76,8 @@ class iProxy {
|
|
|
63
76
|
this.localServer = null;
|
|
64
77
|
throw e;
|
|
65
78
|
}
|
|
66
|
-
this.localServer.on('error', (e) => this.log.warn(e.message));
|
|
67
|
-
this.localServer.once('close', (e) => {
|
|
79
|
+
this.localServer.on('error', (e: Error) => this.log.warn(e.message));
|
|
80
|
+
this.localServer.once('close', (e?: Error) => {
|
|
68
81
|
if (e) {
|
|
69
82
|
this.log.info(`The connection has been closed with error ${e.message}`);
|
|
70
83
|
} else {
|
|
@@ -75,20 +88,12 @@ class iProxy {
|
|
|
75
88
|
|
|
76
89
|
this.onBeforeProcessExit = this._closeLocalServer.bind(this);
|
|
77
90
|
// Make sure we free up the socket on process exit
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
_closeLocalServer() {
|
|
82
|
-
if (!this.localServer) {
|
|
83
|
-
return;
|
|
91
|
+
if (this.onBeforeProcessExit) {
|
|
92
|
+
process.on('beforeExit', this.onBeforeProcessExit);
|
|
84
93
|
}
|
|
85
|
-
|
|
86
|
-
this.log.debug(`Closing the connection`);
|
|
87
|
-
this.localServer.close();
|
|
88
|
-
this.localServer = null;
|
|
89
94
|
}
|
|
90
95
|
|
|
91
|
-
stop() {
|
|
96
|
+
stop(): void {
|
|
92
97
|
if (this.onBeforeProcessExit) {
|
|
93
98
|
process.off('beforeExit', this.onBeforeProcessExit);
|
|
94
99
|
this.onBeforeProcessExit = null;
|
|
@@ -96,43 +101,34 @@ class iProxy {
|
|
|
96
101
|
|
|
97
102
|
this._closeLocalServer();
|
|
98
103
|
}
|
|
104
|
+
|
|
105
|
+
private _closeLocalServer(): void {
|
|
106
|
+
if (!this.localServer) {
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
this.log.debug(`Closing the connection`);
|
|
111
|
+
this.localServer.close();
|
|
112
|
+
this.localServer = null;
|
|
113
|
+
}
|
|
99
114
|
}
|
|
100
115
|
|
|
101
116
|
const log = logger.getLogger('DevCon Factory');
|
|
102
117
|
const PORT_CLOSE_TIMEOUT = 15 * 1000; // 15 seconds
|
|
103
118
|
const SPLITTER = ':';
|
|
104
119
|
|
|
105
|
-
class DeviceConnectionsFactory {
|
|
120
|
+
export class DeviceConnectionsFactory {
|
|
121
|
+
private _connectionsMapping: ConnectionMapping;
|
|
122
|
+
|
|
106
123
|
constructor() {
|
|
107
124
|
this._connectionsMapping = {};
|
|
108
125
|
}
|
|
109
126
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
return `${SPLITTER}${util.hasValue(port) ? port : ''}`;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
_toKey(udid = null, port = null) {
|
|
119
|
-
return `${util.hasValue(udid) ? udid : ''}${SPLITTER}${util.hasValue(port) ? port : ''}`;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
_releaseProxiedConnections(connectionKeys) {
|
|
123
|
-
const keys = connectionKeys.filter((k) => _.has(this._connectionsMapping[k], 'iproxy'));
|
|
124
|
-
for (const key of keys) {
|
|
125
|
-
log.info(`Releasing the listener for '${key}'`);
|
|
126
|
-
try {
|
|
127
|
-
this._connectionsMapping[key].iproxy.stop();
|
|
128
|
-
} catch (e) {
|
|
129
|
-
log.debug(e);
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
return keys;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
listConnections(udid = null, port = null, strict = false) {
|
|
127
|
+
listConnections(
|
|
128
|
+
udid: string | null = null,
|
|
129
|
+
port: string | number | null = null,
|
|
130
|
+
strict: boolean = false
|
|
131
|
+
): string[] {
|
|
136
132
|
if (!udid && !port) {
|
|
137
133
|
return [];
|
|
138
134
|
}
|
|
@@ -149,7 +145,11 @@ class DeviceConnectionsFactory {
|
|
|
149
145
|
);
|
|
150
146
|
}
|
|
151
147
|
|
|
152
|
-
async requestConnection(
|
|
148
|
+
async requestConnection(
|
|
149
|
+
udid?: string | null,
|
|
150
|
+
port?: string | number | null,
|
|
151
|
+
options: RequestConnectionOptions = {}
|
|
152
|
+
): Promise<void> {
|
|
153
153
|
if (!udid || !port) {
|
|
154
154
|
log.warn('Did not know how to request the connection:');
|
|
155
155
|
if (!udid) {
|
|
@@ -174,7 +174,7 @@ class DeviceConnectionsFactory {
|
|
|
174
174
|
}
|
|
175
175
|
|
|
176
176
|
if (usePortForwarding) {
|
|
177
|
-
let isPortBusy = (await checkPortStatus(port, LOCALHOST)) === 'open';
|
|
177
|
+
let isPortBusy = (await checkPortStatus(Number(port), LOCALHOST)) === 'open';
|
|
178
178
|
if (isPortBusy) {
|
|
179
179
|
log.warn(`Port #${port} is busy. Did you quit the previous driver session(s) properly?`);
|
|
180
180
|
if (!_.isEmpty(connectionsOnPort)) {
|
|
@@ -187,7 +187,7 @@ class DeviceConnectionsFactory {
|
|
|
187
187
|
await waitForCondition(
|
|
188
188
|
async () => {
|
|
189
189
|
try {
|
|
190
|
-
if ((await checkPortStatus(port, LOCALHOST)) !== 'open') {
|
|
190
|
+
if ((await checkPortStatus(Number(port), LOCALHOST)) !== 'open') {
|
|
191
191
|
log.info(
|
|
192
192
|
`Port #${port} has been successfully released after ` +
|
|
193
193
|
`${timer.getDuration().asMilliSeconds.toFixed(0)}ms`,
|
|
@@ -221,7 +221,10 @@ class DeviceConnectionsFactory {
|
|
|
221
221
|
}
|
|
222
222
|
const currentKey = this._toKey(udid, port);
|
|
223
223
|
if (usePortForwarding) {
|
|
224
|
-
|
|
224
|
+
if (!_.isInteger(devicePort)) {
|
|
225
|
+
throw new Error('devicePort is required when usePortForwarding is true');
|
|
226
|
+
}
|
|
227
|
+
const iproxy = new iProxy(udid, port, Number(devicePort));
|
|
225
228
|
try {
|
|
226
229
|
await iproxy.start();
|
|
227
230
|
this._connectionsMapping[currentKey] = {iproxy};
|
|
@@ -239,7 +242,7 @@ class DeviceConnectionsFactory {
|
|
|
239
242
|
log.info(`Successfully requested the connection for ${currentKey}`);
|
|
240
243
|
}
|
|
241
244
|
|
|
242
|
-
releaseConnection(udid = null, port = null) {
|
|
245
|
+
releaseConnection(udid: string | null = null, port: string | number | null = null): void {
|
|
243
246
|
if (!udid && !port) {
|
|
244
247
|
log.warn(
|
|
245
248
|
'Neither device UDID nor local port is set. ' +
|
|
@@ -261,9 +264,42 @@ class DeviceConnectionsFactory {
|
|
|
261
264
|
}
|
|
262
265
|
log.debug(`Cached connections count: ${_.size(this._connectionsMapping)}`);
|
|
263
266
|
}
|
|
267
|
+
|
|
268
|
+
private _udidAsToken(udid?: string | null): string {
|
|
269
|
+
return `${util.hasValue(udid) ? udid : ''}${SPLITTER}`;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
private _portAsToken(port?: string | number | null): string {
|
|
273
|
+
return `${SPLITTER}${util.hasValue(port) ? port : ''}`;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
private _toKey(udid: string | null = null, port: string | number | null = null): string {
|
|
277
|
+
return `${util.hasValue(udid) ? udid : ''}${SPLITTER}${util.hasValue(port) ? port : ''}`;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
private _releaseProxiedConnections(connectionKeys: string[]): string[] {
|
|
281
|
+
const keys = connectionKeys.filter((k) => _.has(this._connectionsMapping[k], 'iproxy'));
|
|
282
|
+
for (const key of keys) {
|
|
283
|
+
log.info(`Releasing the listener for '${key}'`);
|
|
284
|
+
try {
|
|
285
|
+
this._connectionsMapping[key].iproxy?.stop();
|
|
286
|
+
} catch (e) {
|
|
287
|
+
log.debug(e);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
return keys;
|
|
291
|
+
}
|
|
264
292
|
}
|
|
265
293
|
|
|
266
|
-
const DEVICE_CONNECTIONS_FACTORY = new DeviceConnectionsFactory();
|
|
294
|
+
export const DEVICE_CONNECTIONS_FACTORY = new DeviceConnectionsFactory();
|
|
295
|
+
|
|
296
|
+
interface ConnectionMapping {
|
|
297
|
+
[key: string]: {
|
|
298
|
+
iproxy?: iProxy;
|
|
299
|
+
};
|
|
300
|
+
}
|
|
267
301
|
|
|
268
|
-
|
|
269
|
-
|
|
302
|
+
interface RequestConnectionOptions {
|
|
303
|
+
usePortForwarding?: boolean;
|
|
304
|
+
devicePort?: number | null;
|
|
305
|
+
}
|
|
@@ -2,13 +2,13 @@ import {fs, tempDir, util} from 'appium/support';
|
|
|
2
2
|
import B from 'bluebird';
|
|
3
3
|
import path from 'path';
|
|
4
4
|
import _ from 'lodash';
|
|
5
|
-
import {Pyidevice} from '../
|
|
5
|
+
import {Pyidevice} from '../clients/py-ios-device-client';
|
|
6
6
|
import {IOSLog} from './ios-log';
|
|
7
7
|
import { toLogEntry, grepFile } from './helpers';
|
|
8
8
|
import type { AppiumLogger } from '@appium/types';
|
|
9
|
-
import type { BaseDeviceClient } from '../
|
|
9
|
+
import type { BaseDeviceClient } from '../clients/base-device-client';
|
|
10
10
|
import type { Simulator } from 'appium-ios-simulator';
|
|
11
|
-
import type { LogEntry } from '
|
|
11
|
+
import type { LogEntry } from '../../commands/types';
|
|
12
12
|
|
|
13
13
|
// The file format has been changed from '.crash' to '.ips' since Monterey.
|
|
14
14
|
const CRASH_REPORTS_GLOB_PATTERN = '**/*.@(crash|ips)';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {EventEmitter} from 'events';
|
|
2
2
|
import { LRUCache } from 'lru-cache';
|
|
3
|
-
import type { LogEntry } from '
|
|
3
|
+
import type { LogEntry } from '../../commands/types';
|
|
4
4
|
import type { AppiumLogger } from '@appium/types';
|
|
5
5
|
import {logger} from 'appium/support';
|
|
6
6
|
|