appium-xcuitest-driver 7.31.0 → 7.32.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/build/index.js +17 -7
- package/build/lib/app-utils.d.ts.map +1 -1
- package/build/lib/commands/alert.d.ts +1 -1
- package/build/lib/commands/alert.d.ts.map +1 -1
- package/build/lib/commands/app-management.d.ts +3 -3
- package/build/lib/commands/app-management.d.ts.map +1 -1
- package/build/lib/commands/app-strings.d.ts +1 -1
- package/build/lib/commands/app-strings.d.ts.map +1 -1
- package/build/lib/commands/bidi/constants.d.ts +4 -0
- package/build/lib/commands/bidi/constants.d.ts.map +1 -0
- package/build/lib/commands/bidi/constants.js +7 -0
- package/build/lib/commands/bidi/constants.js.map +1 -0
- package/build/lib/commands/bidi/models.d.ts +5 -0
- package/build/lib/commands/bidi/models.d.ts.map +1 -0
- package/build/lib/commands/bidi/models.js +31 -0
- package/build/lib/commands/bidi/models.js.map +1 -0
- package/build/lib/commands/bidi/types.d.ts +25 -0
- package/build/lib/commands/bidi/types.d.ts.map +1 -0
- package/build/lib/commands/bidi/types.js +4 -0
- package/build/lib/commands/bidi/types.js.map +1 -0
- package/build/lib/commands/certificate.d.ts +1 -1
- package/build/lib/commands/certificate.d.ts.map +1 -1
- package/build/lib/commands/clipboard.d.ts +2 -2
- package/build/lib/commands/clipboard.d.ts.map +1 -1
- package/build/lib/commands/context.d.ts +11 -4
- package/build/lib/commands/context.d.ts.map +1 -1
- package/build/lib/commands/context.js +19 -1
- package/build/lib/commands/context.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/file-movement.d.ts +1 -1
- package/build/lib/commands/file-movement.d.ts.map +1 -1
- package/build/lib/commands/general.d.ts +1 -1
- package/build/lib/commands/general.d.ts.map +1 -1
- package/build/lib/commands/gesture.d.ts +13 -13
- package/build/lib/commands/gesture.d.ts.map +1 -1
- package/build/lib/commands/keyboard.d.ts +1 -1
- package/build/lib/commands/keyboard.d.ts.map +1 -1
- package/build/lib/commands/localization.d.ts +1 -1
- package/build/lib/commands/localization.d.ts.map +1 -1
- package/build/lib/commands/lock.d.ts +1 -1
- package/build/lib/commands/lock.d.ts.map +1 -1
- package/build/lib/commands/log.d.ts +12 -12
- package/build/lib/commands/log.d.ts.map +1 -1
- package/build/lib/commands/log.js +25 -38
- package/build/lib/commands/log.js.map +1 -1
- package/build/lib/commands/navigation.d.ts +1 -1
- package/build/lib/commands/navigation.d.ts.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/proxy-helper.d.ts +1 -1
- package/build/lib/commands/proxy-helper.d.ts.map +1 -1
- package/build/lib/commands/recordscreen.d.ts +1 -1
- package/build/lib/commands/recordscreen.d.ts.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/source.d.ts +1 -1
- package/build/lib/commands/source.d.ts.map +1 -1
- package/build/lib/commands/web.d.ts +1 -1
- package/build/lib/commands/web.d.ts.map +1 -1
- package/build/lib/commands/xctest-record-screen.d.ts +2 -2
- package/build/lib/commands/xctest-record-screen.d.ts.map +1 -1
- package/build/lib/commands/xctest.d.ts +1 -1
- package/build/lib/commands/xctest.d.ts.map +1 -1
- package/build/lib/desired-caps.d.ts.map +1 -1
- package/build/lib/doctor/checks.js +17 -7
- package/build/lib/doctor/checks.js.map +1 -1
- package/build/lib/doctor/required-checks.d.ts +1 -1
- package/build/lib/doctor/required-checks.d.ts.map +1 -1
- package/build/lib/driver.d.ts +47 -49
- package/build/lib/driver.d.ts.map +1 -1
- package/build/lib/driver.js +5 -1
- package/build/lib/driver.js.map +1 -1
- package/build/lib/ios-fs-helpers.d.ts +1 -1
- package/build/lib/ios-fs-helpers.d.ts.map +1 -1
- package/build/lib/real-device-clients/devicectl.d.ts +3 -3
- package/build/lib/real-device-clients/devicectl.d.ts.map +1 -1
- package/build/lib/real-device-management.d.ts +1 -1
- package/build/lib/real-device-management.d.ts.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/simulator-management.d.ts +1 -1
- package/build/lib/simulator-management.d.ts.map +1 -1
- package/build/lib/utils.d.ts +1 -2
- package/build/lib/utils.d.ts.map +1 -1
- package/build/lib/utils.js +1 -2
- package/build/lib/utils.js.map +1 -1
- package/build/lib/xcrun.d.ts.map +1 -1
- package/lib/commands/bidi/constants.ts +3 -0
- package/lib/commands/bidi/models.ts +30 -0
- package/lib/commands/bidi/types.ts +29 -0
- package/lib/commands/context.js +19 -1
- package/lib/commands/log.js +30 -46
- package/lib/driver.js +4 -1
- package/lib/utils.js +0 -1
- package/npm-shrinkwrap.json +190 -145
- package/package.json +3 -3
package/lib/commands/context.js
CHANGED
|
@@ -4,6 +4,9 @@ import {util, timing} from 'appium/support';
|
|
|
4
4
|
import IOSPerformanceLog from '../device-log/ios-performance-log';
|
|
5
5
|
import _ from 'lodash';
|
|
6
6
|
import { NATIVE_WIN } from '../utils';
|
|
7
|
+
import { makeContextUpdatedEvent } from './bidi/models';
|
|
8
|
+
import { BIDI_EVENT_NAME } from './bidi/constants';
|
|
9
|
+
import { assignBiDiLogListener } from './log';
|
|
7
10
|
|
|
8
11
|
const WEBVIEW_WIN = 'WEBVIEW';
|
|
9
12
|
const WEBVIEW_BASE = `${WEBVIEW_WIN}_`;
|
|
@@ -345,6 +348,7 @@ const extensions = {
|
|
|
345
348
|
(async () => {
|
|
346
349
|
try {
|
|
347
350
|
await /** @type {RemoteDebugger} */ (this.remote).selectPage(appIdKey, parseInt(newPage, 10));
|
|
351
|
+
await notifyBiDiContextChange.bind(this)();
|
|
348
352
|
} catch (e) {
|
|
349
353
|
this.log.warn(`Failed to select page: ${e.message}`);
|
|
350
354
|
this.curContext = oldContext;
|
|
@@ -372,6 +376,7 @@ const helpers = {
|
|
|
372
376
|
}
|
|
373
377
|
await this.remote.disconnect();
|
|
374
378
|
this.curContext = null;
|
|
379
|
+
await notifyBiDiContextChange.bind(this)();
|
|
375
380
|
this.curWebFrames = [];
|
|
376
381
|
this.remote = null;
|
|
377
382
|
},
|
|
@@ -519,6 +524,7 @@ const commands = {
|
|
|
519
524
|
if (isNativeContext(strName)) {
|
|
520
525
|
// switching into the native context
|
|
521
526
|
this.curContext = null;
|
|
527
|
+
await notifyBiDiContextChange.bind(this)();
|
|
522
528
|
return;
|
|
523
529
|
}
|
|
524
530
|
|
|
@@ -548,6 +554,7 @@ const commands = {
|
|
|
548
554
|
try {
|
|
549
555
|
this.selectingNewPage = true;
|
|
550
556
|
await (/** @type {RemoteDebugger} */ (this.remote)).selectPage(appIdKey, pageIdKey, skipReadyCheck);
|
|
557
|
+
await notifyBiDiContextChange.bind(this)();
|
|
551
558
|
} catch (err) {
|
|
552
559
|
this.curContext = this.curWindowHandle = oldContext;
|
|
553
560
|
throw err;
|
|
@@ -559,7 +566,7 @@ const commands = {
|
|
|
559
566
|
if (this.opts.enablePerformanceLogging && this.remote) {
|
|
560
567
|
const context = this.curContext;
|
|
561
568
|
this.log.debug(`Starting performance log on '${context}'`);
|
|
562
|
-
[this.logs.performance,] =
|
|
569
|
+
[this.logs.performance,] = assignBiDiLogListener.bind(this)(
|
|
563
570
|
new IOSPerformanceLog({
|
|
564
571
|
remoteDebugger: this.remote,
|
|
565
572
|
log: this.log,
|
|
@@ -699,6 +706,17 @@ function isUrlIgnored(url, safariIgnoreWebHostnames) {
|
|
|
699
706
|
return false;
|
|
700
707
|
}
|
|
701
708
|
|
|
709
|
+
/**
|
|
710
|
+
* https://github.com/appium/appium/issues/20741
|
|
711
|
+
*
|
|
712
|
+
* @this {XCUITestDriver}
|
|
713
|
+
* @returns {Promise<void>}
|
|
714
|
+
*/
|
|
715
|
+
export async function notifyBiDiContextChange() {
|
|
716
|
+
const name = await this.getCurrentContext();
|
|
717
|
+
this.eventEmitter.emit(BIDI_EVENT_NAME, makeContextUpdatedEvent(name));
|
|
718
|
+
}
|
|
719
|
+
|
|
702
720
|
export default {...helpers, ...extensions, ...commands};
|
|
703
721
|
|
|
704
722
|
/**
|
package/lib/commands/log.js
CHANGED
|
@@ -8,7 +8,9 @@ import WebSocket from 'ws';
|
|
|
8
8
|
import SafariConsoleLog from '../device-log/safari-console-log';
|
|
9
9
|
import SafariNetworkLog from '../device-log/safari-network-log';
|
|
10
10
|
import { toLogEntry } from '../device-log/helpers';
|
|
11
|
-
import { NATIVE_WIN
|
|
11
|
+
import { NATIVE_WIN } from '../utils';
|
|
12
|
+
import { BIDI_EVENT_NAME } from './bidi/constants';
|
|
13
|
+
import { makeLogEntryAddedEvent } from './bidi/models';
|
|
12
14
|
|
|
13
15
|
/**
|
|
14
16
|
* Determines the websocket endpoint based on the `sessionId`
|
|
@@ -107,42 +109,6 @@ export default {
|
|
|
107
109
|
);
|
|
108
110
|
},
|
|
109
111
|
|
|
110
|
-
/**
|
|
111
|
-
* https://w3c.github.io/webdriver-bidi/#event-log-entryAdded
|
|
112
|
-
*
|
|
113
|
-
* @template {import('node:events').EventEmitter} EE
|
|
114
|
-
* @this {XCUITestDriver}
|
|
115
|
-
* @param {EE} logEmitter
|
|
116
|
-
* @param {BiDiListenerProperties} properties
|
|
117
|
-
* @returns {[EE, import('./types').LogListener]}
|
|
118
|
-
*/
|
|
119
|
-
assignBiDiLogListener (logEmitter, properties) {
|
|
120
|
-
const {
|
|
121
|
-
type,
|
|
122
|
-
context = NATIVE_WIN,
|
|
123
|
-
srcEventName = 'output',
|
|
124
|
-
entryTransformer,
|
|
125
|
-
} = properties;
|
|
126
|
-
const listener = (/** @type {import('./types').LogEntry} */ logEntry) => {
|
|
127
|
-
const finalEntry = entryTransformer ? entryTransformer(logEntry) : logEntry;
|
|
128
|
-
this.eventEmitter.emit(BIDI_EVENT_NAME, {
|
|
129
|
-
context,
|
|
130
|
-
method: 'log.entryAdded',
|
|
131
|
-
params: {
|
|
132
|
-
type,
|
|
133
|
-
level: finalEntry.level,
|
|
134
|
-
source: {
|
|
135
|
-
realm: '',
|
|
136
|
-
},
|
|
137
|
-
text: finalEntry.message,
|
|
138
|
-
timestamp: finalEntry.timestamp,
|
|
139
|
-
},
|
|
140
|
-
});
|
|
141
|
-
};
|
|
142
|
-
logEmitter.on(srcEventName, listener);
|
|
143
|
-
return [logEmitter, listener];
|
|
144
|
-
},
|
|
145
|
-
|
|
146
112
|
/**
|
|
147
113
|
* @this {XCUITestDriver}
|
|
148
114
|
*/
|
|
@@ -154,7 +120,7 @@ export default {
|
|
|
154
120
|
}
|
|
155
121
|
|
|
156
122
|
if (_.isUndefined(this.logs.syslog)) {
|
|
157
|
-
[this.logs.crashlog,] =
|
|
123
|
+
[this.logs.crashlog,] = assignBiDiLogListener.bind(this)(
|
|
158
124
|
new IOSCrashLog({
|
|
159
125
|
sim: /** @type {import('appium-ios-simulator').Simulator} */ (this.device),
|
|
160
126
|
udid: this.isRealDevice() ? this.opts.udid : undefined,
|
|
@@ -163,7 +129,7 @@ export default {
|
|
|
163
129
|
type: 'crashlog',
|
|
164
130
|
}
|
|
165
131
|
);
|
|
166
|
-
[this.logs.syslog,] =
|
|
132
|
+
[this.logs.syslog,] = assignBiDiLogListener.bind(this)(
|
|
167
133
|
this.isRealDevice()
|
|
168
134
|
? new IOSDeviceLog({
|
|
169
135
|
udid: this.opts.udid,
|
|
@@ -182,7 +148,7 @@ export default {
|
|
|
182
148
|
}
|
|
183
149
|
);
|
|
184
150
|
if (_.isBoolean(this.opts.showSafariConsoleLog)) {
|
|
185
|
-
[this.logs.safariConsole,] =
|
|
151
|
+
[this.logs.safariConsole,] = assignBiDiLogListener.bind(this)(
|
|
186
152
|
new SafariConsoleLog({
|
|
187
153
|
showLogs: this.opts.showSafariConsoleLog,
|
|
188
154
|
log: this.log,
|
|
@@ -192,7 +158,7 @@ export default {
|
|
|
192
158
|
);
|
|
193
159
|
}
|
|
194
160
|
if (_.isBoolean(this.opts.showSafariNetworkLog)) {
|
|
195
|
-
[this.logs.safariNetwork,] =
|
|
161
|
+
[this.logs.safariNetwork,] = assignBiDiLogListener.bind(this)(
|
|
196
162
|
new SafariNetworkLog({
|
|
197
163
|
showLogs: this.opts.showSafariNetworkLog,
|
|
198
164
|
log: this.log,
|
|
@@ -202,7 +168,7 @@ export default {
|
|
|
202
168
|
);
|
|
203
169
|
}
|
|
204
170
|
if (this.isFeatureEnabled(GET_SERVER_LOGS_FEATURE)) {
|
|
205
|
-
[, this._bidiServerLogListener] =
|
|
171
|
+
[, this._bidiServerLogListener] = assignBiDiLogListener.bind(this)(
|
|
206
172
|
this.log.unwrap(), {
|
|
207
173
|
type: 'server',
|
|
208
174
|
srcEventName: 'log',
|
|
@@ -323,14 +289,32 @@ export default {
|
|
|
323
289
|
};
|
|
324
290
|
|
|
325
291
|
/**
|
|
326
|
-
*
|
|
292
|
+
* https://w3c.github.io/webdriver-bidi/#event-log-entryAdded
|
|
293
|
+
*
|
|
294
|
+
* @template {import('node:events').EventEmitter} EE
|
|
295
|
+
* @this {XCUITestDriver}
|
|
296
|
+
* @param {EE} logEmitter
|
|
297
|
+
* @param {BiDiListenerProperties} properties
|
|
298
|
+
* @returns {[EE, import('./types').LogListener]}
|
|
327
299
|
*/
|
|
300
|
+
export function assignBiDiLogListener (logEmitter, properties) {
|
|
301
|
+
const {
|
|
302
|
+
type,
|
|
303
|
+
context = NATIVE_WIN,
|
|
304
|
+
srcEventName = 'output',
|
|
305
|
+
entryTransformer,
|
|
306
|
+
} = properties;
|
|
307
|
+
const listener = (/** @type {import('./types').LogEntry} */ logEntry) => {
|
|
308
|
+
const finalEntry = entryTransformer ? entryTransformer(logEntry) : logEntry;
|
|
309
|
+
this.eventEmitter.emit(BIDI_EVENT_NAME, makeLogEntryAddedEvent(finalEntry, context, type));
|
|
310
|
+
};
|
|
311
|
+
logEmitter.on(srcEventName, listener);
|
|
312
|
+
return [logEmitter, listener];
|
|
313
|
+
}
|
|
328
314
|
|
|
329
315
|
/**
|
|
316
|
+
* @typedef {import('../driver').XCUITestDriver} XCUITestDriver
|
|
330
317
|
* @typedef {keyof typeof SUPPORTED_LOG_TYPES} XCUITestDriverLogTypes
|
|
331
|
-
*/
|
|
332
|
-
|
|
333
|
-
/**
|
|
334
318
|
* @typedef {import('@appium/types').AppiumServer} AppiumServer
|
|
335
319
|
*/
|
|
336
320
|
|
package/lib/driver.js
CHANGED
|
@@ -62,6 +62,7 @@ import {
|
|
|
62
62
|
translateDeviceName,
|
|
63
63
|
} from './utils';
|
|
64
64
|
import { AppInfosCache } from './app-infos-cache';
|
|
65
|
+
import { notifyBiDiContextChange } from './commands/context';
|
|
65
66
|
|
|
66
67
|
const SHUTDOWN_OTHER_FEAT_NAME = 'shutdown_other_sims';
|
|
67
68
|
const CUSTOMIZE_RESULT_BUNDLE_PATH = 'customize_result_bundle_path';
|
|
@@ -660,6 +661,9 @@ export class XCUITestDriver extends BaseDriver {
|
|
|
660
661
|
|
|
661
662
|
if (this.isSafari() || this.opts.autoWebview) {
|
|
662
663
|
await this.activateRecentWebview();
|
|
664
|
+
} else {
|
|
665
|
+
// We want to always setup the initial context value upon session startup
|
|
666
|
+
await notifyBiDiContextChange.bind(this)();
|
|
663
667
|
}
|
|
664
668
|
if (this.isSafari()) {
|
|
665
669
|
if (shouldSetInitialSafariUrl(this.opts)) {
|
|
@@ -2017,7 +2021,6 @@ export class XCUITestDriver extends BaseDriver {
|
|
|
2017
2021
|
extractLogs = commands.logExtensions.extractLogs;
|
|
2018
2022
|
supportedLogTypes = commands.logExtensions.supportedLogTypes;
|
|
2019
2023
|
startLogCapture = commands.logExtensions.startLogCapture;
|
|
2020
|
-
assignBiDiLogListener = commands.logExtensions.assignBiDiLogListener;
|
|
2021
2024
|
mobileStartLogsBroadcast = commands.logExtensions.mobileStartLogsBroadcast;
|
|
2022
2025
|
mobileStopLogsBroadcast = commands.logExtensions.mobileStopLogsBroadcast;
|
|
2023
2026
|
|
package/lib/utils.js
CHANGED
|
@@ -21,7 +21,6 @@ const XCTEST_LOG_FILES_PATTERNS = [
|
|
|
21
21
|
];
|
|
22
22
|
const XCTEST_LOGS_CACHE_FOLDER_PREFIX = 'com.apple.dt.XCTest';
|
|
23
23
|
export const NATIVE_WIN = 'NATIVE_APP';
|
|
24
|
-
export const BIDI_EVENT_NAME = 'bidiEvent';
|
|
25
24
|
|
|
26
25
|
/**
|
|
27
26
|
* @privateRemarks Is the minimum version really Xcode 7.3?
|