appium-xcuitest-driver 10.2.2 → 10.4.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/commands/active-app-info.d.ts +9 -0
- package/build/lib/commands/active-app-info.d.ts.map +1 -0
- package/build/lib/commands/active-app-info.js +14 -0
- package/build/lib/commands/active-app-info.js.map +1 -0
- package/build/lib/commands/alert.d.ts +42 -45
- package/build/lib/commands/alert.d.ts.map +1 -1
- package/build/lib/commands/alert.js +66 -62
- package/build/lib/commands/alert.js.map +1 -1
- package/build/lib/commands/app-management.d.ts +150 -153
- package/build/lib/commands/app-management.d.ts.map +1 -1
- package/build/lib/commands/app-management.js +300 -286
- package/build/lib/commands/app-management.js.map +1 -1
- package/build/lib/commands/app-strings.d.ts +14 -17
- package/build/lib/commands/app-strings.d.ts.map +1 -1
- package/build/lib/commands/app-strings.js +23 -24
- package/build/lib/commands/app-strings.js.map +1 -1
- package/build/lib/commands/appearance.d.ts +19 -22
- package/build/lib/commands/appearance.d.ts.map +1 -1
- package/build/lib/commands/appearance.js +56 -56
- package/build/lib/commands/appearance.js.map +1 -1
- package/build/lib/commands/audit.d.ts +22 -17
- package/build/lib/commands/audit.d.ts.map +1 -1
- package/build/lib/commands/audit.js +17 -18
- package/build/lib/commands/audit.js.map +1 -1
- package/build/lib/commands/battery.d.ts +11 -14
- package/build/lib/commands/battery.d.ts.map +1 -1
- package/build/lib/commands/battery.js +36 -37
- package/build/lib/commands/battery.js.map +1 -1
- package/build/lib/commands/biometric.d.ts +30 -33
- package/build/lib/commands/biometric.d.ts.map +1 -1
- package/build/lib/commands/biometric.js +42 -41
- package/build/lib/commands/biometric.js.map +1 -1
- package/build/lib/commands/certificate.d.ts +48 -45
- package/build/lib/commands/certificate.d.ts.map +1 -1
- package/build/lib/commands/certificate.js +218 -205
- package/build/lib/commands/certificate.js.map +1 -1
- package/build/lib/commands/clipboard.d.ts +19 -22
- package/build/lib/commands/clipboard.d.ts.map +1 -1
- package/build/lib/commands/clipboard.js +30 -30
- package/build/lib/commands/clipboard.js.map +1 -1
- package/build/lib/commands/condition.d.ts +49 -26
- package/build/lib/commands/condition.d.ts.map +1 -1
- package/build/lib/commands/condition.js +87 -86
- package/build/lib/commands/condition.js.map +1 -1
- package/build/lib/commands/content-size.d.ts +26 -29
- package/build/lib/commands/content-size.d.ts.map +1 -1
- package/build/lib/commands/content-size.js +36 -36
- package/build/lib/commands/content-size.js.map +1 -1
- package/build/lib/commands/context.d.ts +161 -108
- package/build/lib/commands/context.d.ts.map +1 -1
- package/build/lib/commands/context.js +530 -517
- package/build/lib/commands/context.js.map +1 -1
- package/build/lib/commands/deviceInfo.d.ts +9 -12
- package/build/lib/commands/deviceInfo.d.ts.map +1 -1
- package/build/lib/commands/deviceInfo.js +17 -18
- package/build/lib/commands/deviceInfo.js.map +1 -1
- package/build/lib/commands/element.d.ts +102 -105
- package/build/lib/commands/element.d.ts.map +1 -1
- package/build/lib/commands/element.js +337 -323
- package/build/lib/commands/element.js.map +1 -1
- package/build/lib/commands/execute.d.ts +24 -19
- package/build/lib/commands/execute.d.ts.map +1 -1
- package/build/lib/commands/execute.js +63 -62
- package/build/lib/commands/execute.js.map +1 -1
- package/build/lib/commands/file-movement.d.ts +77 -80
- package/build/lib/commands/file-movement.d.ts.map +1 -1
- package/build/lib/commands/file-movement.js +130 -124
- package/build/lib/commands/file-movement.js.map +1 -1
- package/build/lib/commands/find.d.ts +18 -21
- package/build/lib/commands/find.d.ts.map +1 -1
- package/build/lib/commands/find.js +158 -156
- package/build/lib/commands/find.js.map +1 -1
- package/build/lib/commands/general.d.ts +124 -116
- package/build/lib/commands/general.d.ts.map +1 -1
- package/build/lib/commands/general.js +248 -232
- package/build/lib/commands/general.js.map +1 -1
- package/build/lib/commands/geolocation.d.ts +43 -46
- package/build/lib/commands/geolocation.d.ts.map +1 -1
- package/build/lib/commands/geolocation.js +10 -11
- package/build/lib/commands/geolocation.js.map +1 -1
- package/build/lib/commands/gesture.d.ts +273 -276
- package/build/lib/commands/gesture.d.ts.map +1 -1
- package/build/lib/commands/gesture.js +506 -492
- package/build/lib/commands/gesture.js.map +1 -1
- package/build/lib/commands/increase-contrast.d.ts +20 -23
- package/build/lib/commands/increase-contrast.d.ts.map +1 -1
- package/build/lib/commands/increase-contrast.js +30 -30
- package/build/lib/commands/increase-contrast.js.map +1 -1
- package/build/lib/commands/iohid.d.ts +1370 -1373
- package/build/lib/commands/iohid.d.ts.map +1 -1
- package/build/lib/commands/iohid.js +30 -31
- package/build/lib/commands/iohid.js.map +1 -1
- package/build/lib/commands/keyboard.d.ts +29 -32
- package/build/lib/commands/keyboard.d.ts.map +1 -1
- package/build/lib/commands/keyboard.js +53 -51
- package/build/lib/commands/keyboard.js.map +1 -1
- package/build/lib/commands/keychains.d.ts +9 -12
- package/build/lib/commands/keychains.d.ts.map +1 -1
- package/build/lib/commands/keychains.js +13 -14
- package/build/lib/commands/keychains.js.map +1 -1
- package/build/lib/commands/localization.d.ts +16 -19
- package/build/lib/commands/localization.d.ts.map +1 -1
- package/build/lib/commands/localization.js +25 -26
- package/build/lib/commands/localization.js.map +1 -1
- package/build/lib/commands/location.d.ts +36 -39
- package/build/lib/commands/location.d.ts.map +1 -1
- package/build/lib/commands/location.js +99 -98
- package/build/lib/commands/location.js.map +1 -1
- package/build/lib/commands/lock.d.ts +21 -24
- package/build/lib/commands/lock.d.ts.map +1 -1
- package/build/lib/commands/lock.js +39 -38
- package/build/lib/commands/lock.js.map +1 -1
- package/build/lib/commands/log.d.ts +43 -37
- package/build/lib/commands/log.d.ts.map +1 -1
- package/build/lib/commands/log.js +174 -171
- package/build/lib/commands/log.js.map +1 -1
- package/build/lib/commands/memory.d.ts +9 -12
- package/build/lib/commands/memory.d.ts.map +1 -1
- package/build/lib/commands/memory.js +37 -39
- package/build/lib/commands/memory.js.map +1 -1
- package/build/lib/commands/navigation.d.ts +30 -33
- package/build/lib/commands/navigation.d.ts.map +1 -1
- package/build/lib/commands/navigation.js +92 -92
- package/build/lib/commands/navigation.js.map +1 -1
- package/build/lib/commands/notifications.d.ts +26 -29
- package/build/lib/commands/notifications.d.ts.map +1 -1
- package/build/lib/commands/notifications.js +53 -53
- package/build/lib/commands/notifications.js.map +1 -1
- package/build/lib/commands/pasteboard.d.ts +21 -24
- package/build/lib/commands/pasteboard.d.ts.map +1 -1
- package/build/lib/commands/pasteboard.js +37 -37
- package/build/lib/commands/pasteboard.js.map +1 -1
- package/build/lib/commands/pcap.d.ts +39 -26
- package/build/lib/commands/pcap.d.ts.map +1 -1
- package/build/lib/commands/pcap.js +81 -81
- package/build/lib/commands/pcap.js.map +1 -1
- package/build/lib/commands/performance.d.ts +63 -44
- package/build/lib/commands/performance.d.ts.map +1 -1
- package/build/lib/commands/performance.js +105 -105
- package/build/lib/commands/performance.js.map +1 -1
- package/build/lib/commands/permissions.d.ts +33 -36
- package/build/lib/commands/permissions.d.ts.map +1 -1
- package/build/lib/commands/permissions.js +66 -65
- package/build/lib/commands/permissions.js.map +1 -1
- package/build/lib/commands/proxy-helper.d.ts +12 -15
- package/build/lib/commands/proxy-helper.d.ts.map +1 -1
- package/build/lib/commands/proxy-helper.js +53 -54
- package/build/lib/commands/proxy-helper.js.map +1 -1
- package/build/lib/commands/record-audio.d.ts +49 -29
- package/build/lib/commands/record-audio.d.ts.map +1 -1
- package/build/lib/commands/record-audio.js +100 -104
- package/build/lib/commands/record-audio.js.map +1 -1
- package/build/lib/commands/recordscreen.d.ts +54 -18
- package/build/lib/commands/recordscreen.d.ts.map +1 -1
- package/build/lib/commands/recordscreen.js +127 -129
- package/build/lib/commands/recordscreen.js.map +1 -1
- package/build/lib/commands/screenshots.d.ts +14 -17
- package/build/lib/commands/screenshots.d.ts.map +1 -1
- package/build/lib/commands/screenshots.js +108 -107
- package/build/lib/commands/screenshots.js.map +1 -1
- package/build/lib/commands/simctl.d.ts +11 -14
- package/build/lib/commands/simctl.d.ts.map +1 -1
- package/build/lib/commands/simctl.js +23 -26
- package/build/lib/commands/simctl.js.map +1 -1
- package/build/lib/commands/source.d.ts +14 -17
- package/build/lib/commands/source.d.ts.map +1 -1
- package/build/lib/commands/source.js +40 -43
- package/build/lib/commands/source.js.map +1 -1
- package/build/lib/commands/timeouts.d.ts +44 -33
- package/build/lib/commands/timeouts.d.ts.map +1 -1
- package/build/lib/commands/timeouts.js +65 -63
- package/build/lib/commands/timeouts.js.map +1 -1
- package/build/lib/commands/web.d.ts +247 -197
- package/build/lib/commands/web.d.ts.map +1 -1
- package/build/lib/commands/web.js +815 -786
- package/build/lib/commands/web.js.map +1 -1
- package/build/lib/commands/xctest-record-screen.d.ts +63 -66
- package/build/lib/commands/xctest-record-screen.d.ts.map +1 -1
- package/build/lib/commands/xctest-record-screen.js +103 -102
- package/build/lib/commands/xctest-record-screen.js.map +1 -1
- package/build/lib/commands/xctest.d.ts +55 -51
- package/build/lib/commands/xctest.d.ts.map +1 -1
- package/build/lib/commands/xctest.js +116 -117
- package/build/lib/commands/xctest.js.map +1 -1
- package/build/lib/driver.d.ts +278 -1597
- package/build/lib/driver.d.ts.map +1 -1
- package/build/lib/driver.js +320 -236
- package/build/lib/driver.js.map +1 -1
- package/build/lib/execute-method-map.d.ts.map +1 -1
- package/build/lib/execute-method-map.js +9 -0
- package/build/lib/execute-method-map.js.map +1 -1
- package/build/lib/real-device.d.ts +1 -1
- package/build/lib/real-device.d.ts.map +1 -1
- package/build/lib/real-device.js +2 -2
- package/build/lib/real-device.js.map +1 -1
- package/lib/commands/active-app-info.js +12 -0
- package/lib/commands/alert.js +68 -65
- package/lib/commands/app-management.js +308 -301
- package/lib/commands/app-strings.js +24 -26
- package/lib/commands/appearance.js +54 -56
- package/lib/commands/audit.js +18 -20
- package/lib/commands/battery.js +35 -37
- package/lib/commands/biometric.js +44 -46
- package/lib/commands/certificate.js +226 -215
- package/lib/commands/clipboard.js +30 -32
- package/lib/commands/condition.js +98 -100
- package/lib/commands/content-size.js +36 -38
- package/lib/commands/context.js +495 -490
- package/lib/commands/deviceInfo.js +19 -20
- package/lib/commands/element.js +367 -357
- package/lib/commands/execute.js +72 -72
- package/lib/commands/file-movement.js +132 -134
- package/lib/commands/find.js +160 -159
- package/lib/commands/general.js +238 -231
- package/lib/commands/geolocation.js +6 -14
- package/lib/commands/gesture.js +525 -515
- package/lib/commands/increase-contrast.js +30 -32
- package/lib/commands/iohid.js +32 -34
- package/lib/commands/keyboard.js +49 -51
- package/lib/commands/keychains.js +12 -14
- package/lib/commands/localization.js +24 -26
- package/lib/commands/location.js +102 -104
- package/lib/commands/lock.js +38 -38
- package/lib/commands/log.js +197 -198
- package/lib/commands/memory.js +40 -43
- package/lib/commands/navigation.js +96 -100
- package/lib/commands/notifications.js +57 -59
- package/lib/commands/pasteboard.js +37 -39
- package/lib/commands/pcap.js +84 -86
- package/lib/commands/performance.js +132 -133
- package/lib/commands/permissions.js +67 -69
- package/lib/commands/proxy-helper.js +60 -61
- package/lib/commands/record-audio.js +115 -120
- package/lib/commands/recordscreen.js +145 -149
- package/lib/commands/screenshots.js +116 -116
- package/lib/commands/simctl.js +25 -29
- package/lib/commands/source.js +42 -46
- package/lib/commands/timeouts.js +59 -63
- package/lib/commands/web.js +878 -858
- package/lib/commands/xctest-record-screen.js +103 -105
- package/lib/commands/xctest.js +134 -139
- package/lib/driver.js +288 -236
- package/lib/execute-method-map.ts +9 -0
- package/lib/real-device.js +2 -2
- package/npm-shrinkwrap.json +440 -76
- package/package.json +2 -1
- package/build/lib/commands/activeAppInfo.d.ts +0 -12
- package/build/lib/commands/activeAppInfo.d.ts.map +0 -1
- package/build/lib/commands/activeAppInfo.js +0 -15
- package/build/lib/commands/activeAppInfo.js.map +0 -1
- package/build/lib/commands/index.d.ts +0 -96
- package/build/lib/commands/index.d.ts.map +0 -1
- package/build/lib/commands/index.js +0 -100
- package/build/lib/commands/index.js.map +0 -1
- package/build/lib/real-device-clients/devicectl.d.ts +0 -204
- package/build/lib/real-device-clients/devicectl.d.ts.map +0 -1
- package/build/lib/real-device-clients/devicectl.js +0 -264
- package/build/lib/real-device-clients/devicectl.js.map +0 -1
- package/lib/commands/activeAppInfo.js +0 -14
- package/lib/commands/index.js +0 -95
- package/lib/real-device-clients/devicectl.js +0 -291
|
@@ -3,6 +3,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.supportedLogTypes = void 0;
|
|
7
|
+
exports.extractLogs = extractLogs;
|
|
8
|
+
exports.startLogCapture = startLogCapture;
|
|
9
|
+
exports.mobileStartLogsBroadcast = mobileStartLogsBroadcast;
|
|
10
|
+
exports.mobileStopLogsBroadcast = mobileStopLogsBroadcast;
|
|
6
11
|
exports.assignBiDiLogListener = assignBiDiLogListener;
|
|
7
12
|
const lodash_1 = __importDefault(require("lodash"));
|
|
8
13
|
const bluebird_1 = __importDefault(require("bluebird"));
|
|
@@ -25,16 +30,6 @@ const models_1 = require("./bidi/models");
|
|
|
25
30
|
const WEBSOCKET_ENDPOINT = (sessionId) => `${driver_1.DEFAULT_WS_PATHNAME_PREFIX}/session/${sessionId}/appium/device/syslog`;
|
|
26
31
|
const COLOR_CODE_PATTERN = /\u001b\[(\d+(;\d+)*)?m/g; // eslint-disable-line no-control-regex
|
|
27
32
|
const GET_SERVER_LOGS_FEATURE = 'get_server_logs';
|
|
28
|
-
/**
|
|
29
|
-
*
|
|
30
|
-
* @param {Object} x
|
|
31
|
-
* @returns {import('./types').LogEntry}
|
|
32
|
-
*/
|
|
33
|
-
function nativeLogEntryToSeleniumEntry(x) {
|
|
34
|
-
const msg = lodash_1.default.isEmpty(x.prefix) ? x.message : `[${x.prefix}] ${x.message}`;
|
|
35
|
-
return (0, helpers_1.toLogEntry)(lodash_1.default.replace(msg, COLOR_CODE_PATTERN, ''),
|
|
36
|
-
/** @type {any} */ (x).timestamp ?? Date.now());
|
|
37
|
-
}
|
|
38
33
|
/**
|
|
39
34
|
* @type {import('@appium/types').LogDefRecord}
|
|
40
35
|
* @privateRemarks The return types for these getters should be specified
|
|
@@ -76,181 +71,179 @@ const LOG_NAMES_TO_CAPABILITY_NAMES_MAP = {
|
|
|
76
71
|
safariNetwork: 'showSafariNetworkLog',
|
|
77
72
|
enablePerformanceLogging: 'enablePerformanceLogging',
|
|
78
73
|
};
|
|
79
|
-
exports.
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
74
|
+
exports.supportedLogTypes = SUPPORTED_LOG_TYPES;
|
|
75
|
+
/**
|
|
76
|
+
*
|
|
77
|
+
* @param {XCUITestDriverLogTypes} logType
|
|
78
|
+
* @param {Partial<Record<XCUITestDriverLogTypes,{getLogs(): Promise<any>}>>} [logsContainer]
|
|
79
|
+
* @this {XCUITestDriver}
|
|
80
|
+
*/
|
|
81
|
+
async function extractLogs(logType, logsContainer = {}) {
|
|
82
|
+
// make sure that we have logs at all
|
|
83
|
+
// otherwise it's not been initialized
|
|
84
|
+
if (lodash_1.default.isEmpty(logsContainer)) {
|
|
85
|
+
throw new Error('No logs currently available. Is the device/simulator started?');
|
|
86
|
+
}
|
|
87
|
+
// If logs captured successfully send response with data, else send error
|
|
88
|
+
const logObject = logsContainer[logType];
|
|
89
|
+
if (logObject) {
|
|
90
|
+
return await logObject.getLogs();
|
|
91
|
+
}
|
|
92
|
+
if (logType in LOG_NAMES_TO_CAPABILITY_NAMES_MAP) {
|
|
93
|
+
throw new Error(`${logType} logs are not enabled. Make sure you've set a proper value ` +
|
|
94
|
+
`to the 'appium:${LOG_NAMES_TO_CAPABILITY_NAMES_MAP[logType]}' capability.`);
|
|
95
|
+
}
|
|
96
|
+
throw new Error(`No logs of type '${logType}' found. Supported log types are: ${lodash_1.default.keys(SUPPORTED_LOG_TYPES)}.`);
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* @this {XCUITestDriver}
|
|
100
|
+
*/
|
|
101
|
+
async function startLogCapture() {
|
|
102
|
+
this.logs = this.logs || {};
|
|
103
|
+
if (!lodash_1.default.isUndefined(this.logs.syslog) && this.logs.syslog.isCapturing) {
|
|
104
|
+
this.log.warn('Trying to start iOS log capture but it has already started!');
|
|
105
|
+
return true;
|
|
106
|
+
}
|
|
107
|
+
if (lodash_1.default.isUndefined(this.logs.syslog)) {
|
|
108
|
+
[this.logs.crashlog,] = assignBiDiLogListener.bind(this)(new ios_crash_log_1.IOSCrashLog({
|
|
109
|
+
sim: /** @type {import('appium-ios-simulator').Simulator} */ (this.device),
|
|
110
|
+
udid: this.isRealDevice() ? this.opts.udid : undefined,
|
|
111
|
+
log: this.log,
|
|
112
|
+
}), {
|
|
113
|
+
type: 'crashlog',
|
|
114
|
+
});
|
|
115
|
+
[this.logs.syslog,] = assignBiDiLogListener.bind(this)(this.isRealDevice()
|
|
116
|
+
? new ios_device_log_1.IOSDeviceLog({
|
|
117
|
+
udid: this.opts.udid,
|
|
118
|
+
showLogs: this.opts.showIOSLog,
|
|
119
|
+
log: this.log,
|
|
120
|
+
})
|
|
121
|
+
: new ios_simulator_log_1.IOSSimulatorLog({
|
|
115
122
|
sim: /** @type {import('appium-ios-simulator').Simulator} */ (this.device),
|
|
116
|
-
|
|
123
|
+
showLogs: this.opts.showIOSLog,
|
|
124
|
+
iosSimulatorLogsPredicate: this.opts.iosSimulatorLogsPredicate,
|
|
125
|
+
simulatorLogLevel: this.opts.simulatorLogLevel,
|
|
117
126
|
log: this.log,
|
|
127
|
+
iosSyslogFile: this.opts.iosSyslogFile
|
|
118
128
|
}), {
|
|
119
|
-
|
|
129
|
+
type: 'syslog',
|
|
130
|
+
});
|
|
131
|
+
if (lodash_1.default.isBoolean(this.opts.showSafariConsoleLog)) {
|
|
132
|
+
[this.logs.safariConsole,] = assignBiDiLogListener.bind(this)(new safari_console_log_1.SafariConsoleLog({
|
|
133
|
+
showLogs: this.opts.showSafariConsoleLog,
|
|
134
|
+
log: this.log,
|
|
135
|
+
}), {
|
|
136
|
+
type: 'safariConsole',
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
if (lodash_1.default.isBoolean(this.opts.showSafariNetworkLog)) {
|
|
140
|
+
[this.logs.safariNetwork,] = assignBiDiLogListener.bind(this)(new safari_network_log_1.SafariNetworkLog({
|
|
141
|
+
showLogs: this.opts.showSafariNetworkLog,
|
|
142
|
+
log: this.log,
|
|
143
|
+
}), {
|
|
144
|
+
type: 'safariNetwork',
|
|
120
145
|
});
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
: new ios_simulator_log_1.IOSSimulatorLog({
|
|
128
|
-
sim: /** @type {import('appium-ios-simulator').Simulator} */ (this.device),
|
|
129
|
-
showLogs: this.opts.showIOSLog,
|
|
130
|
-
iosSimulatorLogsPredicate: this.opts.iosSimulatorLogsPredicate,
|
|
131
|
-
simulatorLogLevel: this.opts.simulatorLogLevel,
|
|
132
|
-
log: this.log,
|
|
133
|
-
iosSyslogFile: this.opts.iosSyslogFile
|
|
134
|
-
}), {
|
|
135
|
-
type: 'syslog',
|
|
146
|
+
}
|
|
147
|
+
if (this.isFeatureEnabled(GET_SERVER_LOGS_FEATURE)) {
|
|
148
|
+
[, this._bidiServerLogListener] = assignBiDiLogListener.bind(this)(this.log.unwrap(), {
|
|
149
|
+
type: 'server',
|
|
150
|
+
srcEventName: 'log',
|
|
151
|
+
entryTransformer: nativeLogEntryToSeleniumEntry,
|
|
136
152
|
});
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
showLogs: this.opts.showSafariNetworkLog,
|
|
148
|
-
log: this.log,
|
|
149
|
-
}), {
|
|
150
|
-
type: 'safariNetwork',
|
|
151
|
-
});
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
let didStartSyslog = false;
|
|
156
|
+
/** @type {Promise[]} */
|
|
157
|
+
const promises = [
|
|
158
|
+
(async () => {
|
|
159
|
+
try {
|
|
160
|
+
await this.logs.syslog?.startCapture();
|
|
161
|
+
didStartSyslog = true;
|
|
162
|
+
this.eventEmitter.emit('syslogStarted', this.logs.syslog);
|
|
152
163
|
}
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
srcEventName: 'log',
|
|
157
|
-
entryTransformer: nativeLogEntryToSeleniumEntry,
|
|
158
|
-
});
|
|
164
|
+
catch (err) {
|
|
165
|
+
this.log.debug(err.stack);
|
|
166
|
+
this.log.warn(`Continuing without capturing device logs: ${err.message}`);
|
|
159
167
|
}
|
|
168
|
+
})(),
|
|
169
|
+
this.logs.crashlog?.startCapture() ?? bluebird_1.default.resolve(),
|
|
170
|
+
];
|
|
171
|
+
await bluebird_1.default.all(promises);
|
|
172
|
+
return didStartSyslog;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Starts an iOS system logs broadcast websocket.
|
|
176
|
+
*
|
|
177
|
+
* The websocket listens on the same host and port as Appium. The endpoint created is `/ws/session/:sessionId:/appium/syslog`.
|
|
178
|
+
*
|
|
179
|
+
* If the websocket is already running, this command does nothing.
|
|
180
|
+
*
|
|
181
|
+
* Each connected webcoket listener will receive syslog lines as soon as they are visible to Appium.
|
|
182
|
+
* @see https://appiumpro.com/editions/55-using-mobile-execution-commands-to-continuously-stream-device-logs-with-appium
|
|
183
|
+
* @returns {Promise<void>}
|
|
184
|
+
* @this {XCUITestDriver}
|
|
185
|
+
*/
|
|
186
|
+
async function mobileStartLogsBroadcast() {
|
|
187
|
+
const pathname = WEBSOCKET_ENDPOINT(/** @type {string} */ (this.sessionId));
|
|
188
|
+
if (!lodash_1.default.isEmpty(await /** @type {import('@appium/types').AppiumServer} */ (this.server).getWebSocketHandlers(pathname))) {
|
|
189
|
+
this.log.debug(`The system logs broadcasting web socket server is already listening at ${pathname}`);
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
this.log.info(`Assigning system logs broadcasting web socket server to ${pathname}`);
|
|
193
|
+
// https://github.com/websockets/ws/blob/master/doc/ws.md
|
|
194
|
+
const wss = new ws_1.default.Server({
|
|
195
|
+
noServer: true,
|
|
196
|
+
});
|
|
197
|
+
wss.on('connection', (ws, req) => {
|
|
198
|
+
if (req) {
|
|
199
|
+
const remoteIp = lodash_1.default.isEmpty(req.headers['x-forwarded-for'])
|
|
200
|
+
? req.connection?.remoteAddress
|
|
201
|
+
: req.headers['x-forwarded-for'];
|
|
202
|
+
this.log.debug(`Established a new system logs listener web socket connection from ${remoteIp}`);
|
|
160
203
|
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
this.eventEmitter.emit('syslogStarted', this.logs.syslog);
|
|
169
|
-
}
|
|
170
|
-
catch (err) {
|
|
171
|
-
this.log.debug(err.stack);
|
|
172
|
-
this.log.warn(`Continuing without capturing device logs: ${err.message}`);
|
|
204
|
+
else {
|
|
205
|
+
this.log.debug('Established a new system logs listener web socket connection');
|
|
206
|
+
}
|
|
207
|
+
if (lodash_1.default.isEmpty(this._syslogWebsocketListener)) {
|
|
208
|
+
this._syslogWebsocketListener = (logRecord) => {
|
|
209
|
+
if (ws?.readyState === ws_1.default.OPEN) {
|
|
210
|
+
ws.send(logRecord.message);
|
|
173
211
|
}
|
|
174
|
-
}
|
|
175
|
-
this.logs.crashlog?.startCapture() ?? bluebird_1.default.resolve(),
|
|
176
|
-
];
|
|
177
|
-
await bluebird_1.default.all(promises);
|
|
178
|
-
return didStartSyslog;
|
|
179
|
-
},
|
|
180
|
-
/**
|
|
181
|
-
* Starts an iOS system logs broadcast websocket.
|
|
182
|
-
*
|
|
183
|
-
* The websocket listens on the same host and port as Appium. The endpoint created is `/ws/session/:sessionId:/appium/syslog`.
|
|
184
|
-
*
|
|
185
|
-
* If the websocket is already running, this command does nothing.
|
|
186
|
-
*
|
|
187
|
-
* Each connected webcoket listener will receive syslog lines as soon as they are visible to Appium.
|
|
188
|
-
* @see https://appiumpro.com/editions/55-using-mobile-execution-commands-to-continuously-stream-device-logs-with-appium
|
|
189
|
-
* @returns {Promise<void>}
|
|
190
|
-
* @this {XCUITestDriver}
|
|
191
|
-
*/
|
|
192
|
-
async mobileStartLogsBroadcast() {
|
|
193
|
-
const pathname = WEBSOCKET_ENDPOINT(/** @type {string} */ (this.sessionId));
|
|
194
|
-
if (!lodash_1.default.isEmpty(await /** @type {import('@appium/types').AppiumServer} */ (this.server).getWebSocketHandlers(pathname))) {
|
|
195
|
-
this.log.debug(`The system logs broadcasting web socket server is already listening at ${pathname}`);
|
|
196
|
-
return;
|
|
212
|
+
};
|
|
197
213
|
}
|
|
198
|
-
this.
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
wss.on('connection', (ws, req) => {
|
|
204
|
-
if (req) {
|
|
205
|
-
const remoteIp = lodash_1.default.isEmpty(req.headers['x-forwarded-for'])
|
|
206
|
-
? req.connection?.remoteAddress
|
|
207
|
-
: req.headers['x-forwarded-for'];
|
|
208
|
-
this.log.debug(`Established a new system logs listener web socket connection from ${remoteIp}`);
|
|
214
|
+
this.logs.syslog?.on('output', this._syslogWebsocketListener);
|
|
215
|
+
ws.on('close', (code, reason) => {
|
|
216
|
+
if (!lodash_1.default.isEmpty(this._syslogWebsocketListener)) {
|
|
217
|
+
this.logs.syslog?.removeListener('output', this._syslogWebsocketListener);
|
|
218
|
+
this._syslogWebsocketListener = null;
|
|
209
219
|
}
|
|
210
|
-
|
|
211
|
-
|
|
220
|
+
let closeMsg = 'System logs listener web socket is closed.';
|
|
221
|
+
if (!lodash_1.default.isEmpty(code)) {
|
|
222
|
+
closeMsg += ` Code: ${code}.`;
|
|
212
223
|
}
|
|
213
|
-
if (lodash_1.default.isEmpty(
|
|
214
|
-
|
|
215
|
-
if (ws?.readyState === ws_1.default.OPEN) {
|
|
216
|
-
ws.send(logRecord.message);
|
|
217
|
-
}
|
|
218
|
-
};
|
|
224
|
+
if (!lodash_1.default.isEmpty(reason)) {
|
|
225
|
+
closeMsg += ` Reason: ${reason.toString()}.`;
|
|
219
226
|
}
|
|
220
|
-
this.
|
|
221
|
-
ws.on('close', (code, reason) => {
|
|
222
|
-
if (!lodash_1.default.isEmpty(this._syslogWebsocketListener)) {
|
|
223
|
-
this.logs.syslog?.removeListener('output', this._syslogWebsocketListener);
|
|
224
|
-
this._syslogWebsocketListener = null;
|
|
225
|
-
}
|
|
226
|
-
let closeMsg = 'System logs listener web socket is closed.';
|
|
227
|
-
if (!lodash_1.default.isEmpty(code)) {
|
|
228
|
-
closeMsg += ` Code: ${code}.`;
|
|
229
|
-
}
|
|
230
|
-
if (!lodash_1.default.isEmpty(reason)) {
|
|
231
|
-
closeMsg += ` Reason: ${reason.toString()}.`;
|
|
232
|
-
}
|
|
233
|
-
this.log.debug(closeMsg);
|
|
234
|
-
});
|
|
227
|
+
this.log.debug(closeMsg);
|
|
235
228
|
});
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
}
|
|
253
|
-
}
|
|
229
|
+
});
|
|
230
|
+
await /** @type {AppiumServer} */ (this.server).addWebSocketHandler(pathname,
|
|
231
|
+
/** @type {import('@appium/types').WSServer} */ (wss));
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Stops the syslog broadcasting wesocket server previously started by `mobile: startLogsBroadcast`.
|
|
235
|
+
* If no websocket server is running, this command does nothing.
|
|
236
|
+
* @this {XCUITestDriver}
|
|
237
|
+
* @returns {Promise<void>}
|
|
238
|
+
*/
|
|
239
|
+
async function mobileStopLogsBroadcast() {
|
|
240
|
+
const pathname = WEBSOCKET_ENDPOINT(/** @type {string} */ (this.sessionId));
|
|
241
|
+
if (lodash_1.default.isEmpty(await /** @type {AppiumServer} */ (this.server).getWebSocketHandlers(pathname))) {
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
this.log.debug('Stopping the system logs broadcasting web socket server');
|
|
245
|
+
await /** @type {AppiumServer} */ (this.server).removeWebSocketHandler(pathname);
|
|
246
|
+
}
|
|
254
247
|
/**
|
|
255
248
|
* https://w3c.github.io/webdriver-bidi/#event-log-entryAdded
|
|
256
249
|
*
|
|
@@ -269,6 +262,16 @@ function assignBiDiLogListener(logEmitter, properties) {
|
|
|
269
262
|
logEmitter.on(srcEventName, listener);
|
|
270
263
|
return [logEmitter, listener];
|
|
271
264
|
}
|
|
265
|
+
/**
|
|
266
|
+
*
|
|
267
|
+
* @param {Object} x
|
|
268
|
+
* @returns {import('./types').LogEntry}
|
|
269
|
+
*/
|
|
270
|
+
function nativeLogEntryToSeleniumEntry(x) {
|
|
271
|
+
const msg = lodash_1.default.isEmpty(x.prefix) ? x.message : `[${x.prefix}] ${x.message}`;
|
|
272
|
+
return (0, helpers_1.toLogEntry)(lodash_1.default.replace(msg, COLOR_CODE_PATTERN, ''),
|
|
273
|
+
/** @type {any} */ (x).timestamp ?? Date.now());
|
|
274
|
+
}
|
|
272
275
|
/**
|
|
273
276
|
* @typedef {import('../driver').XCUITestDriver} XCUITestDriver
|
|
274
277
|
* @typedef {keyof typeof SUPPORTED_LOG_TYPES} XCUITestDriverLogTypes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log.js","sourceRoot":"","sources":["../../../lib/commands/log.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"log.js","sourceRoot":"","sources":["../../../lib/commands/log.js"],"names":[],"mappings":";;;;;;AA2EA,kCAqBC;AAKD,0CAqFC;AAcD,4DA2DC;AAQD,0DAQC;AAWD,sDAaC;AA3SD,oDAAuB;AACvB,wDAAyB;AACzB,0CAAyD;AACzD,+DAAwD;AACxD,uEAAgE;AAChE,iEAA0D;AAC1D,4CAA2B;AAC3B,yEAAoE;AACpE,yEAAoE;AACpE,mDAAmD;AACnD,oCAAsC;AACtC,gDAAmD;AACnD,0CAAuD;AAEvD;;;;GAIG;AACH,MAAM,kBAAkB,GAAG,CAAC,SAAS,EAAE,EAAE,CACvC,GAAG,mCAA0B,YAAY,SAAS,uBAAuB,CAAC;AAC5E,MAAM,kBAAkB,GAAG,yBAAyB,CAAC,CAAC,uCAAuC;AAC7F,MAAM,uBAAuB,GAAG,iBAAiB,CAAC;AAElD;;;GAGG;AACH,MAAM,mBAAmB,GAAG;IAC1B,MAAM,EAAE;QACN,WAAW,EAAE,+EAA+E;QAC5F,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,MAAM,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC;KACpE;IACD,QAAQ,EAAE;QACR,WAAW,EAAE,gFAAgF;QAC7F,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,MAAM,IAAI,CAAC,WAAW,CAAC,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC;KACtE;IACD,WAAW,EAAE;QACX,WAAW,EAAE,mEAAmE;QAChF,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,CA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C;IACtC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,IAAI,IAAI,CAAC,GAAG,EAAE,CAC/C,CAAC;AACJ,CAAC;AAED;;;;GAIG;AAEH;;;;;;GAMG"}
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
function mobileSendMemoryWarning(this: import("../driver").XCUITestDriver, bundleId: string): Promise<void>;
|
|
11
|
-
}
|
|
12
|
-
export default _default;
|
|
1
|
+
/**
|
|
2
|
+
* Simulates Low Memory warning on the given application
|
|
3
|
+
*
|
|
4
|
+
* @since Xcode 15
|
|
5
|
+
* @param {string} bundleId - The bundle identifier of the target app. The app must be running
|
|
6
|
+
* @this {XCUITestDriver}
|
|
7
|
+
* @throws {Error} if the app is not running or is not installed
|
|
8
|
+
*/
|
|
9
|
+
export function mobileSendMemoryWarning(this: import("../driver").XCUITestDriver, bundleId: string): Promise<void>;
|
|
13
10
|
export type XCUITestDriver = import("../driver").XCUITestDriver;
|
|
14
11
|
//# sourceMappingURL=memory.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../../../lib/commands/memory.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../../../lib/commands/memory.js"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,4FAJW,MAAM,iBAuChB;6BAGY,OAAO,WAAW,EAAE,cAAc"}
|
|
@@ -3,48 +3,46 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.mobileSendMemoryWarning = mobileSendMemoryWarning;
|
|
6
7
|
const lodash_1 = __importDefault(require("lodash"));
|
|
7
8
|
const driver_1 = require("appium/driver");
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
throw new Error('Memory warning simulation is only supported on real devices');
|
|
20
|
-
}
|
|
21
|
-
const device = /** @type {import('../real-device').RealDevice} */ (this.device);
|
|
22
|
-
/** @type {import('../real-device-clients/devicectl').AppInfo[]} */
|
|
23
|
-
const appInfos = await device.devicectl.listApps(bundleId);
|
|
24
|
-
if (lodash_1.default.isEmpty(appInfos)) {
|
|
25
|
-
throw new driver_1.errors.InvalidArgumentError(`The application identified by ${bundleId} cannot be found on the device. Is it installed?`);
|
|
26
|
-
}
|
|
27
|
-
// This regexp tries to match the process name of the main bundle executable.
|
|
28
|
-
// For example, if 'url' contains something like
|
|
29
|
-
// `file:///private/var/containers/Bundle/Application/093ACA6D-8F0B-4601-87B9-4099E43A1A20/Target.app/`
|
|
30
|
-
// and the following processes might be running:
|
|
31
|
-
// `file:///private/var/containers/Bundle/Application/093ACA6D-8F0B-4601-87B9-4099E43A1A20/Target.app/Target`
|
|
32
|
-
// `file:///private/var/containers/Bundle/Application/093ACA6D-8F0B-4601-87B9-4099E43A1A20/Target.app/PlugIns/WidgetExtension.appex/WidgetExtension`
|
|
33
|
-
// then we only want to match the first one.
|
|
34
|
-
// Unfortunately devicectl does not provide more info which would
|
|
35
|
-
// allow to connect a bundle id to a process id.
|
|
36
|
-
const pattern = new RegExp(`^${lodash_1.default.escapeRegExp(appInfos[0].url)}[^/]+$`);
|
|
37
|
-
/** @type {number[]} */
|
|
38
|
-
const pids = (await device.devicectl.listProcesses())
|
|
39
|
-
.filter(({ executable }) => pattern.test(executable))
|
|
40
|
-
.map(({ processIdentifier }) => processIdentifier);
|
|
41
|
-
if (lodash_1.default.isEmpty(pids)) {
|
|
42
|
-
throw new driver_1.errors.InvalidArgumentError(`The application identified by ${bundleId} must be running in order to simulate the Low Memory warning`);
|
|
43
|
-
}
|
|
44
|
-
this.log.info(`Emulating Low Memory warning for the process id ${pids[0]}, bundle id ${bundleId}`);
|
|
45
|
-
await device.devicectl.sendMemoryWarning(pids[0]);
|
|
9
|
+
/**
|
|
10
|
+
* Simulates Low Memory warning on the given application
|
|
11
|
+
*
|
|
12
|
+
* @since Xcode 15
|
|
13
|
+
* @param {string} bundleId - The bundle identifier of the target app. The app must be running
|
|
14
|
+
* @this {XCUITestDriver}
|
|
15
|
+
* @throws {Error} if the app is not running or is not installed
|
|
16
|
+
*/
|
|
17
|
+
async function mobileSendMemoryWarning(bundleId) {
|
|
18
|
+
if (!this.isRealDevice()) {
|
|
19
|
+
throw new Error('Memory warning simulation is only supported on real devices');
|
|
46
20
|
}
|
|
47
|
-
};
|
|
21
|
+
const device = /** @type {import('../real-device').RealDevice} */ (this.device);
|
|
22
|
+
const appInfos = await device.devicectl.listApps(bundleId);
|
|
23
|
+
if (lodash_1.default.isEmpty(appInfos)) {
|
|
24
|
+
throw new driver_1.errors.InvalidArgumentError(`The application identified by ${bundleId} cannot be found on the device. Is it installed?`);
|
|
25
|
+
}
|
|
26
|
+
// This regexp tries to match the process name of the main bundle executable.
|
|
27
|
+
// For example, if 'url' contains something like
|
|
28
|
+
// `file:///private/var/containers/Bundle/Application/093ACA6D-8F0B-4601-87B9-4099E43A1A20/Target.app/`
|
|
29
|
+
// and the following processes might be running:
|
|
30
|
+
// `file:///private/var/containers/Bundle/Application/093ACA6D-8F0B-4601-87B9-4099E43A1A20/Target.app/Target`
|
|
31
|
+
// `file:///private/var/containers/Bundle/Application/093ACA6D-8F0B-4601-87B9-4099E43A1A20/Target.app/PlugIns/WidgetExtension.appex/WidgetExtension`
|
|
32
|
+
// then we only want to match the first one.
|
|
33
|
+
// Unfortunately devicectl does not provide more info which would
|
|
34
|
+
// allow to connect a bundle id to a process id.
|
|
35
|
+
const pattern = new RegExp(`^${lodash_1.default.escapeRegExp(appInfos[0].url)}[^/]+$`);
|
|
36
|
+
/** @type {number[]} */
|
|
37
|
+
const pids = (await device.devicectl.listProcesses())
|
|
38
|
+
.filter(({ executable }) => pattern.test(executable))
|
|
39
|
+
.map(({ processIdentifier }) => processIdentifier);
|
|
40
|
+
if (lodash_1.default.isEmpty(pids)) {
|
|
41
|
+
throw new driver_1.errors.InvalidArgumentError(`The application identified by ${bundleId} must be running in order to simulate the Low Memory warning`);
|
|
42
|
+
}
|
|
43
|
+
this.log.info(`Emulating Low Memory warning for the process id ${pids[0]}, bundle id ${bundleId}`);
|
|
44
|
+
await device.devicectl.sendMemoryWarning(pids[0]);
|
|
45
|
+
}
|
|
48
46
|
/**
|
|
49
47
|
* @typedef {import('../driver').XCUITestDriver} XCUITestDriver
|
|
50
48
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory.js","sourceRoot":"","sources":["../../../lib/commands/memory.js"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"memory.js","sourceRoot":"","sources":["../../../lib/commands/memory.js"],"names":[],"mappings":";;;;;AAWA,0DAmCC;AA9CD,oDAAuB;AACvB,0CAAuC;AAEvC;;;;;;;GAOG;AACI,KAAK,UAAU,uBAAuB,CAAC,QAAQ;IACpD,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC,CAAC;IACjF,CAAC;IAED,MAAM,MAAM,GAAG,kDAAkD,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAEhF,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAC3D,IAAI,gBAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;QACxB,MAAM,IAAI,eAAM,CAAC,oBAAoB,CACnC,iCAAiC,QAAQ,kDAAkD,CAC5F,CAAC;IACJ,CAAC;IA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
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
function nativeBack(this: import("../driver").XCUITestDriver): Promise<unknown>;
|
|
32
|
-
}
|
|
33
|
-
export default _default;
|
|
1
|
+
/**
|
|
2
|
+
* @this {XCUITestDriver}
|
|
3
|
+
*/
|
|
4
|
+
export function back(this: import("../driver").XCUITestDriver): Promise<void>;
|
|
5
|
+
/**
|
|
6
|
+
* @this {XCUITestDriver}
|
|
7
|
+
*/
|
|
8
|
+
export function forward(this: import("../driver").XCUITestDriver): Promise<void>;
|
|
9
|
+
/**
|
|
10
|
+
* @this {XCUITestDriver}
|
|
11
|
+
*/
|
|
12
|
+
export function closeWindow(this: import("../driver").XCUITestDriver): Promise<any>;
|
|
13
|
+
/**
|
|
14
|
+
* Opens the given URL with the default application assigned to handle it based on the URL
|
|
15
|
+
* scheme, or the application provided as an optional parameter
|
|
16
|
+
*
|
|
17
|
+
* (Note: the version of Xcode must be 14.3+ and iOS must be 16.4+)
|
|
18
|
+
*
|
|
19
|
+
* @param {string} url - the URL to be opened, e.g. `myscheme://yolo`
|
|
20
|
+
* @param {string} [bundleId] - the application to open the given URL with. If not provided, then
|
|
21
|
+
* the application assigned by the operating system to handle URLs of the appropriate type
|
|
22
|
+
* @returns {Promise<void>}
|
|
23
|
+
* @since 4.17
|
|
24
|
+
* @this {XCUITestDriver}
|
|
25
|
+
*/
|
|
26
|
+
export function mobileDeepLink(this: import("../driver").XCUITestDriver, url: string, bundleId?: string): Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* @this {XCUITestDriver}
|
|
29
|
+
*/
|
|
30
|
+
export function nativeBack(this: import("../driver").XCUITestDriver): Promise<unknown>;
|
|
34
31
|
export type XCUITestDriver = import("../driver").XCUITestDriver;
|
|
35
32
|
export type DeepLinkOptions = {
|
|
36
33
|
/**
|