@limrun/appium-xcuitest-driver 10.11.0-lim.3 → 10.14.6-lim.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 +94 -0
- package/build/lib/commands/active-app-info.d.ts +4 -3
- package/build/lib/commands/active-app-info.d.ts.map +1 -1
- package/build/lib/commands/active-app-info.js +2 -3
- package/build/lib/commands/active-app-info.js.map +1 -1
- package/build/lib/commands/alert.d.ts +26 -31
- package/build/lib/commands/alert.d.ts.map +1 -1
- package/build/lib/commands/alert.js +20 -29
- package/build/lib/commands/alert.js.map +1 -1
- package/build/lib/commands/app-management.d.ts +99 -76
- package/build/lib/commands/app-management.d.ts.map +1 -1
- package/build/lib/commands/app-management.js +83 -73
- package/build/lib/commands/app-management.js.map +1 -1
- package/build/lib/commands/app-strings.d.ts +6 -7
- package/build/lib/commands/app-strings.d.ts.map +1 -1
- package/build/lib/commands/app-strings.js +3 -8
- package/build/lib/commands/app-strings.js.map +1 -1
- package/build/lib/commands/appearance.d.ts +7 -9
- package/build/lib/commands/appearance.d.ts.map +1 -1
- package/build/lib/commands/appearance.js +13 -19
- package/build/lib/commands/appearance.js.map +1 -1
- package/build/lib/commands/audit.d.ts +5 -33
- package/build/lib/commands/audit.d.ts.map +1 -1
- package/build/lib/commands/audit.js +3 -16
- package/build/lib/commands/audit.js.map +1 -1
- package/build/lib/commands/battery.d.ts +4 -4
- package/build/lib/commands/battery.d.ts.map +1 -1
- package/build/lib/commands/battery.js +3 -7
- package/build/lib/commands/battery.js.map +1 -1
- package/build/lib/commands/biometric.d.ts +12 -14
- package/build/lib/commands/biometric.d.ts.map +1 -1
- package/build/lib/commands/biometric.js +10 -19
- package/build/lib/commands/biometric.js.map +1 -1
- package/build/lib/commands/certificate.d.ts +14 -19
- package/build/lib/commands/certificate.d.ts.map +1 -1
- package/build/lib/commands/certificate.js +24 -31
- package/build/lib/commands/certificate.js.map +1 -1
- package/build/lib/commands/clipboard.d.ts +9 -11
- package/build/lib/commands/clipboard.d.ts.map +1 -1
- package/build/lib/commands/clipboard.js +8 -13
- package/build/lib/commands/clipboard.js.map +1 -1
- package/build/lib/commands/condition.d.ts +9 -72
- package/build/lib/commands/condition.d.ts.map +1 -1
- package/build/lib/commands/condition.js +5 -66
- package/build/lib/commands/condition.js.map +1 -1
- package/build/lib/commands/content-size.d.ts +16 -19
- package/build/lib/commands/content-size.d.ts.map +1 -1
- package/build/lib/commands/content-size.js +14 -22
- package/build/lib/commands/content-size.js.map +1 -1
- package/build/lib/commands/context.d.ts +130 -161
- package/build/lib/commands/context.d.ts.map +1 -1
- package/build/lib/commands/context.js +123 -108
- package/build/lib/commands/context.js.map +1 -1
- package/build/lib/commands/device-info.d.ts +13 -0
- package/build/lib/commands/device-info.d.ts.map +1 -0
- package/build/lib/commands/device-info.js +20 -0
- package/build/lib/commands/device-info.js.map +1 -0
- package/build/lib/commands/element.d.ts +83 -67
- package/build/lib/commands/element.d.ts.map +1 -1
- package/build/lib/commands/element.js +111 -134
- package/build/lib/commands/element.js.map +1 -1
- package/build/lib/commands/execute.d.ts +10 -22
- package/build/lib/commands/execute.d.ts.map +1 -1
- package/build/lib/commands/execute.js +13 -29
- package/build/lib/commands/execute.js.map +1 -1
- package/build/lib/commands/file-movement.d.ts +31 -42
- package/build/lib/commands/file-movement.d.ts.map +1 -1
- package/build/lib/commands/file-movement.js +146 -205
- package/build/lib/commands/file-movement.js.map +1 -1
- package/build/lib/commands/find.d.ts +20 -12
- package/build/lib/commands/find.d.ts.map +1 -1
- package/build/lib/commands/find.js +27 -65
- package/build/lib/commands/find.js.map +1 -1
- package/build/lib/commands/general.d.ts +84 -80
- package/build/lib/commands/general.d.ts.map +1 -1
- package/build/lib/commands/general.js +67 -54
- package/build/lib/commands/general.js.map +1 -1
- package/build/lib/commands/geolocation.d.ts +16 -36
- package/build/lib/commands/geolocation.d.ts.map +1 -1
- package/build/lib/commands/geolocation.js +8 -25
- package/build/lib/commands/geolocation.js.map +1 -1
- package/build/lib/commands/gesture.d.ts +103 -119
- package/build/lib/commands/gesture.d.ts.map +1 -1
- package/build/lib/commands/gesture.js +98 -138
- package/build/lib/commands/gesture.js.map +1 -1
- package/build/lib/commands/increase-contrast.d.ts +10 -13
- package/build/lib/commands/increase-contrast.d.ts.map +1 -1
- package/build/lib/commands/increase-contrast.js +8 -16
- package/build/lib/commands/increase-contrast.js.map +1 -1
- package/build/lib/commands/iohid.d.ts +6 -1359
- package/build/lib/commands/iohid.d.ts.map +1 -1
- package/build/lib/commands/iohid.js +5 -10
- package/build/lib/commands/iohid.js.map +1 -1
- package/build/lib/commands/keyboard.d.ts +16 -13
- package/build/lib/commands/keyboard.d.ts.map +1 -1
- package/build/lib/commands/keyboard.js +14 -18
- package/build/lib/commands/keyboard.js.map +1 -1
- package/build/lib/commands/keychains.d.ts +2 -2
- package/build/lib/commands/keychains.d.ts.map +1 -1
- package/build/lib/commands/keychains.js +1 -4
- package/build/lib/commands/keychains.js.map +1 -1
- package/build/lib/commands/localization.d.ts +7 -6
- package/build/lib/commands/localization.d.ts.map +1 -1
- package/build/lib/commands/localization.js +7 -8
- package/build/lib/commands/localization.js.map +1 -1
- package/build/lib/commands/location.d.ts +8 -11
- package/build/lib/commands/location.d.ts.map +1 -1
- package/build/lib/commands/location.js +7 -15
- package/build/lib/commands/location.js.map +1 -1
- package/build/lib/commands/lock.d.ts +6 -10
- package/build/lib/commands/lock.d.ts.map +1 -1
- package/build/lib/commands/lock.js +3 -10
- package/build/lib/commands/lock.js.map +1 -1
- package/build/lib/commands/log.d.ts +42 -44
- package/build/lib/commands/log.d.ts.map +1 -1
- package/build/lib/commands/log.js +32 -53
- package/build/lib/commands/log.js.map +1 -1
- package/build/lib/commands/memory.d.ts +4 -5
- package/build/lib/commands/memory.d.ts.map +1 -1
- package/build/lib/commands/memory.js +3 -8
- package/build/lib/commands/memory.js.map +1 -1
- package/build/lib/commands/navigation.d.ts +14 -26
- package/build/lib/commands/navigation.d.ts.map +1 -1
- package/build/lib/commands/navigation.js +22 -32
- package/build/lib/commands/navigation.js.map +1 -1
- package/build/lib/commands/notifications.d.ts +10 -10
- package/build/lib/commands/notifications.d.ts.map +1 -1
- package/build/lib/commands/notifications.js +8 -12
- package/build/lib/commands/notifications.js.map +1 -1
- package/build/lib/commands/pasteboard.d.ts +9 -10
- package/build/lib/commands/pasteboard.d.ts.map +1 -1
- package/build/lib/commands/pasteboard.js +8 -13
- package/build/lib/commands/pasteboard.js.map +1 -1
- package/build/lib/commands/pcap.d.ts +18 -38
- package/build/lib/commands/pcap.d.ts.map +1 -1
- package/build/lib/commands/pcap.js +9 -14
- package/build/lib/commands/pcap.js.map +1 -1
- package/build/lib/commands/performance.d.ts +36 -55
- package/build/lib/commands/performance.d.ts.map +1 -1
- package/build/lib/commands/performance.js +93 -86
- package/build/lib/commands/performance.js.map +1 -1
- package/build/lib/commands/permissions.d.ts +15 -17
- package/build/lib/commands/permissions.d.ts.map +1 -1
- package/build/lib/commands/permissions.js +12 -18
- package/build/lib/commands/permissions.js.map +1 -1
- package/build/lib/commands/proxy-helper.d.ts +11 -11
- package/build/lib/commands/proxy-helper.d.ts.map +1 -1
- package/build/lib/commands/proxy-helper.js +15 -24
- package/build/lib/commands/proxy-helper.js.map +1 -1
- package/build/lib/commands/record-audio.d.ts +25 -52
- package/build/lib/commands/record-audio.d.ts.map +1 -1
- package/build/lib/commands/record-audio.js +17 -19
- package/build/lib/commands/record-audio.js.map +1 -1
- package/build/lib/commands/recordscreen.d.ts +31 -62
- package/build/lib/commands/recordscreen.d.ts.map +1 -1
- package/build/lib/commands/recordscreen.js +29 -28
- package/build/lib/commands/recordscreen.js.map +1 -1
- package/build/lib/commands/screenshots.d.ts +15 -9
- package/build/lib/commands/screenshots.d.ts.map +1 -1
- package/build/lib/commands/screenshots.js +16 -16
- package/build/lib/commands/screenshots.js.map +1 -1
- package/build/lib/commands/simctl.d.ts +16 -22
- package/build/lib/commands/simctl.d.ts.map +1 -1
- package/build/lib/commands/simctl.js +13 -17
- package/build/lib/commands/simctl.js.map +1 -1
- package/build/lib/commands/source.d.ts +10 -8
- package/build/lib/commands/source.d.ts.map +1 -1
- package/build/lib/commands/source.js +11 -14
- package/build/lib/commands/source.js.map +1 -1
- package/build/lib/commands/timeouts.d.ts +25 -32
- package/build/lib/commands/timeouts.d.ts.map +1 -1
- package/build/lib/commands/timeouts.js +19 -15
- package/build/lib/commands/timeouts.js.map +1 -1
- package/build/lib/commands/types.d.ts +80 -0
- package/build/lib/commands/types.d.ts.map +1 -1
- package/build/lib/commands/web.d.ts +199 -202
- package/build/lib/commands/web.d.ts.map +1 -1
- package/build/lib/commands/web.js +216 -175
- package/build/lib/commands/web.js.map +1 -1
- package/build/lib/commands/xctest-record-screen.d.ts +17 -47
- package/build/lib/commands/xctest-record-screen.d.ts.map +1 -1
- package/build/lib/commands/xctest-record-screen.js +28 -59
- package/build/lib/commands/xctest-record-screen.js.map +1 -1
- package/build/lib/commands/xctest.d.ts +37 -37
- package/build/lib/commands/xctest.d.ts.map +1 -1
- package/build/lib/commands/xctest.js +38 -50
- package/build/lib/commands/xctest.js.map +1 -1
- package/build/lib/desired-caps.js +1 -1
- package/build/lib/device/log/ios-simulator-log.d.ts.map +1 -1
- package/build/lib/device/log/ios-simulator-log.js +2 -0
- package/build/lib/device/log/ios-simulator-log.js.map +1 -1
- package/build/lib/device/simulator-management.d.ts.map +1 -1
- package/build/lib/device/simulator-management.js +4 -5
- package/build/lib/device/simulator-management.js.map +1 -1
- package/build/lib/device-log/ios-crash-log.d.ts +1 -1
- package/build/lib/device-log/ios-crash-log.d.ts.map +1 -1
- package/build/lib/device-log/ios-simulator-log.d.ts +1 -1
- package/build/lib/device-log/ios-simulator-log.d.ts.map +1 -1
- package/build/lib/doctor/optional-checks.d.ts +0 -9
- package/build/lib/doctor/optional-checks.d.ts.map +1 -1
- package/build/lib/doctor/optional-checks.js +1 -30
- package/build/lib/doctor/optional-checks.js.map +1 -1
- package/build/lib/driver.d.ts +11 -3
- package/build/lib/driver.d.ts.map +1 -1
- package/build/lib/driver.js +36 -12
- 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 +0 -9
- package/build/lib/execute-method-map.js.map +1 -1
- package/build/lib/simulator-management.js +3 -3
- package/build/lib/simulator-management.js.map +1 -1
- package/lib/commands/active-app-info.ts +15 -0
- package/lib/commands/alert.ts +98 -0
- package/lib/commands/app-management.ts +414 -0
- package/lib/commands/{app-strings.js → app-strings.ts} +10 -9
- package/lib/commands/appearance.ts +70 -0
- package/lib/commands/audit.ts +25 -0
- package/lib/commands/{battery.js → battery.ts} +10 -12
- package/lib/commands/biometric.ts +52 -0
- package/lib/commands/{certificate.js → certificate.ts} +55 -50
- package/lib/commands/clipboard.ts +37 -0
- package/lib/commands/{condition.js → condition.ts} +21 -77
- package/lib/commands/content-size.ts +67 -0
- package/lib/commands/{context.js → context.ts} +174 -146
- package/lib/commands/device-info.ts +24 -0
- package/lib/commands/element.ts +419 -0
- package/lib/commands/{execute.js → execute.ts} +42 -38
- package/lib/commands/{file-movement.js → file-movement.ts} +212 -235
- package/lib/commands/find.ts +277 -0
- package/lib/commands/{general.js → general.ts} +102 -77
- package/lib/commands/geolocation.ts +55 -0
- package/lib/commands/{gesture.js → gesture.ts} +225 -183
- package/lib/commands/increase-contrast.ts +49 -0
- package/lib/commands/{iohid.js → iohid.ts} +15 -13
- package/lib/commands/keyboard.ts +70 -0
- package/lib/commands/keychains.ts +16 -0
- package/lib/commands/{localization.js → localization.ts} +22 -12
- package/lib/commands/{location.js → location.ts} +19 -22
- package/lib/commands/lock.ts +43 -0
- package/lib/commands/{log.js → log.ts} +68 -68
- package/lib/commands/{memory.js → memory.ts} +9 -9
- package/lib/commands/{navigation.js → navigation.ts} +42 -39
- package/lib/commands/{notifications.js → notifications.ts} +22 -14
- package/lib/commands/pasteboard.ts +44 -0
- package/lib/commands/{pcap.js → pcap.ts} +28 -28
- package/lib/commands/{performance.js → performance.ts} +133 -114
- package/lib/commands/permissions.ts +90 -0
- package/lib/commands/{proxy-helper.js → proxy-helper.ts} +26 -26
- package/lib/commands/{record-audio.js → record-audio.ts} +35 -33
- package/lib/commands/{recordscreen.js → recordscreen.ts} +78 -50
- package/lib/commands/{screenshots.js → screenshots.ts} +27 -21
- package/lib/commands/simctl.ts +82 -0
- package/lib/commands/{source.js → source.ts} +23 -20
- package/lib/commands/timeouts.ts +95 -0
- package/lib/commands/types.ts +86 -0
- package/lib/commands/{web.js → web.ts} +314 -264
- package/lib/commands/{xctest-record-screen.js → xctest-record-screen.ts} +54 -71
- package/lib/commands/{xctest.js → xctest.ts} +78 -71
- package/lib/desired-caps.ts +1 -1
- package/lib/device/log/ios-simulator-log.ts +2 -0
- package/lib/device/simulator-management.ts +3 -6
- package/lib/doctor/optional-checks.ts +0 -33
- package/lib/driver.ts +38 -13
- package/lib/execute-method-map.ts +0 -9
- package/package.json +6 -5
- package/lib/commands/active-app-info.js +0 -12
- package/lib/commands/alert.js +0 -88
- package/lib/commands/app-management.js +0 -346
- package/lib/commands/appearance.js +0 -71
- package/lib/commands/audit.js +0 -31
- package/lib/commands/biometric.js +0 -52
- package/lib/commands/clipboard.js +0 -35
- package/lib/commands/content-size.js +0 -68
- package/lib/commands/deviceInfo.js +0 -27
- package/lib/commands/element.js +0 -423
- package/lib/commands/find.js +0 -205
- package/lib/commands/geolocation.js +0 -56
- package/lib/commands/increase-contrast.js +0 -50
- package/lib/commands/keyboard.js +0 -62
- package/lib/commands/keychains.js +0 -17
- package/lib/commands/lock.js +0 -46
- package/lib/commands/pasteboard.js +0 -43
- package/lib/commands/permissions.js +0 -85
- package/lib/commands/simctl.js +0 -71
- package/lib/commands/timeouts.js +0 -68
|
@@ -11,22 +11,33 @@ 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';
|
|
14
|
+
import type {XCUITestDriver} from '../driver';
|
|
15
|
+
import type {LogEntry, LogListener} from './types';
|
|
16
|
+
import type {LogDefRecord, AppiumServer, WSServer} from '@appium/types';
|
|
17
|
+
import type {Simulator} from 'appium-ios-simulator';
|
|
18
|
+
import type {EventEmitter} from 'node:events';
|
|
14
19
|
|
|
15
20
|
/**
|
|
16
21
|
* Determines the websocket endpoint based on the `sessionId`
|
|
17
|
-
* @param {string} sessionId
|
|
18
|
-
* @returns {string}
|
|
19
22
|
*/
|
|
20
|
-
const WEBSOCKET_ENDPOINT = (sessionId) =>
|
|
23
|
+
const WEBSOCKET_ENDPOINT = (sessionId: string): string =>
|
|
21
24
|
`${DEFAULT_WS_PATHNAME_PREFIX}/session/${sessionId}/appium/device/syslog`;
|
|
22
25
|
const COLOR_CODE_PATTERN = /\u001b\[(\d+(;\d+)*)?m/g; // eslint-disable-line no-control-regex
|
|
23
26
|
const GET_SERVER_LOGS_FEATURE = 'get_server_logs';
|
|
24
27
|
|
|
28
|
+
type XCUITestDriverLogTypes = keyof typeof SUPPORTED_LOG_TYPES;
|
|
29
|
+
|
|
30
|
+
interface BiDiListenerProperties {
|
|
31
|
+
type: string;
|
|
32
|
+
srcEventName?: string;
|
|
33
|
+
context?: string;
|
|
34
|
+
entryTransformer?: (x: any) => LogEntry;
|
|
35
|
+
}
|
|
36
|
+
|
|
25
37
|
/**
|
|
26
|
-
* @type {import('@appium/types').LogDefRecord}
|
|
27
38
|
* @privateRemarks The return types for these getters should be specified
|
|
28
39
|
*/
|
|
29
|
-
const SUPPORTED_LOG_TYPES = {
|
|
40
|
+
const SUPPORTED_LOG_TYPES: LogDefRecord = {
|
|
30
41
|
syslog: {
|
|
31
42
|
description: 'System Logs - Device logs for iOS applications on real devices and simulators',
|
|
32
43
|
getter: async (self) => await self.extractLogs('syslog', self.logs),
|
|
@@ -49,9 +60,6 @@ const SUPPORTED_LOG_TYPES = {
|
|
|
49
60
|
},
|
|
50
61
|
server: {
|
|
51
62
|
description: 'Appium server logs',
|
|
52
|
-
/**
|
|
53
|
-
* @returns {import('./types').LogEntry[]}
|
|
54
|
-
*/
|
|
55
63
|
getter: (self) => {
|
|
56
64
|
self.assertFeatureEnabled(GET_SERVER_LOGS_FEATURE);
|
|
57
65
|
return self.log.unwrap().record.map(nativeLogEntryToSeleniumEntry);
|
|
@@ -59,7 +67,7 @@ const SUPPORTED_LOG_TYPES = {
|
|
|
59
67
|
},
|
|
60
68
|
};
|
|
61
69
|
|
|
62
|
-
const LOG_NAMES_TO_CAPABILITY_NAMES_MAP = {
|
|
70
|
+
const LOG_NAMES_TO_CAPABILITY_NAMES_MAP: Record<string, string> = {
|
|
63
71
|
safariConsole: 'showSafariConsoleLog',
|
|
64
72
|
safariNetwork: 'showSafariNetworkLog',
|
|
65
73
|
enablePerformanceLogging: 'enablePerformanceLogging',
|
|
@@ -68,12 +76,18 @@ const LOG_NAMES_TO_CAPABILITY_NAMES_MAP = {
|
|
|
68
76
|
export const supportedLogTypes = SUPPORTED_LOG_TYPES;
|
|
69
77
|
|
|
70
78
|
/**
|
|
79
|
+
* Extracts logs of the specified type from the logs container.
|
|
71
80
|
*
|
|
72
|
-
* @param
|
|
73
|
-
* @param
|
|
74
|
-
* @
|
|
81
|
+
* @param logType - The type of log to extract
|
|
82
|
+
* @param logsContainer - Container holding log objects
|
|
83
|
+
* @returns The extracted logs
|
|
84
|
+
* @throws {Error} If logs are not available or the log type is not found
|
|
75
85
|
*/
|
|
76
|
-
export async function extractLogs(
|
|
86
|
+
export async function extractLogs(
|
|
87
|
+
this: XCUITestDriver,
|
|
88
|
+
logType: XCUITestDriverLogTypes,
|
|
89
|
+
logsContainer: Partial<Record<XCUITestDriverLogTypes, {getLogs(): Promise<any>}>> = {},
|
|
90
|
+
): Promise<any> {
|
|
77
91
|
// make sure that we have logs at all
|
|
78
92
|
// otherwise it's not been initialized
|
|
79
93
|
if (_.isEmpty(logsContainer)) {
|
|
@@ -97,9 +111,14 @@ export async function extractLogs(logType, logsContainer = {}) {
|
|
|
97
111
|
}
|
|
98
112
|
|
|
99
113
|
/**
|
|
100
|
-
*
|
|
114
|
+
* Starts capturing iOS system logs.
|
|
115
|
+
*
|
|
116
|
+
* Initializes and starts capturing syslog and crashlog. Optionally starts Safari console and network logs
|
|
117
|
+
* if the corresponding capabilities are enabled.
|
|
118
|
+
*
|
|
119
|
+
* @returns `true` if syslog capture started successfully; `false` otherwise
|
|
101
120
|
*/
|
|
102
|
-
export async function startLogCapture() {
|
|
121
|
+
export async function startLogCapture(this: XCUITestDriver): Promise<boolean> {
|
|
103
122
|
this.logs = this.logs || {};
|
|
104
123
|
if (!_.isUndefined(this.logs.syslog) && this.logs.syslog.isCapturing) {
|
|
105
124
|
this.log.warn('Trying to start iOS log capture but it has already started!');
|
|
@@ -109,7 +128,7 @@ export async function startLogCapture() {
|
|
|
109
128
|
if (_.isUndefined(this.logs.syslog)) {
|
|
110
129
|
[this.logs.crashlog,] = assignBiDiLogListener.bind(this)(
|
|
111
130
|
new IOSCrashLog({
|
|
112
|
-
sim:
|
|
131
|
+
sim: this.device as Simulator,
|
|
113
132
|
udid: this.isRealDevice() ? this.opts.udid : undefined,
|
|
114
133
|
log: this.log,
|
|
115
134
|
}), {
|
|
@@ -119,12 +138,12 @@ export async function startLogCapture() {
|
|
|
119
138
|
[this.logs.syslog,] = assignBiDiLogListener.bind(this)(
|
|
120
139
|
this.isRealDevice()
|
|
121
140
|
? new IOSDeviceLog({
|
|
122
|
-
udid:
|
|
141
|
+
udid: this.opts.udid as string,
|
|
123
142
|
showLogs: this.opts.showIOSLog,
|
|
124
143
|
log: this.log,
|
|
125
144
|
})
|
|
126
145
|
: new IOSSimulatorLog({
|
|
127
|
-
sim:
|
|
146
|
+
sim: this.device as Simulator,
|
|
128
147
|
showLogs: this.opts.showIOSLog,
|
|
129
148
|
iosSimulatorLogsPredicate: this.opts.iosSimulatorLogsPredicate,
|
|
130
149
|
simulatorLogLevel: this.opts.simulatorLogLevel,
|
|
@@ -167,14 +186,13 @@ export async function startLogCapture() {
|
|
|
167
186
|
}
|
|
168
187
|
|
|
169
188
|
let didStartSyslog = false;
|
|
170
|
-
|
|
171
|
-
const promises = [
|
|
189
|
+
const promises: Promise<any>[] = [
|
|
172
190
|
(async () => {
|
|
173
191
|
try {
|
|
174
192
|
await this.logs.syslog?.startCapture();
|
|
175
193
|
didStartSyslog = true;
|
|
176
194
|
this.eventEmitter.emit('syslogStarted', this.logs.syslog);
|
|
177
|
-
} catch (err) {
|
|
195
|
+
} catch (err: any) {
|
|
178
196
|
this.log.debug(err.stack);
|
|
179
197
|
this.log.warn(`Continuing without capturing device logs: ${err.message}`);
|
|
180
198
|
}
|
|
@@ -189,22 +207,18 @@ export async function startLogCapture() {
|
|
|
189
207
|
/**
|
|
190
208
|
* Starts an iOS system logs broadcast websocket.
|
|
191
209
|
*
|
|
192
|
-
* The websocket listens on the same host and port as Appium.
|
|
210
|
+
* The websocket listens on the same host and port as Appium. The endpoint created is `/ws/session/:sessionId:/appium/syslog`.
|
|
193
211
|
*
|
|
194
212
|
* If the websocket is already running, this command does nothing.
|
|
195
213
|
*
|
|
196
|
-
* Each connected
|
|
214
|
+
* Each connected websocket listener will receive syslog lines as soon as they are visible to Appium.
|
|
197
215
|
* @see https://appiumpro.com/editions/55-using-mobile-execution-commands-to-continuously-stream-device-logs-with-appium
|
|
198
|
-
* @returns {Promise<void>}
|
|
199
|
-
* @this {XCUITestDriver}
|
|
200
216
|
*/
|
|
201
|
-
export async function mobileStartLogsBroadcast() {
|
|
202
|
-
const pathname = WEBSOCKET_ENDPOINT(
|
|
217
|
+
export async function mobileStartLogsBroadcast(this: XCUITestDriver): Promise<void> {
|
|
218
|
+
const pathname = WEBSOCKET_ENDPOINT(this.sessionId as string);
|
|
203
219
|
if (
|
|
204
220
|
!_.isEmpty(
|
|
205
|
-
await
|
|
206
|
-
this.server
|
|
207
|
-
).getWebSocketHandlers(pathname),
|
|
221
|
+
await (this.server as AppiumServer).getWebSocketHandlers(pathname),
|
|
208
222
|
)
|
|
209
223
|
) {
|
|
210
224
|
this.log.debug(
|
|
@@ -229,7 +243,7 @@ export async function mobileStartLogsBroadcast() {
|
|
|
229
243
|
}
|
|
230
244
|
|
|
231
245
|
if (_.isEmpty(this._syslogWebsocketListener)) {
|
|
232
|
-
this._syslogWebsocketListener = (logRecord) => {
|
|
246
|
+
this._syslogWebsocketListener = (logRecord: {message: string}) => {
|
|
233
247
|
if (ws?.readyState === WebSocket.OPEN) {
|
|
234
248
|
ws.send(logRecord.message);
|
|
235
249
|
}
|
|
@@ -237,7 +251,7 @@ export async function mobileStartLogsBroadcast() {
|
|
|
237
251
|
}
|
|
238
252
|
this.logs.syslog?.on('output', this._syslogWebsocketListener);
|
|
239
253
|
|
|
240
|
-
ws.on('close', (code, reason) => {
|
|
254
|
+
ws.on('close', (code: number, reason: Buffer) => {
|
|
241
255
|
if (!_.isEmpty(this._syslogWebsocketListener)) {
|
|
242
256
|
this.logs.syslog?.removeListener('output', this._syslogWebsocketListener);
|
|
243
257
|
this._syslogWebsocketListener = null;
|
|
@@ -253,45 +267,49 @@ export async function mobileStartLogsBroadcast() {
|
|
|
253
267
|
this.log.debug(closeMsg);
|
|
254
268
|
});
|
|
255
269
|
});
|
|
256
|
-
await
|
|
270
|
+
await (this.server as AppiumServer).addWebSocketHandler(
|
|
257
271
|
pathname,
|
|
258
|
-
|
|
272
|
+
wss as WSServer,
|
|
259
273
|
);
|
|
260
274
|
}
|
|
261
275
|
|
|
262
276
|
/**
|
|
263
|
-
* Stops the syslog broadcasting
|
|
277
|
+
* Stops the syslog broadcasting websocket server previously started by `mobile: startLogsBroadcast`.
|
|
278
|
+
*
|
|
264
279
|
* If no websocket server is running, this command does nothing.
|
|
265
|
-
* @this {XCUITestDriver}
|
|
266
|
-
* @returns {Promise<void>}
|
|
267
280
|
*/
|
|
268
|
-
export async function mobileStopLogsBroadcast() {
|
|
269
|
-
const pathname = WEBSOCKET_ENDPOINT(
|
|
270
|
-
if (_.isEmpty(await
|
|
281
|
+
export async function mobileStopLogsBroadcast(this: XCUITestDriver): Promise<void> {
|
|
282
|
+
const pathname = WEBSOCKET_ENDPOINT(this.sessionId as string);
|
|
283
|
+
if (_.isEmpty(await (this.server as AppiumServer).getWebSocketHandlers(pathname))) {
|
|
271
284
|
return;
|
|
272
285
|
}
|
|
273
286
|
|
|
274
287
|
this.log.debug('Stopping the system logs broadcasting web socket server');
|
|
275
|
-
await
|
|
288
|
+
await (this.server as AppiumServer).removeWebSocketHandler(pathname);
|
|
276
289
|
}
|
|
277
290
|
|
|
278
291
|
/**
|
|
292
|
+
* Assigns a BiDi log listener to the given log emitter.
|
|
293
|
+
*
|
|
279
294
|
* https://w3c.github.io/webdriver-bidi/#event-log-entryAdded
|
|
280
295
|
*
|
|
281
|
-
* @template
|
|
282
|
-
* @
|
|
283
|
-
* @param
|
|
284
|
-
* @
|
|
285
|
-
* @returns {[EE, import('./types').LogListener]}
|
|
296
|
+
* @template EE extends EventEmitter
|
|
297
|
+
* @param logEmitter - The event emitter to attach the listener to
|
|
298
|
+
* @param properties - Configuration for the BiDi listener
|
|
299
|
+
* @returns A tuple containing the log emitter and the listener function
|
|
286
300
|
*/
|
|
287
|
-
export function assignBiDiLogListener (
|
|
301
|
+
export function assignBiDiLogListener<EE extends EventEmitter>(
|
|
302
|
+
this: XCUITestDriver,
|
|
303
|
+
logEmitter: EE,
|
|
304
|
+
properties: BiDiListenerProperties,
|
|
305
|
+
): [EE, LogListener] {
|
|
288
306
|
const {
|
|
289
307
|
type,
|
|
290
308
|
context = NATIVE_WIN,
|
|
291
309
|
srcEventName = 'output',
|
|
292
310
|
entryTransformer,
|
|
293
311
|
} = properties;
|
|
294
|
-
const listener = (
|
|
312
|
+
const listener: LogListener = (logEntry: LogEntry) => {
|
|
295
313
|
const finalEntry = entryTransformer ? entryTransformer(logEntry) : logEntry;
|
|
296
314
|
this.eventEmitter.emit(BIDI_EVENT_NAME, makeLogEntryAddedEvent(finalEntry, context, type));
|
|
297
315
|
};
|
|
@@ -299,29 +317,11 @@ export function assignBiDiLogListener (logEmitter, properties) {
|
|
|
299
317
|
return [logEmitter, listener];
|
|
300
318
|
}
|
|
301
319
|
|
|
302
|
-
|
|
303
|
-
*
|
|
304
|
-
* @param {Object} x
|
|
305
|
-
* @returns {import('./types').LogEntry}
|
|
306
|
-
*/
|
|
307
|
-
function nativeLogEntryToSeleniumEntry (x) {
|
|
320
|
+
function nativeLogEntryToSeleniumEntry(x: any): LogEntry {
|
|
308
321
|
const msg = _.isEmpty(x.prefix) ? x.message : `[${x.prefix}] ${x.message}`;
|
|
309
322
|
return toLogEntry(
|
|
310
323
|
_.replace(msg, COLOR_CODE_PATTERN, ''),
|
|
311
|
-
|
|
324
|
+
x.timestamp ?? Date.now()
|
|
312
325
|
);
|
|
313
326
|
}
|
|
314
327
|
|
|
315
|
-
/**
|
|
316
|
-
* @typedef {import('../driver').XCUITestDriver} XCUITestDriver
|
|
317
|
-
* @typedef {keyof typeof SUPPORTED_LOG_TYPES} XCUITestDriverLogTypes
|
|
318
|
-
* @typedef {import('@appium/types').AppiumServer} AppiumServer
|
|
319
|
-
*/
|
|
320
|
-
|
|
321
|
-
/**
|
|
322
|
-
* @typedef {Object} BiDiListenerProperties
|
|
323
|
-
* @property {string} type
|
|
324
|
-
* @property {string} [srcEventName='output']
|
|
325
|
-
* @property {string} [context=NATIVE_WIN]
|
|
326
|
-
* @property {(x: Object) => import('./types').LogEntry} [entryTransformer]
|
|
327
|
-
*/
|
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
import _ from 'lodash';
|
|
2
2
|
import { errors } from 'appium/driver';
|
|
3
|
+
import type {XCUITestDriver} from '../driver';
|
|
4
|
+
import type {RealDevice} from '../device/real-device-management';
|
|
3
5
|
|
|
4
6
|
/**
|
|
5
7
|
* Simulates Low Memory warning on the given application
|
|
6
8
|
*
|
|
7
9
|
* @since Xcode 15
|
|
8
|
-
* @param
|
|
9
|
-
* @
|
|
10
|
-
* @throws {Error} if the app is not running or is not installed
|
|
10
|
+
* @param bundleId - The bundle identifier of the target app. The app must be running
|
|
11
|
+
* @throws If the app is not running or is not installed
|
|
11
12
|
*/
|
|
12
|
-
export async function mobileSendMemoryWarning(
|
|
13
|
+
export async function mobileSendMemoryWarning(
|
|
14
|
+
this: XCUITestDriver,
|
|
15
|
+
bundleId: string,
|
|
16
|
+
): Promise<void> {
|
|
13
17
|
if (!this.isRealDevice()) {
|
|
14
18
|
throw new Error('Memory warning simulation is only supported on real devices');
|
|
15
19
|
}
|
|
16
20
|
|
|
17
|
-
const device =
|
|
21
|
+
const device = this.device as RealDevice;
|
|
18
22
|
|
|
19
23
|
const appInfos = await device.devicectl.listApps(bundleId);
|
|
20
24
|
if (_.isEmpty(appInfos)) {
|
|
@@ -33,7 +37,6 @@ export async function mobileSendMemoryWarning(bundleId) {
|
|
|
33
37
|
// Unfortunately devicectl does not provide more info which would
|
|
34
38
|
// allow to connect a bundle id to a process id.
|
|
35
39
|
const pattern = new RegExp(`^${_.escapeRegExp(appInfos[0].url)}[^/]+$`);
|
|
36
|
-
/** @type {number[]} */
|
|
37
40
|
const pids = (await device.devicectl.listProcesses())
|
|
38
41
|
.filter(({executable}) => pattern.test(executable))
|
|
39
42
|
.map(({processIdentifier}) => processIdentifier);
|
|
@@ -46,6 +49,3 @@ export async function mobileSendMemoryWarning(bundleId) {
|
|
|
46
49
|
await device.devicectl.sendMemoryWarning(pids[0]);
|
|
47
50
|
}
|
|
48
51
|
|
|
49
|
-
/**
|
|
50
|
-
* @typedef {import('../driver').XCUITestDriver} XCUITestDriver
|
|
51
|
-
*/
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import {errors} from 'appium/driver';
|
|
2
|
-
import _ from 'lodash';
|
|
3
2
|
import {waitForCondition} from 'asyncbox';
|
|
4
3
|
import { isTvOs } from '../utils';
|
|
4
|
+
import type {XCUITestDriver} from '../driver';
|
|
5
|
+
import type {Element} from '@appium/types';
|
|
5
6
|
|
|
6
7
|
// these two constitute the wait after closing a window
|
|
7
8
|
const CLOSE_WINDOW_TIMEOUT = 5000;
|
|
8
9
|
const CLOSE_WINDOW_INTERVAL = 100;
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
|
-
*
|
|
12
|
+
* Navigate back in the browser history or native app navigation.
|
|
12
13
|
*/
|
|
13
|
-
export async function back() {
|
|
14
|
+
export async function back(this: XCUITestDriver): Promise<void> {
|
|
14
15
|
if (!this.isWebContext()) {
|
|
15
16
|
await this.nativeBack();
|
|
16
17
|
} else {
|
|
@@ -19,18 +20,22 @@ export async function back() {
|
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
/**
|
|
22
|
-
*
|
|
23
|
+
* Navigate forward in the browser history.
|
|
23
24
|
*/
|
|
24
|
-
export async function forward() {
|
|
25
|
+
export async function forward(this: XCUITestDriver): Promise<void> {
|
|
25
26
|
if (!this.isWebContext()) {
|
|
27
|
+
// No-op for native context
|
|
28
|
+
return;
|
|
26
29
|
}
|
|
27
30
|
await this.mobileWebNav('forward');
|
|
28
31
|
}
|
|
29
32
|
|
|
30
33
|
/**
|
|
31
|
-
*
|
|
34
|
+
* Closes the current window in a web context.
|
|
35
|
+
*
|
|
36
|
+
* @returns Promise that resolves when the window is closed
|
|
32
37
|
*/
|
|
33
|
-
export async function closeWindow() {
|
|
38
|
+
export async function closeWindow(this: XCUITestDriver): Promise<any> {
|
|
34
39
|
if (!this.isWebContext()) {
|
|
35
40
|
throw new errors.NotImplementedError();
|
|
36
41
|
}
|
|
@@ -60,14 +65,16 @@ export async function closeWindow() {
|
|
|
60
65
|
*
|
|
61
66
|
* (Note: the version of Xcode must be 14.3+ and iOS must be 16.4+)
|
|
62
67
|
*
|
|
63
|
-
* @param
|
|
64
|
-
* @param
|
|
68
|
+
* @param url - the URL to be opened, e.g. `myscheme://yolo`
|
|
69
|
+
* @param bundleId - the application to open the given URL with. If not provided, then
|
|
65
70
|
* the application assigned by the operating system to handle URLs of the appropriate type
|
|
66
|
-
* @returns {Promise<void>}
|
|
67
71
|
* @since 4.17
|
|
68
|
-
* @this {XCUITestDriver}
|
|
69
72
|
*/
|
|
70
|
-
export async function mobileDeepLink(
|
|
73
|
+
export async function mobileDeepLink(
|
|
74
|
+
this: XCUITestDriver,
|
|
75
|
+
url: string,
|
|
76
|
+
bundleId?: string,
|
|
77
|
+
): Promise<void> {
|
|
71
78
|
return await this.proxyCommand('/url', 'POST', {
|
|
72
79
|
url,
|
|
73
80
|
bundleId,
|
|
@@ -75,51 +82,47 @@ export async function mobileDeepLink(url, bundleId) {
|
|
|
75
82
|
}
|
|
76
83
|
|
|
77
84
|
/**
|
|
78
|
-
*
|
|
85
|
+
* Navigate back in native app navigation by finding and clicking the back button.
|
|
79
86
|
*/
|
|
80
|
-
export async function nativeBack() {
|
|
87
|
+
export async function nativeBack(this: XCUITestDriver): Promise<void> {
|
|
81
88
|
if (isTvOs(this.opts.platformName)) {
|
|
82
89
|
this.log.debug(`Sending Menu button as back behavior in tvOS`);
|
|
83
90
|
return await this.mobilePressButton('Menu');
|
|
84
91
|
}
|
|
85
92
|
|
|
86
93
|
try {
|
|
87
|
-
|
|
94
|
+
const navBar = await this.findNativeElementOrElements(
|
|
88
95
|
'class name',
|
|
89
96
|
'XCUIElementTypeNavigationBar',
|
|
90
97
|
false,
|
|
91
98
|
);
|
|
92
|
-
let
|
|
93
|
-
|
|
94
|
-
'
|
|
99
|
+
let dstButton: Element<string>;
|
|
100
|
+
const backButtons = await this.findNativeElementOrElements(
|
|
101
|
+
'-ios predicate string',
|
|
102
|
+
'type == "XCUIElementTypeButton" AND label == "Back"',
|
|
95
103
|
true,
|
|
96
104
|
navBar,
|
|
97
105
|
);
|
|
98
|
-
if (
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
106
|
+
if (backButtons.length === 0) {
|
|
107
|
+
const buttons = await this.findNativeElementOrElements(
|
|
108
|
+
'-ios predicate string',
|
|
109
|
+
'type == "XCUIElementTypeButton"',
|
|
110
|
+
true,
|
|
111
|
+
navBar,
|
|
112
|
+
);
|
|
113
|
+
if (buttons.length === 0) {
|
|
114
|
+
throw new Error('No buttons found in navigation bar');
|
|
115
|
+
}
|
|
104
116
|
this.log.debug(`Found navigation bar 'back' button. Clicking.`);
|
|
117
|
+
dstButton = buttons[0];
|
|
105
118
|
} else {
|
|
106
|
-
this.log.debug(`
|
|
107
|
-
|
|
119
|
+
this.log.debug(`Did not find any navigation bar 'back' button. Clicking the first one.`);
|
|
120
|
+
dstButton = backButtons[0];
|
|
108
121
|
}
|
|
109
|
-
|
|
110
|
-
|
|
122
|
+
|
|
123
|
+
await this.nativeClick(dstButton);
|
|
124
|
+
} catch (err: any) {
|
|
111
125
|
this.log.error(`Unable to find navigation bar and back button: ${err.message}`);
|
|
112
126
|
}
|
|
113
127
|
}
|
|
114
128
|
|
|
115
|
-
/**
|
|
116
|
-
* @typedef {import('../driver').XCUITestDriver} XCUITestDriver
|
|
117
|
-
*/
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* @typedef {Object} DeepLinkOptions
|
|
121
|
-
* @property {string} url The URL to be opened. This parameter is manadatory
|
|
122
|
-
* @property {string?} bundleId The bundle identifier of an application to open the
|
|
123
|
-
* given url with. If not provided then the default application for the given url scheme
|
|
124
|
-
* is going to be used.
|
|
125
|
-
*/
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import {errors} from 'appium/driver';
|
|
2
2
|
import _ from 'lodash';
|
|
3
|
+
import type {XCUITestDriver} from '../driver';
|
|
4
|
+
import type {PushPayload, NotificationType} from './types';
|
|
5
|
+
import type {Simulator} from 'appium-ios-simulator';
|
|
3
6
|
|
|
4
7
|
/**
|
|
5
8
|
* Simulates push notification delivery to a simulated device.
|
|
@@ -7,12 +10,16 @@ import _ from 'lodash';
|
|
|
7
10
|
* **Only "remote" push notifications are supported.** VoIP, Complication, File Provider, and other types are unsupported.
|
|
8
11
|
*
|
|
9
12
|
* Supported in Xcode SDK 11.4+.
|
|
10
|
-
*
|
|
11
|
-
* @param
|
|
13
|
+
*
|
|
14
|
+
* @param bundleId - The bundle identifier of the target application
|
|
15
|
+
* @param payload - Valid push payload.
|
|
12
16
|
* @group Simulator Only
|
|
13
|
-
* @this {XCUITestDriver}
|
|
14
17
|
*/
|
|
15
|
-
export async function mobilePushNotification(
|
|
18
|
+
export async function mobilePushNotification(
|
|
19
|
+
this: XCUITestDriver,
|
|
20
|
+
bundleId: string,
|
|
21
|
+
payload: PushPayload,
|
|
22
|
+
): Promise<void> {
|
|
16
23
|
if (!this.isSimulator()) {
|
|
17
24
|
throw new Error('This extension only works on Simulator');
|
|
18
25
|
}
|
|
@@ -34,7 +41,7 @@ export async function mobilePushNotification(bundleId, payload) {
|
|
|
34
41
|
`Got ${JSON.stringify(payload.aps)} instead`,
|
|
35
42
|
);
|
|
36
43
|
}
|
|
37
|
-
|
|
44
|
+
await (this.device as Simulator).pushNotification({
|
|
38
45
|
...payload,
|
|
39
46
|
'Simulator Target Bundle': bundleId,
|
|
40
47
|
});
|
|
@@ -47,20 +54,21 @@ export async function mobilePushNotification(bundleId, payload) {
|
|
|
47
54
|
* [`XCTNSNotificationExpectation`](https://developer.apple.com/documentation/xctest/xctnsnotificationexpectation?language=objc) and
|
|
48
55
|
* [`XCTDarwinNotificationExpectation`](https://developer.apple.com/documentation/xctest/xctdarwinnotificationexpectation?language=objc) entities.
|
|
49
56
|
*
|
|
50
|
-
* @param
|
|
51
|
-
* @param
|
|
52
|
-
* @param
|
|
57
|
+
* @param name - The name of the notification to expect
|
|
58
|
+
* @param type - Which notification type to expect.
|
|
59
|
+
* @param timeoutSeconds - For how long to wait until the notification is delivered (in float seconds).
|
|
53
60
|
* @throws A [`TimeoutError`](https://www.selenium.dev/selenium/docs/api/javascript/module/selenium-webdriver/lib/error_exports_TimeoutError.html) if the expected notification has not been delivered within the given timeout.
|
|
54
|
-
* @this {XCUITestDriver}
|
|
55
61
|
*/
|
|
56
|
-
export async function mobileExpectNotification(
|
|
57
|
-
|
|
62
|
+
export async function mobileExpectNotification(
|
|
63
|
+
this: XCUITestDriver,
|
|
64
|
+
name: string,
|
|
65
|
+
type: NotificationType = 'plain',
|
|
66
|
+
timeoutSeconds: number = 60,
|
|
67
|
+
): Promise<void> {
|
|
68
|
+
await this.proxyCommand('/wda/expectNotification', 'POST', {
|
|
58
69
|
name,
|
|
59
70
|
type,
|
|
60
71
|
timeout: timeoutSeconds,
|
|
61
72
|
});
|
|
62
73
|
}
|
|
63
74
|
|
|
64
|
-
/**
|
|
65
|
-
* @typedef {import('../driver').XCUITestDriver} XCUITestDriver
|
|
66
|
-
*/
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import _ from 'lodash';
|
|
2
|
+
import { assertSimulator } from '../utils';
|
|
3
|
+
import type {XCUITestDriver} from '../driver';
|
|
4
|
+
import type {Simulator} from 'appium-ios-simulator';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Sets the Simulator's pasteboard content to the given value.
|
|
8
|
+
*
|
|
9
|
+
* Does not work for real devices.
|
|
10
|
+
*
|
|
11
|
+
* @param content - The content to set
|
|
12
|
+
* @param encoding - The content's encoding
|
|
13
|
+
* @group Simulator Only
|
|
14
|
+
*/
|
|
15
|
+
export async function mobileSetPasteboard(
|
|
16
|
+
this: XCUITestDriver,
|
|
17
|
+
content: string,
|
|
18
|
+
encoding: BufferEncoding = 'utf8',
|
|
19
|
+
): Promise<void> {
|
|
20
|
+
assertSimulator.call(this, 'Setting pasteboard content');
|
|
21
|
+
if (!_.isString(content)) {
|
|
22
|
+
// can be empty string
|
|
23
|
+
throw new Error('Pasteboard content is mandatory to set');
|
|
24
|
+
}
|
|
25
|
+
await (this.device as Simulator).simctl.setPasteboard(content, encoding);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Gets the Simulator's pasteboard content.
|
|
30
|
+
*
|
|
31
|
+
* Does not work for real devices.
|
|
32
|
+
*
|
|
33
|
+
* @param encoding - Expected encoding of returned string
|
|
34
|
+
* @group Simulator Only
|
|
35
|
+
* @returns The pasteboard content string
|
|
36
|
+
*/
|
|
37
|
+
export async function mobileGetPasteboard(
|
|
38
|
+
this: XCUITestDriver,
|
|
39
|
+
encoding: BufferEncoding = 'utf8',
|
|
40
|
+
): Promise<string> {
|
|
41
|
+
assertSimulator.call(this, 'Getting pasteboard content');
|
|
42
|
+
return await (this.device as Simulator).simctl.getPasteboard(encoding);
|
|
43
|
+
}
|
|
44
|
+
|