@limrun/appium-xcuitest-driver 10.11.0-lim.4 → 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 +0 -2
- package/build/lib/device/simulator-management.js.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 +6 -5
- package/build/lib/driver.d.ts.map +1 -1
- package/build/lib/driver.js +16 -14
- 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/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 +0 -2
- package/lib/doctor/optional-checks.ts +0 -33
- package/lib/driver.ts +19 -17
- package/lib/execute-method-map.ts +0 -9
- package/package.json +6 -6
- 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
package/lib/driver.ts
CHANGED
|
@@ -3,8 +3,6 @@ import {getSimulator} from 'appium-ios-simulator';
|
|
|
3
3
|
import {WebDriverAgent, type WebDriverAgentArgs} from 'appium-webdriveragent';
|
|
4
4
|
import {BaseDriver, DeviceSettings, errors} from 'appium/driver';
|
|
5
5
|
import {fs, mjpeg, util, timing} from 'appium/support';
|
|
6
|
-
import {Ios} from '@limrun/api';
|
|
7
|
-
import {setLimrunIosClient} from 'appium-xcode';
|
|
8
6
|
import type {
|
|
9
7
|
RouteMatcher,
|
|
10
8
|
DefaultCreateSessionResult,
|
|
@@ -23,6 +21,8 @@ import {LRUCache} from 'lru-cache';
|
|
|
23
21
|
import EventEmitter from 'node:events';
|
|
24
22
|
import path from 'node:path';
|
|
25
23
|
import url from 'node:url';
|
|
24
|
+
import {Ios} from '@limrun/api';
|
|
25
|
+
import {setLimrunIosClient} from 'appium-xcode';
|
|
26
26
|
import {
|
|
27
27
|
SUPPORTED_EXTENSIONS,
|
|
28
28
|
SAFARI_BUNDLE_ID,
|
|
@@ -43,7 +43,7 @@ import * as clipboardCommands from './commands/clipboard';
|
|
|
43
43
|
import * as conditionCommands from './commands/condition';
|
|
44
44
|
import * as contentSizeCommands from './commands/content-size';
|
|
45
45
|
import * as contextCommands from './commands/context';
|
|
46
|
-
import * as deviceInfoCommands from './commands/
|
|
46
|
+
import * as deviceInfoCommands from './commands/device-info';
|
|
47
47
|
import * as elementCommands from './commands/element';
|
|
48
48
|
import * as executeCommands from './commands/execute';
|
|
49
49
|
import * as fileMovementCommands from './commands/file-movement';
|
|
@@ -123,7 +123,7 @@ import type { PerfRecorder } from './commands/performance';
|
|
|
123
123
|
import type { AudioRecorder } from './commands/record-audio';
|
|
124
124
|
import type { TrafficCapture } from './commands/pcap';
|
|
125
125
|
import type { ScreenRecorder } from './commands/recordscreen';
|
|
126
|
-
import type { DVTServiceWithConnection } from '
|
|
126
|
+
import type { DVTServiceWithConnection } from 'appium-ios-remotexpc';
|
|
127
127
|
import type { IOSDeviceLog } from './device/log/ios-device-log';
|
|
128
128
|
import type { IOSSimulatorLog } from './device/log/ios-simulator-log';
|
|
129
129
|
import type { IOSCrashLog } from './device/log/ios-crash-log';
|
|
@@ -244,8 +244,6 @@ const MEMOIZED_FUNCTIONS = ['getStatusBarHeight', 'getDevicePixelRatio', 'getScr
|
|
|
244
244
|
// Capabilities that do not have xcodebuild process
|
|
245
245
|
const CAP_NAMES_NO_XCODEBUILD_REQUIRED = ['webDriverAgentUrl', 'usePreinstalledWDA'];
|
|
246
246
|
|
|
247
|
-
const BUNDLE_VERSION_PATTERN = /CFBundleVersion\s+=\s+"?([^(;|")]+)/;
|
|
248
|
-
|
|
249
247
|
export class XCUITestDriver
|
|
250
248
|
extends BaseDriver<XCUITestDriverConstraints, StringRecord>
|
|
251
249
|
implements ExternalDriver<XCUITestDriverConstraints, FullContext|string, StringRecord> {
|
|
@@ -280,7 +278,7 @@ export class XCUITestDriver
|
|
|
280
278
|
_device: Simulator | RealDevice;
|
|
281
279
|
_iosSdkVersion: string | null;
|
|
282
280
|
_wda: WebDriverAgent | null;
|
|
283
|
-
|
|
281
|
+
_remote: RemoteDebugger | null;
|
|
284
282
|
logs: DriverLogs;
|
|
285
283
|
_bidiServerLogListener: LogListener | undefined;
|
|
286
284
|
|
|
@@ -295,7 +293,7 @@ export class XCUITestDriver
|
|
|
295
293
|
pageLoadMs: number;
|
|
296
294
|
landscapeWebCoordsOffset: number;
|
|
297
295
|
mjpegStream?: mjpeg.MJpegStream;
|
|
298
|
-
_limClient
|
|
296
|
+
_limClient?: Ios.InstanceClient;
|
|
299
297
|
|
|
300
298
|
constructor(opts: XCUITestDriverOpts, shouldValidateCaps = true) {
|
|
301
299
|
super(opts, shouldValidateCaps);
|
|
@@ -340,12 +338,10 @@ export class XCUITestDriver
|
|
|
340
338
|
this.lifecycleData = {};
|
|
341
339
|
this._audioRecorder = null;
|
|
342
340
|
this.appInfosCache = new AppInfosCache(this.log);
|
|
343
|
-
this.
|
|
341
|
+
this._remote = null;
|
|
344
342
|
this.doesSupportBidi = true;
|
|
345
343
|
this._wda = null;
|
|
346
|
-
this._limClient = null;
|
|
347
344
|
}
|
|
348
|
-
|
|
349
345
|
/**
|
|
350
346
|
* Gets the Limrun iOS instance client.
|
|
351
347
|
* @throws {Error} If the client has not been initialized.
|
|
@@ -480,7 +476,7 @@ export class XCUITestDriver
|
|
|
480
476
|
}
|
|
481
477
|
}
|
|
482
478
|
|
|
483
|
-
if (this.
|
|
479
|
+
if (this._remote) {
|
|
484
480
|
this.log.debug('Found a remote debugger session. Removing...');
|
|
485
481
|
await this.stopRemote();
|
|
486
482
|
}
|
|
@@ -526,7 +522,7 @@ export class XCUITestDriver
|
|
|
526
522
|
this.log.debug(`Executing command '${cmd}'`);
|
|
527
523
|
|
|
528
524
|
if (cmd === 'receiveAsyncResponse') {
|
|
529
|
-
return await this.receiveAsyncResponse(
|
|
525
|
+
return await this.receiveAsyncResponse(args[0], args[1]);
|
|
530
526
|
}
|
|
531
527
|
// TODO: once this fix gets into base driver remove from here
|
|
532
528
|
if (cmd === 'getStatus') {
|
|
@@ -697,6 +693,13 @@ export class XCUITestDriver
|
|
|
697
693
|
return this._wda;
|
|
698
694
|
}
|
|
699
695
|
|
|
696
|
+
get remote(): RemoteDebugger {
|
|
697
|
+
if (!this._remote) {
|
|
698
|
+
throw new Error('Remote debugger is not initialized');
|
|
699
|
+
}
|
|
700
|
+
return this._remote;
|
|
701
|
+
}
|
|
702
|
+
|
|
700
703
|
get driverData(): Record<string, any> {
|
|
701
704
|
// TODO fill out resource info here
|
|
702
705
|
return {};
|
|
@@ -884,8 +887,7 @@ export class XCUITestDriver
|
|
|
884
887
|
await this.runReset();
|
|
885
888
|
|
|
886
889
|
this._wda = new WebDriverAgent(
|
|
887
|
-
|
|
888
|
-
this.xcodeVersion,
|
|
890
|
+
undefined,
|
|
889
891
|
{
|
|
890
892
|
...this.opts,
|
|
891
893
|
device: this.device,
|
|
@@ -1368,9 +1370,9 @@ export class XCUITestDriver
|
|
|
1368
1370
|
try {
|
|
1369
1371
|
const device = await getSimulator(this.opts.udid, {
|
|
1370
1372
|
devicesSetPath: this.opts.simulatorDevicesSetPath,
|
|
1373
|
+
limClient: this.limClient,
|
|
1371
1374
|
// @ts-ignore This is ok
|
|
1372
1375
|
logger: this.log,
|
|
1373
|
-
limClient: this.limClient,
|
|
1374
1376
|
});
|
|
1375
1377
|
return {device, realDevice: false, udid: this.opts.udid};
|
|
1376
1378
|
} catch {
|
|
@@ -1764,7 +1766,7 @@ export class XCUITestDriver
|
|
|
1764
1766
|
this.implicitWaitMs = 0;
|
|
1765
1767
|
this.pageLoadMs = 6000;
|
|
1766
1768
|
this.landscapeWebCoordsOffset = 0;
|
|
1767
|
-
this.
|
|
1769
|
+
this._remote = null;
|
|
1768
1770
|
this._conditionInducerService = null;
|
|
1769
1771
|
this._remoteXPCConditionInducerConnection = null;
|
|
1770
1772
|
|
|
@@ -215,7 +215,6 @@ export const executeMethodMap = {
|
|
|
215
215
|
command: 'getViewportRect',
|
|
216
216
|
},
|
|
217
217
|
'mobile: startPerfRecord': {
|
|
218
|
-
// @ts-expect-error Class field assignment - method exists on XCUITestDriver
|
|
219
218
|
command: 'mobileStartPerfRecord',
|
|
220
219
|
params: {
|
|
221
220
|
optional: ['timeout', 'profileName', 'pid'],
|
|
@@ -253,7 +252,6 @@ export const executeMethodMap = {
|
|
|
253
252
|
command: 'mobileListCertificates',
|
|
254
253
|
},
|
|
255
254
|
'mobile: startLogsBroadcast': {
|
|
256
|
-
// @ts-expect-error Class field assignment - method exists on XCUITestDriver
|
|
257
255
|
command: 'mobileStartLogsBroadcast',
|
|
258
256
|
},
|
|
259
257
|
'mobile: stopLogsBroadcast': {
|
|
@@ -468,28 +466,24 @@ export const executeMethodMap = {
|
|
|
468
466
|
command: 'mobileResetLocationService',
|
|
469
467
|
},
|
|
470
468
|
'mobile: startPcap': {
|
|
471
|
-
// @ts-expect-error Class field assignment - method exists on XCUITestDriver
|
|
472
469
|
command: 'mobileStartPcap',
|
|
473
470
|
params: {
|
|
474
471
|
optional: ['timeLimitSec', 'forceRestart'],
|
|
475
472
|
},
|
|
476
473
|
},
|
|
477
474
|
'mobile: stopPcap': {
|
|
478
|
-
// @ts-expect-error Class field assignment - method exists on XCUITestDriver
|
|
479
475
|
command: 'mobileStopPcap',
|
|
480
476
|
},
|
|
481
477
|
'mobile: listConditionInducers': {
|
|
482
478
|
command: 'listConditionInducers',
|
|
483
479
|
},
|
|
484
480
|
'mobile: enableConditionInducer': {
|
|
485
|
-
// @ts-expect-error Class field assignment - method exists on XCUITestDriver
|
|
486
481
|
command: 'enableConditionInducer',
|
|
487
482
|
params: {
|
|
488
483
|
required: ['conditionID', 'profileID'],
|
|
489
484
|
},
|
|
490
485
|
},
|
|
491
486
|
'mobile: disableConditionInducer': {
|
|
492
|
-
// @ts-expect-error Class field assignment - method exists on XCUITestDriver
|
|
493
487
|
command: 'disableConditionInducer',
|
|
494
488
|
},
|
|
495
489
|
'mobile: updateSafariPreferences': {
|
|
@@ -499,7 +493,6 @@ export const executeMethodMap = {
|
|
|
499
493
|
},
|
|
500
494
|
},
|
|
501
495
|
'mobile: calibrateWebToRealCoordinatesTranslation': {
|
|
502
|
-
// @ts-expect-error Class field assignment - method exists on XCUITestDriver
|
|
503
496
|
command: 'mobileCalibrateWebToRealCoordinatesTranslation',
|
|
504
497
|
},
|
|
505
498
|
'mobile: keys': {
|
|
@@ -532,7 +525,6 @@ export const executeMethodMap = {
|
|
|
532
525
|
command: 'mobileShake',
|
|
533
526
|
},
|
|
534
527
|
'mobile: startAudioRecording': {
|
|
535
|
-
// @ts-expect-error Class field assignment - method exists on XCUITestDriver
|
|
536
528
|
command: 'startAudioRecording',
|
|
537
529
|
params: {
|
|
538
530
|
required: ['audioInput'],
|
|
@@ -547,7 +539,6 @@ export const executeMethodMap = {
|
|
|
547
539
|
},
|
|
548
540
|
},
|
|
549
541
|
'mobile: stopAudioRecording': {
|
|
550
|
-
// @ts-expect-error Class field assignment - method exists on XCUITestDriver
|
|
551
542
|
command: 'stopAudioRecording',
|
|
552
543
|
},
|
|
553
544
|
'mobile: hideKeyboard': {
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"xcuitest",
|
|
9
9
|
"xctest"
|
|
10
10
|
],
|
|
11
|
-
"version": "10.
|
|
11
|
+
"version": "10.14.6-lim.1",
|
|
12
12
|
"author": "Appium Contributors",
|
|
13
13
|
"license": "Apache-2.0",
|
|
14
14
|
"repository": {
|
|
@@ -82,15 +82,15 @@
|
|
|
82
82
|
"dependencies": {
|
|
83
83
|
"@appium/strongbox": "^1.0.0-rc.1",
|
|
84
84
|
"@colors/colors": "^1.6.0",
|
|
85
|
-
"@limrun/api": "0.18.3",
|
|
85
|
+
"@limrun/api": "^0.18.3",
|
|
86
86
|
"appium-idb": "^2.0.0",
|
|
87
87
|
"appium-ios-device": "^3.0.0",
|
|
88
|
-
"appium-ios-simulator": "npm:@limrun/appium-ios-simulator@8.0.
|
|
88
|
+
"appium-ios-simulator": "npm:@limrun/appium-ios-simulator@8.0.9-lim.2",
|
|
89
89
|
"appium-remote-debugger": "npm:@limrun/appium-remote-debugger@15.2.7-lim.4",
|
|
90
90
|
"appium-webdriveragent": "npm:@limrun/appium-webdriveragent@10.4.2-lim.1",
|
|
91
|
-
"appium-xcode": "npm:@limrun/appium-xcode@6.1.
|
|
91
|
+
"appium-xcode": "npm:@limrun/appium-xcode@6.1.6-lim.1",
|
|
92
92
|
"async-lock": "^1.4.0",
|
|
93
|
-
"asyncbox": "^
|
|
93
|
+
"asyncbox": "^4.0.1",
|
|
94
94
|
"bluebird": "^3.7.2",
|
|
95
95
|
"commander": "^14.0.1",
|
|
96
96
|
"css-selector-parser": "^3.0.0",
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
"moment": "^2.29.4",
|
|
101
101
|
"moment-timezone": "^0.x",
|
|
102
102
|
"node-devicectl": "^1.1.0",
|
|
103
|
-
"node-simctl": "npm:@limrun/node-simctl@8.1.
|
|
103
|
+
"node-simctl": "npm:@limrun/node-simctl@8.1.3-lim.1",
|
|
104
104
|
"portscanner": "^2.2.0",
|
|
105
105
|
"semver": "^7.5.4",
|
|
106
106
|
"teen_process": "^3.0.0",
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Returns information about the active application.
|
|
3
|
-
*
|
|
4
|
-
* @returns {Promise<import('./types').ActiveAppInfo>} Active app information
|
|
5
|
-
* @throws {Error} if an error raised by command
|
|
6
|
-
* @this {import('../driver').XCUITestDriver}
|
|
7
|
-
*/
|
|
8
|
-
export async function mobileGetActiveAppInfo() {
|
|
9
|
-
return /** @type {import('./types').ActiveAppInfo} */ (
|
|
10
|
-
await this.proxyCommand('/wda/activeAppInfo', 'GET')
|
|
11
|
-
);
|
|
12
|
-
}
|
package/lib/commands/alert.js
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @this {XCUITestDriver}
|
|
3
|
-
*/
|
|
4
|
-
export async function getAlertText() {
|
|
5
|
-
return /** @type {string|null} */ (await this.proxyCommand('/alert/text', 'GET'));
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* @param {string} value
|
|
10
|
-
* @this {XCUITestDriver}
|
|
11
|
-
* @returns {Promise<void>}
|
|
12
|
-
*/
|
|
13
|
-
export async function setAlertText(value) {
|
|
14
|
-
await this.proxyCommand('/alert/text', 'POST', {value});
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* @param { {buttonLabel?: string} } opts
|
|
19
|
-
* @returns {Promise<void>}
|
|
20
|
-
* @this {XCUITestDriver}
|
|
21
|
-
*/
|
|
22
|
-
export async function postAcceptAlert(opts = {}) {
|
|
23
|
-
await this.proxyCommand('/alert/accept', 'POST', toAlertParams(opts));
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* @param { {buttonLabel?: string} } opts
|
|
28
|
-
* @returns {Promise<void>}
|
|
29
|
-
* @this {XCUITestDriver}
|
|
30
|
-
*/
|
|
31
|
-
export async function postDismissAlert(opts = {}) {
|
|
32
|
-
await this.proxyCommand('/alert/dismiss', 'POST', toAlertParams(opts));
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* @internal
|
|
37
|
-
* @this {XCUITestDriver}
|
|
38
|
-
* @returns {Promise<string[]>} The list of button labels
|
|
39
|
-
*/
|
|
40
|
-
export async function getAlertButtons() {
|
|
41
|
-
return /** @type {string[]} */ (await this.proxyCommand('/wda/alert/buttons', 'GET'));
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Tries to apply the given action to the currently visible alert.
|
|
46
|
-
*
|
|
47
|
-
* @param {AlertAction} action - The actual action to apply.
|
|
48
|
-
* @param {string} [buttonLabel] - The name of the button used to perform the chosen alert action. Only makes sense if the action is `accept` or `dismiss`.
|
|
49
|
-
* @returns {Promise<string[]|void>} If `action` is `getButtons`, a list of alert button labelsp; otherwise nothing.
|
|
50
|
-
* @remarks This should really be separate commands.
|
|
51
|
-
* @this {XCUITestDriver}
|
|
52
|
-
*/
|
|
53
|
-
export async function mobileHandleAlert(action, buttonLabel) {
|
|
54
|
-
switch (action) {
|
|
55
|
-
case 'accept':
|
|
56
|
-
return await this.postAcceptAlert({buttonLabel});
|
|
57
|
-
case 'dismiss':
|
|
58
|
-
return await this.postDismissAlert({buttonLabel});
|
|
59
|
-
case 'getButtons':
|
|
60
|
-
return await this.getAlertButtons();
|
|
61
|
-
default:
|
|
62
|
-
throw new Error(
|
|
63
|
-
`The 'action' value should be either 'accept', 'dismiss' or 'getButtons'. ` +
|
|
64
|
-
`'${action}' is provided instead.`,
|
|
65
|
-
);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
*
|
|
71
|
-
* @param { {buttonLabel?: string} } opts
|
|
72
|
-
* @returns { {name?: string} }
|
|
73
|
-
*/
|
|
74
|
-
function toAlertParams(opts = {}) {
|
|
75
|
-
const params = {};
|
|
76
|
-
if (opts.buttonLabel) {
|
|
77
|
-
params.name = opts.buttonLabel;
|
|
78
|
-
}
|
|
79
|
-
return params;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* @typedef {'accept'|'dismiss'|'getButtons'} AlertAction
|
|
84
|
-
*/
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* @typedef {import('../driver').XCUITestDriver} XCUITestDriver
|
|
88
|
-
*/
|
|
@@ -1,346 +0,0 @@
|
|
|
1
|
-
import _ from 'lodash';
|
|
2
|
-
import {fs, util} from 'appium/support';
|
|
3
|
-
import {errors} from 'appium/driver';
|
|
4
|
-
import {services} from 'appium-ios-device';
|
|
5
|
-
import path from 'node:path';
|
|
6
|
-
import B from 'bluebird';
|
|
7
|
-
import {
|
|
8
|
-
SUPPORTED_EXTENSIONS,
|
|
9
|
-
onPostConfigureApp,
|
|
10
|
-
onDownloadApp,
|
|
11
|
-
} from '../app-utils';
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Installs the given application to the device under test.
|
|
15
|
-
*
|
|
16
|
-
* Please ensure the app is built for a correct architecture and is signed with a proper developer signature (for real devices) prior to calling this.
|
|
17
|
-
* @param {string} app - See docs for `appium:app` capability
|
|
18
|
-
* @param {number} [timeoutMs] - The maximum time to wait until app install is finished (in ms) on real devices.
|
|
19
|
-
* If not provided, then the value of `appium:appPushTimeout` capability is used. If the capability is not provided then the default is 240000ms (4 minutes).
|
|
20
|
-
* @param {boolean} [checkVersion] - If the application installation follows currently installed application's version status if provided.
|
|
21
|
-
* No checking occurs if no this option.
|
|
22
|
-
* @privateRemarks Link to capability docs
|
|
23
|
-
* @returns {Promise<void>}
|
|
24
|
-
* @this {XCUITestDriver}
|
|
25
|
-
*/
|
|
26
|
-
export async function mobileInstallApp(app, timeoutMs, checkVersion) {
|
|
27
|
-
const srcAppPath = await this.helpers.configureApp(app, {
|
|
28
|
-
onPostProcess: onPostConfigureApp.bind(this),
|
|
29
|
-
onDownload: onDownloadApp.bind(this),
|
|
30
|
-
supportedExtensions: SUPPORTED_EXTENSIONS,
|
|
31
|
-
});
|
|
32
|
-
this.log.info(
|
|
33
|
-
`Installing '${srcAppPath}' to the ${this.isRealDevice() ? 'real device' : 'Simulator'} ` +
|
|
34
|
-
`with UDID '${this.device.udid}'`,
|
|
35
|
-
);
|
|
36
|
-
if (!(await fs.exists(srcAppPath))) {
|
|
37
|
-
throw this.log.errorWithException(
|
|
38
|
-
`The application at '${srcAppPath}' does not exist or is not accessible`,
|
|
39
|
-
);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const bundleId = await this.appInfosCache.extractBundleId(srcAppPath);
|
|
43
|
-
if (checkVersion) {
|
|
44
|
-
const {install} = await this.checkAutInstallationState({
|
|
45
|
-
enforceAppInstall: false,
|
|
46
|
-
fullReset: false,
|
|
47
|
-
noReset: false,
|
|
48
|
-
bundleId,
|
|
49
|
-
app: srcAppPath,
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
if (!install) {
|
|
53
|
-
this.log.info(`Skipping the installation of '${bundleId}'`);
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
await this.device.installApp(
|
|
59
|
-
srcAppPath,
|
|
60
|
-
bundleId,
|
|
61
|
-
{
|
|
62
|
-
timeoutMs: timeoutMs ?? this.opts.appPushTimeout
|
|
63
|
-
},
|
|
64
|
-
);
|
|
65
|
-
this.log.info(`Installation of '${srcAppPath}' succeeded`);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Checks whether the given application is installed on the device under test.
|
|
70
|
-
* Offload app is handled as not installed.
|
|
71
|
-
*
|
|
72
|
-
* @param {string} bundleId - The bundle identifier of the application to be checked
|
|
73
|
-
* @returns {Promise<boolean>} `true` if the application is installed; `false` otherwise
|
|
74
|
-
* @this {XCUITestDriver}
|
|
75
|
-
*/
|
|
76
|
-
export async function mobileIsAppInstalled(bundleId) {
|
|
77
|
-
const installed = await this.device.isAppInstalled(bundleId);
|
|
78
|
-
this.log.info(`App '${bundleId}' is${installed ? '' : ' not'} installed`);
|
|
79
|
-
return installed;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Removes/uninstalls the given application from the device under test.
|
|
84
|
-
* Offload app data could also be removed.
|
|
85
|
-
*
|
|
86
|
-
* @param {string} bundleId - The bundle identifier of the application to be removed
|
|
87
|
-
* @returns {Promise<boolean>} `true` if the application has been removed successfully; `false` otherwise
|
|
88
|
-
* @this {XCUITestDriver}
|
|
89
|
-
*/
|
|
90
|
-
export async function mobileRemoveApp(bundleId) {
|
|
91
|
-
this.log.info(
|
|
92
|
-
`Uninstalling the application with bundle identifier '${bundleId}' ` +
|
|
93
|
-
`from the ${this.isRealDevice() ? 'real device' : 'Simulator'} with UDID '${this.device.udid}'`,
|
|
94
|
-
);
|
|
95
|
-
try {
|
|
96
|
-
await this.device.removeApp(bundleId);
|
|
97
|
-
this.log.info(`Removal of '${bundleId}' succeeded`);
|
|
98
|
-
return true;
|
|
99
|
-
} catch (err) {
|
|
100
|
-
this.log.warn(`Cannot remove '${bundleId}'. Original error: ${err.message}`);
|
|
101
|
-
return false;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* Executes the given app on the device under test.
|
|
107
|
-
*
|
|
108
|
-
* If the app is already running it will be activated. If the app is not installed or cannot be launched then an exception is thrown.
|
|
109
|
-
* @param {string} bundleId - The bundle identifier of the application to be launched
|
|
110
|
-
* @param {string|string[]} [args] - One or more command line arguments for the app. If the app is already running then this argument is ignored.
|
|
111
|
-
* @param {object} [environment] - Environment variables mapping for the app. If the app is already running then this argument is ignored.
|
|
112
|
-
* @returns {Promise<void>}
|
|
113
|
-
* @this {XCUITestDriver}
|
|
114
|
-
*/
|
|
115
|
-
export async function mobileLaunchApp(bundleId, args, environment) {
|
|
116
|
-
/** @type { {arguments?: any[], environment?: any, bundleId: string} } */
|
|
117
|
-
const launchOptions = {bundleId};
|
|
118
|
-
if (args) {
|
|
119
|
-
launchOptions.arguments = Array.isArray(args) ? args : [args];
|
|
120
|
-
}
|
|
121
|
-
if (environment) {
|
|
122
|
-
launchOptions.environment = environment;
|
|
123
|
-
}
|
|
124
|
-
await this.proxyCommand('/wda/apps/launch', 'POST', launchOptions);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* Terminates the given app on the device under test.
|
|
129
|
-
*
|
|
130
|
-
* This command performs termination via [XCTest's `terminate`](https://developer.apple.com/documentation/xctest/xcuiapplication/1500637-terminate) API. If the app is not installed an exception is thrown. If the app is not running then nothing is done.
|
|
131
|
-
* @param {string} bundleId - The bundle identifier of the application to be terminated
|
|
132
|
-
* @returns {Promise<boolean>} `true` if the app has been terminated successfully; `false` otherwise
|
|
133
|
-
* @this {XCUITestDriver}
|
|
134
|
-
*/
|
|
135
|
-
export async function mobileTerminateApp(bundleId) {
|
|
136
|
-
return /** @type {boolean} */ (
|
|
137
|
-
await this.proxyCommand('/wda/apps/terminate', 'POST', {bundleId})
|
|
138
|
-
);
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
/**
|
|
142
|
-
* Activate the given app on the device under test.
|
|
143
|
-
*
|
|
144
|
-
* This pushes the app to the foreground if it is running in the background. An exception is thrown if the app is not install or isn't running. Nothing is done if the app is already in the foreground.
|
|
145
|
-
*
|
|
146
|
-
* @param {string} bundleId - The bundle identifier of the application to be activated
|
|
147
|
-
* @returns {Promise<void>}
|
|
148
|
-
* @this {XCUITestDriver}
|
|
149
|
-
*/
|
|
150
|
-
export async function mobileActivateApp(bundleId) {
|
|
151
|
-
await this.proxyCommand('/wda/apps/activate', 'POST', {bundleId});
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* Kill the given app on the real device under test by instruments service.
|
|
156
|
-
*
|
|
157
|
-
* If the app is not running or kill failed, then nothing is done.
|
|
158
|
-
*
|
|
159
|
-
* @remarks `appium-xcuitest-driver` v4.4 does not require `py-ios-device` to be installed.
|
|
160
|
-
* @privateRemarks See implementation at https://github.com/YueChen-C/py-ios-device/blob/51f4683c5c3c385a015858ada07a5f1c62d3cf57/ios_device/cli/base.py#L220
|
|
161
|
-
* @see https://github.com/YueChen-C/py-ios-device
|
|
162
|
-
* @param {string} bundleId - The bundle identifier of the application to be killed
|
|
163
|
-
* @returns {Promise<boolean>} `true` if the app has been killed successfully; `false` otherwise
|
|
164
|
-
* @group Real Device Only
|
|
165
|
-
* @this {XCUITestDriver}
|
|
166
|
-
*/
|
|
167
|
-
export async function mobileKillApp(bundleId) {
|
|
168
|
-
if (!this.isRealDevice()) {
|
|
169
|
-
throw new errors.UnsupportedOperationError('A real device is required');
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
return await /** @type {import('../device/real-device-management').RealDevice} */ (this.device).terminateApp(
|
|
173
|
-
bundleId, String(this.opts.platformVersion)
|
|
174
|
-
);
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
/**
|
|
178
|
-
* Queries the state of an installed application from the device under test.
|
|
179
|
-
*
|
|
180
|
-
* If the app with the given `bundleId` is not installed, an exception will be thrown.
|
|
181
|
-
*
|
|
182
|
-
* @param {string} bundleId - The bundle identifier of the application to be queried
|
|
183
|
-
* @returns {Promise<AppState>} The actual application state code
|
|
184
|
-
* @see https://developer.apple.com/documentation/xctest/xcuiapplicationstate?language=objc
|
|
185
|
-
* @this {XCUITestDriver}
|
|
186
|
-
*/
|
|
187
|
-
export async function mobileQueryAppState(bundleId) {
|
|
188
|
-
return /** @type {AppState} */ (await this.proxyCommand('/wda/apps/state', 'POST', {bundleId}));
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
/**
|
|
192
|
-
* @param {string} appPath
|
|
193
|
-
* @param {object} opts
|
|
194
|
-
* @this {XCUITestDriver}
|
|
195
|
-
*/
|
|
196
|
-
export async function installApp(appPath, {timeoutMs, strategy} = {}) {
|
|
197
|
-
// @ts-ignore Probably a TS bug
|
|
198
|
-
await this.mobileInstallApp(appPath, timeoutMs, strategy);
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
/**
|
|
202
|
-
* @param {string} bundleId
|
|
203
|
-
* @param {object} opts
|
|
204
|
-
* @this {XCUITestDriver}
|
|
205
|
-
*/
|
|
206
|
-
export async function activateApp(bundleId, opts = {}) {
|
|
207
|
-
const {environment, arguments: args} = opts;
|
|
208
|
-
// @ts-ignore Probably a TS bug
|
|
209
|
-
return await this.mobileLaunchApp(bundleId, args, environment);
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
/**
|
|
213
|
-
* @param {string} bundleId
|
|
214
|
-
* @this {XCUITestDriver}
|
|
215
|
-
*/
|
|
216
|
-
export async function isAppInstalled(bundleId) {
|
|
217
|
-
return await this.mobileIsAppInstalled(bundleId);
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
/**
|
|
221
|
-
* @param {string} bundleId
|
|
222
|
-
* @this {XCUITestDriver}
|
|
223
|
-
* @returns {Promise<boolean>}
|
|
224
|
-
*/
|
|
225
|
-
export async function terminateApp(bundleId) {
|
|
226
|
-
return await this.mobileTerminateApp(bundleId);
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
/**
|
|
230
|
-
* @param {string} bundleId
|
|
231
|
-
* @this {XCUITestDriver}
|
|
232
|
-
*/
|
|
233
|
-
export async function queryAppState(bundleId) {
|
|
234
|
-
return await this.mobileQueryAppState(bundleId);
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
/**
|
|
238
|
-
* List applications installed on the real device under test
|
|
239
|
-
*
|
|
240
|
-
* Read [Pushing/Pulling files](https://appium.io/docs/en/writing-running-appium/ios/ios-xctest-file-movement/) for more details.
|
|
241
|
-
* @param {'User'|'System'} applicationType - The type of applications to list.
|
|
242
|
-
* @returns {Promise<Record<string,any>[]>} A list of apps where each item is a mapping of bundle identifiers to maps of platform-specific app properties.
|
|
243
|
-
* @remarks Having `UIFileSharingEnabled` set to `true` in the return app properties map means this app supports file upload/download in its `documents` container.
|
|
244
|
-
* @group Real Device Only
|
|
245
|
-
*/
|
|
246
|
-
export async function mobileListApps(applicationType = 'User') {
|
|
247
|
-
if (!this.isRealDevice()) {
|
|
248
|
-
throw new errors.NotImplementedError(`This extension is only supported on real devices`);
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
const service = await services.startInstallationProxyService(this.device.udid);
|
|
252
|
-
try {
|
|
253
|
-
return await service.listApplications({applicationType});
|
|
254
|
-
} finally {
|
|
255
|
-
service.close();
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
/**
|
|
260
|
-
* Deletes application data files, so it could start from the clean state next time
|
|
261
|
-
* it is launched.
|
|
262
|
-
* This API only works on a Simulator.
|
|
263
|
-
*
|
|
264
|
-
* @param {string} bundleId Application bundle identifier
|
|
265
|
-
* @this {XCUITestDriver}
|
|
266
|
-
* @returns {Promise<boolean>} true if any files from the app's data container have been deleted
|
|
267
|
-
*/
|
|
268
|
-
export async function mobileClearApp(bundleId) {
|
|
269
|
-
if (this.isRealDevice()) {
|
|
270
|
-
throw new errors.NotImplementedError(
|
|
271
|
-
`This extension is only supported on simulators. ` +
|
|
272
|
-
`The only known way to clear app data on real devices ` +
|
|
273
|
-
`would be to uninstall the app then perform a fresh install of it.`
|
|
274
|
-
);
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
const simctl = /** @type {import('appium-ios-simulator').Simulator} */ (this.device).simctl;
|
|
278
|
-
const dataRoot = await simctl.getAppContainer(bundleId, 'data');
|
|
279
|
-
this.log.debug(`Got the data container root of ${bundleId} at '${dataRoot}'`);
|
|
280
|
-
if (!await fs.exists(dataRoot)) {
|
|
281
|
-
return false;
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
await this.mobileTerminateApp(bundleId);
|
|
285
|
-
const items = await fs.readdir(dataRoot);
|
|
286
|
-
if (!items.length) {
|
|
287
|
-
return false;
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
await B.all(items.map((item) => fs.rimraf(path.join(dataRoot, item))));
|
|
291
|
-
this.log.info(
|
|
292
|
-
`Cleaned up ${util.pluralize('item', items.length, true)} from ${bundleId}'s data container`
|
|
293
|
-
);
|
|
294
|
-
return true;
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
/**
|
|
298
|
-
* Close app (simulate device home button). It is possible to restore
|
|
299
|
-
* the app after the timeout or keep it minimized based on the parameter value.
|
|
300
|
-
*
|
|
301
|
-
* @param {number|{timeout: number?}} [seconds]
|
|
302
|
-
* - any positive number of seconds: come back after X seconds
|
|
303
|
-
* - any negative number of seconds or zero: never come back
|
|
304
|
-
* - undefined/null: never come back
|
|
305
|
-
* - {timeout: 5000}: come back after 5 seconds
|
|
306
|
-
* - {timeout: null}, {timeout: -2}: never come back
|
|
307
|
-
* @this {XCUITestDriver}
|
|
308
|
-
*/
|
|
309
|
-
export async function background(seconds) {
|
|
310
|
-
const homescreen = '/wda/homescreen';
|
|
311
|
-
const deactivateApp = '/wda/deactivateApp';
|
|
312
|
-
|
|
313
|
-
let endpoint;
|
|
314
|
-
let params = {};
|
|
315
|
-
const selectEndpoint = (timeoutSeconds) => {
|
|
316
|
-
if (!util.hasValue(timeoutSeconds)) {
|
|
317
|
-
endpoint = homescreen;
|
|
318
|
-
} else if (!isNaN(timeoutSeconds)) {
|
|
319
|
-
const duration = parseFloat(timeoutSeconds);
|
|
320
|
-
if (duration >= 0) {
|
|
321
|
-
params = {duration};
|
|
322
|
-
endpoint = deactivateApp;
|
|
323
|
-
} else {
|
|
324
|
-
endpoint = homescreen;
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
};
|
|
328
|
-
if (seconds && !_.isNumber(seconds) && _.has(seconds, 'timeout')) {
|
|
329
|
-
const timeout = seconds.timeout;
|
|
330
|
-
selectEndpoint(isNaN(Number(timeout)) ? timeout : parseFloat(String(timeout)) / 1000.0);
|
|
331
|
-
} else {
|
|
332
|
-
selectEndpoint(seconds);
|
|
333
|
-
}
|
|
334
|
-
if (!endpoint) {
|
|
335
|
-
throw new errors.InvalidArgumentError(
|
|
336
|
-
`Argument value is expected to be a valid number. ` +
|
|
337
|
-
`${JSON.stringify(seconds)} has been provided instead`,
|
|
338
|
-
);
|
|
339
|
-
}
|
|
340
|
-
return await this.proxyCommand(endpoint, 'POST', params, endpoint !== homescreen);
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
/**
|
|
344
|
-
* @typedef {import('../driver').XCUITestDriver} XCUITestDriver
|
|
345
|
-
* @typedef {import('./enum').AppState} AppState
|
|
346
|
-
*/
|