appium-xcuitest-driver 10.3.0 → 10.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/build/lib/commands/active-app-info.d.ts +9 -0
- package/build/lib/commands/active-app-info.d.ts.map +1 -0
- package/build/lib/commands/active-app-info.js +14 -0
- package/build/lib/commands/active-app-info.js.map +1 -0
- package/build/lib/commands/alert.d.ts +42 -45
- package/build/lib/commands/alert.d.ts.map +1 -1
- package/build/lib/commands/alert.js +66 -62
- package/build/lib/commands/alert.js.map +1 -1
- package/build/lib/commands/app-management.d.ts +150 -153
- package/build/lib/commands/app-management.d.ts.map +1 -1
- package/build/lib/commands/app-management.js +300 -286
- package/build/lib/commands/app-management.js.map +1 -1
- package/build/lib/commands/app-strings.d.ts +14 -17
- package/build/lib/commands/app-strings.d.ts.map +1 -1
- package/build/lib/commands/app-strings.js +23 -24
- package/build/lib/commands/app-strings.js.map +1 -1
- package/build/lib/commands/appearance.d.ts +19 -22
- package/build/lib/commands/appearance.d.ts.map +1 -1
- package/build/lib/commands/appearance.js +56 -56
- package/build/lib/commands/appearance.js.map +1 -1
- package/build/lib/commands/audit.d.ts +22 -17
- package/build/lib/commands/audit.d.ts.map +1 -1
- package/build/lib/commands/audit.js +17 -18
- package/build/lib/commands/audit.js.map +1 -1
- package/build/lib/commands/battery.d.ts +11 -14
- package/build/lib/commands/battery.d.ts.map +1 -1
- package/build/lib/commands/battery.js +36 -37
- package/build/lib/commands/battery.js.map +1 -1
- package/build/lib/commands/biometric.d.ts +30 -33
- package/build/lib/commands/biometric.d.ts.map +1 -1
- package/build/lib/commands/biometric.js +42 -41
- package/build/lib/commands/biometric.js.map +1 -1
- package/build/lib/commands/certificate.d.ts +48 -45
- package/build/lib/commands/certificate.d.ts.map +1 -1
- package/build/lib/commands/certificate.js +218 -205
- package/build/lib/commands/certificate.js.map +1 -1
- package/build/lib/commands/clipboard.d.ts +19 -22
- package/build/lib/commands/clipboard.d.ts.map +1 -1
- package/build/lib/commands/clipboard.js +30 -30
- package/build/lib/commands/clipboard.js.map +1 -1
- package/build/lib/commands/condition.d.ts +49 -26
- package/build/lib/commands/condition.d.ts.map +1 -1
- package/build/lib/commands/condition.js +87 -86
- package/build/lib/commands/condition.js.map +1 -1
- package/build/lib/commands/content-size.d.ts +26 -29
- package/build/lib/commands/content-size.d.ts.map +1 -1
- package/build/lib/commands/content-size.js +36 -36
- package/build/lib/commands/content-size.js.map +1 -1
- package/build/lib/commands/context.d.ts +161 -108
- package/build/lib/commands/context.d.ts.map +1 -1
- package/build/lib/commands/context.js +530 -517
- package/build/lib/commands/context.js.map +1 -1
- package/build/lib/commands/deviceInfo.d.ts +9 -12
- package/build/lib/commands/deviceInfo.d.ts.map +1 -1
- package/build/lib/commands/deviceInfo.js +17 -18
- package/build/lib/commands/deviceInfo.js.map +1 -1
- package/build/lib/commands/element.d.ts +102 -105
- package/build/lib/commands/element.d.ts.map +1 -1
- package/build/lib/commands/element.js +337 -323
- package/build/lib/commands/element.js.map +1 -1
- package/build/lib/commands/execute.d.ts +24 -19
- package/build/lib/commands/execute.d.ts.map +1 -1
- package/build/lib/commands/execute.js +63 -62
- package/build/lib/commands/execute.js.map +1 -1
- package/build/lib/commands/file-movement.d.ts +77 -80
- package/build/lib/commands/file-movement.d.ts.map +1 -1
- package/build/lib/commands/file-movement.js +130 -124
- package/build/lib/commands/file-movement.js.map +1 -1
- package/build/lib/commands/find.d.ts +18 -21
- package/build/lib/commands/find.d.ts.map +1 -1
- package/build/lib/commands/find.js +158 -156
- package/build/lib/commands/find.js.map +1 -1
- package/build/lib/commands/general.d.ts +124 -116
- package/build/lib/commands/general.d.ts.map +1 -1
- package/build/lib/commands/general.js +248 -232
- package/build/lib/commands/general.js.map +1 -1
- package/build/lib/commands/geolocation.d.ts +43 -46
- package/build/lib/commands/geolocation.d.ts.map +1 -1
- package/build/lib/commands/geolocation.js +10 -11
- package/build/lib/commands/geolocation.js.map +1 -1
- package/build/lib/commands/gesture.d.ts +273 -276
- package/build/lib/commands/gesture.d.ts.map +1 -1
- package/build/lib/commands/gesture.js +506 -492
- package/build/lib/commands/gesture.js.map +1 -1
- package/build/lib/commands/increase-contrast.d.ts +20 -23
- package/build/lib/commands/increase-contrast.d.ts.map +1 -1
- package/build/lib/commands/increase-contrast.js +30 -30
- package/build/lib/commands/increase-contrast.js.map +1 -1
- package/build/lib/commands/iohid.d.ts +1370 -1373
- package/build/lib/commands/iohid.d.ts.map +1 -1
- package/build/lib/commands/iohid.js +30 -31
- package/build/lib/commands/iohid.js.map +1 -1
- package/build/lib/commands/keyboard.d.ts +29 -32
- package/build/lib/commands/keyboard.d.ts.map +1 -1
- package/build/lib/commands/keyboard.js +53 -51
- package/build/lib/commands/keyboard.js.map +1 -1
- package/build/lib/commands/keychains.d.ts +9 -12
- package/build/lib/commands/keychains.d.ts.map +1 -1
- package/build/lib/commands/keychains.js +13 -14
- package/build/lib/commands/keychains.js.map +1 -1
- package/build/lib/commands/localization.d.ts +16 -19
- package/build/lib/commands/localization.d.ts.map +1 -1
- package/build/lib/commands/localization.js +25 -26
- package/build/lib/commands/localization.js.map +1 -1
- package/build/lib/commands/location.d.ts +36 -39
- package/build/lib/commands/location.d.ts.map +1 -1
- package/build/lib/commands/location.js +99 -98
- package/build/lib/commands/location.js.map +1 -1
- package/build/lib/commands/lock.d.ts +21 -24
- package/build/lib/commands/lock.d.ts.map +1 -1
- package/build/lib/commands/lock.js +39 -38
- package/build/lib/commands/lock.js.map +1 -1
- package/build/lib/commands/log.d.ts +43 -37
- package/build/lib/commands/log.d.ts.map +1 -1
- package/build/lib/commands/log.js +174 -171
- package/build/lib/commands/log.js.map +1 -1
- package/build/lib/commands/memory.d.ts +9 -12
- package/build/lib/commands/memory.d.ts.map +1 -1
- package/build/lib/commands/memory.js +37 -38
- package/build/lib/commands/memory.js.map +1 -1
- package/build/lib/commands/navigation.d.ts +30 -33
- package/build/lib/commands/navigation.d.ts.map +1 -1
- package/build/lib/commands/navigation.js +92 -92
- package/build/lib/commands/navigation.js.map +1 -1
- package/build/lib/commands/notifications.d.ts +26 -29
- package/build/lib/commands/notifications.d.ts.map +1 -1
- package/build/lib/commands/notifications.js +53 -53
- package/build/lib/commands/notifications.js.map +1 -1
- package/build/lib/commands/pasteboard.d.ts +21 -24
- package/build/lib/commands/pasteboard.d.ts.map +1 -1
- package/build/lib/commands/pasteboard.js +37 -37
- package/build/lib/commands/pasteboard.js.map +1 -1
- package/build/lib/commands/pcap.d.ts +39 -26
- package/build/lib/commands/pcap.d.ts.map +1 -1
- package/build/lib/commands/pcap.js +81 -81
- package/build/lib/commands/pcap.js.map +1 -1
- package/build/lib/commands/performance.d.ts +63 -44
- package/build/lib/commands/performance.d.ts.map +1 -1
- package/build/lib/commands/performance.js +105 -105
- package/build/lib/commands/performance.js.map +1 -1
- package/build/lib/commands/permissions.d.ts +33 -36
- package/build/lib/commands/permissions.d.ts.map +1 -1
- package/build/lib/commands/permissions.js +66 -65
- package/build/lib/commands/permissions.js.map +1 -1
- package/build/lib/commands/proxy-helper.d.ts +12 -15
- package/build/lib/commands/proxy-helper.d.ts.map +1 -1
- package/build/lib/commands/proxy-helper.js +53 -54
- package/build/lib/commands/proxy-helper.js.map +1 -1
- package/build/lib/commands/record-audio.d.ts +49 -29
- package/build/lib/commands/record-audio.d.ts.map +1 -1
- package/build/lib/commands/record-audio.js +100 -104
- package/build/lib/commands/record-audio.js.map +1 -1
- package/build/lib/commands/recordscreen.d.ts +54 -18
- package/build/lib/commands/recordscreen.d.ts.map +1 -1
- package/build/lib/commands/recordscreen.js +127 -129
- package/build/lib/commands/recordscreen.js.map +1 -1
- package/build/lib/commands/screenshots.d.ts +14 -17
- package/build/lib/commands/screenshots.d.ts.map +1 -1
- package/build/lib/commands/screenshots.js +108 -107
- package/build/lib/commands/screenshots.js.map +1 -1
- package/build/lib/commands/simctl.d.ts +11 -14
- package/build/lib/commands/simctl.d.ts.map +1 -1
- package/build/lib/commands/simctl.js +23 -26
- package/build/lib/commands/simctl.js.map +1 -1
- package/build/lib/commands/source.d.ts +14 -17
- package/build/lib/commands/source.d.ts.map +1 -1
- package/build/lib/commands/source.js +40 -43
- package/build/lib/commands/source.js.map +1 -1
- package/build/lib/commands/timeouts.d.ts +44 -33
- package/build/lib/commands/timeouts.d.ts.map +1 -1
- package/build/lib/commands/timeouts.js +65 -63
- package/build/lib/commands/timeouts.js.map +1 -1
- package/build/lib/commands/web.d.ts +247 -197
- package/build/lib/commands/web.d.ts.map +1 -1
- package/build/lib/commands/web.js +815 -786
- package/build/lib/commands/web.js.map +1 -1
- package/build/lib/commands/xctest-record-screen.d.ts +63 -66
- package/build/lib/commands/xctest-record-screen.d.ts.map +1 -1
- package/build/lib/commands/xctest-record-screen.js +103 -102
- package/build/lib/commands/xctest-record-screen.js.map +1 -1
- package/build/lib/commands/xctest.d.ts +55 -51
- package/build/lib/commands/xctest.d.ts.map +1 -1
- package/build/lib/commands/xctest.js +116 -117
- package/build/lib/commands/xctest.js.map +1 -1
- package/build/lib/driver.d.ts +278 -1597
- package/build/lib/driver.d.ts.map +1 -1
- package/build/lib/driver.js +319 -235
- package/build/lib/driver.js.map +1 -1
- package/build/lib/execute-method-map.d.ts.map +1 -1
- package/build/lib/execute-method-map.js +9 -0
- package/build/lib/execute-method-map.js.map +1 -1
- package/lib/commands/active-app-info.js +12 -0
- package/lib/commands/alert.js +68 -65
- package/lib/commands/app-management.js +308 -301
- package/lib/commands/app-strings.js +24 -26
- package/lib/commands/appearance.js +54 -56
- package/lib/commands/audit.js +18 -20
- package/lib/commands/battery.js +35 -37
- package/lib/commands/biometric.js +44 -46
- package/lib/commands/certificate.js +226 -215
- package/lib/commands/clipboard.js +30 -32
- package/lib/commands/condition.js +98 -100
- package/lib/commands/content-size.js +36 -38
- package/lib/commands/context.js +495 -490
- package/lib/commands/deviceInfo.js +19 -20
- package/lib/commands/element.js +367 -357
- package/lib/commands/execute.js +72 -72
- package/lib/commands/file-movement.js +132 -134
- package/lib/commands/find.js +160 -159
- package/lib/commands/general.js +238 -231
- package/lib/commands/geolocation.js +6 -14
- package/lib/commands/gesture.js +525 -515
- package/lib/commands/increase-contrast.js +30 -32
- package/lib/commands/iohid.js +32 -34
- package/lib/commands/keyboard.js +49 -51
- package/lib/commands/keychains.js +12 -14
- package/lib/commands/localization.js +24 -26
- package/lib/commands/location.js +102 -104
- package/lib/commands/lock.js +38 -38
- package/lib/commands/log.js +197 -198
- package/lib/commands/memory.js +40 -42
- package/lib/commands/navigation.js +96 -100
- package/lib/commands/notifications.js +57 -59
- package/lib/commands/pasteboard.js +37 -39
- package/lib/commands/pcap.js +84 -86
- package/lib/commands/performance.js +132 -133
- package/lib/commands/permissions.js +67 -69
- package/lib/commands/proxy-helper.js +60 -61
- package/lib/commands/record-audio.js +115 -120
- package/lib/commands/recordscreen.js +145 -149
- package/lib/commands/screenshots.js +116 -116
- package/lib/commands/simctl.js +25 -29
- package/lib/commands/source.js +42 -46
- package/lib/commands/timeouts.js +59 -63
- package/lib/commands/web.js +878 -858
- package/lib/commands/xctest-record-screen.js +103 -105
- package/lib/commands/xctest.js +134 -139
- package/lib/driver.js +287 -235
- package/lib/execute-method-map.ts +9 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/build/lib/commands/activeAppInfo.d.ts +0 -12
- package/build/lib/commands/activeAppInfo.d.ts.map +0 -1
- package/build/lib/commands/activeAppInfo.js +0 -15
- package/build/lib/commands/activeAppInfo.js.map +0 -1
- package/build/lib/commands/index.d.ts +0 -96
- package/build/lib/commands/index.d.ts.map +0 -1
- package/build/lib/commands/index.js +0 -100
- package/build/lib/commands/index.js.map +0 -1
- package/lib/commands/activeAppInfo.js +0 -14
- package/lib/commands/index.js +0 -95
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-management.d.ts","sourceRoot":"","sources":["../../../lib/commands/app-management.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"app-management.d.ts","sourceRoot":"","sources":["../../../lib/commands/app-management.js"],"names":[],"mappings":"AAYA;;;;;;;;;;;;GAYG;AACH,gFATW,MAAM,cACN,MAAM,iBAEN,OAAO,GAGL,OAAO,CAAC,IAAI,CAAC,CA2CzB;AAED;;;;;;;GAOG;AACH,yFAJW,MAAM,GACJ,OAAO,CAAC,OAAO,CAAC,CAO5B;AAED;;;;;;;GAOG;AACH,oFAJW,MAAM,GACJ,OAAO,CAAC,OAAO,CAAC,CAgB5B;AAED;;;;;;;;;GASG;AACH,oFANW,MAAM,SACN,MAAM,GAAC,MAAM,EAAE,gBACf,MAAM,GACJ,OAAO,CAAC,IAAI,CAAC,CAazB;AAED;;;;;;;GAOG;AACH,uFAJW,MAAM,GACJ,OAAO,CAAC,OAAO,CAAC,CAO5B;AAED;;;;;;;;GAQG;AACH,sFAJW,MAAM,GACJ,OAAO,CAAC,IAAI,CAAC,CAKzB;AAED;;;;;;;;;;;;GAYG;AACH,kFALW,MAAM,GACJ,OAAO,CAAC,OAAO,CAAC,CAY5B;AAED;;;;;;;;;GASG;AACH,wFALW,MAAM,GACJ,OAAO,CAAC,QAAQ,CAAC,CAM7B;AAED;;;;GAIG;AACH,oCAJW,MAAM,4BACN,MAAM,iBAMhB;AAED;;;;GAIG;AACH,sCAJW,MAAM,SACN,MAAM,gCAOhB;AAED;;;GAGG;AACH,mFAHW,MAAM,oBAKhB;AAED;;;;GAIG;AACH,iFAJW,MAAM,GAEJ,OAAO,CAAC,OAAO,CAAC,CAI5B;AAED;;;GAGG;AACH,kFAHW,MAAM,sCAKhB;AAED;;;;;;;;GAQG;AACH,iDALW,MAAM,GAAC,QAAQ,GACb,OAAO,CAAC,MAAM,CAAC,MAAM,EAAC,GAAG,CAAC,EAAE,CAAC,CAezC;AAED;;;;;;;;GAQG;AACH,mFAJW,MAAM,GAEJ,OAAO,CAAC,OAAO,CAAC,CA6B5B;AAED;;;;;;;;;;;GAWG;AACH,+EARW,MAAM,GAAC;IAAC,OAAO,EAAE,MAAM,OAAC,CAAA;CAAC,oBAwCnC;6BAGY,OAAO,WAAW,EAAE,cAAc;uBAClC,OAAO,QAAQ,EAAE,QAAQ"}
|
|
@@ -3,6 +3,22 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.mobileInstallApp = mobileInstallApp;
|
|
7
|
+
exports.mobileIsAppInstalled = mobileIsAppInstalled;
|
|
8
|
+
exports.mobileRemoveApp = mobileRemoveApp;
|
|
9
|
+
exports.mobileLaunchApp = mobileLaunchApp;
|
|
10
|
+
exports.mobileTerminateApp = mobileTerminateApp;
|
|
11
|
+
exports.mobileActivateApp = mobileActivateApp;
|
|
12
|
+
exports.mobileKillApp = mobileKillApp;
|
|
13
|
+
exports.mobileQueryAppState = mobileQueryAppState;
|
|
14
|
+
exports.installApp = installApp;
|
|
15
|
+
exports.activateApp = activateApp;
|
|
16
|
+
exports.isAppInstalled = isAppInstalled;
|
|
17
|
+
exports.terminateApp = terminateApp;
|
|
18
|
+
exports.queryAppState = queryAppState;
|
|
19
|
+
exports.mobileListApps = mobileListApps;
|
|
20
|
+
exports.mobileClearApp = mobileClearApp;
|
|
21
|
+
exports.background = background;
|
|
6
22
|
const lodash_1 = __importDefault(require("lodash"));
|
|
7
23
|
const support_1 = require("appium/support");
|
|
8
24
|
const driver_1 = require("appium/driver");
|
|
@@ -10,298 +26,296 @@ const appium_ios_device_1 = require("appium-ios-device");
|
|
|
10
26
|
const node_path_1 = __importDefault(require("node:path"));
|
|
11
27
|
const bluebird_1 = __importDefault(require("bluebird"));
|
|
12
28
|
const app_utils_1 = require("../app-utils");
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
app: srcAppPath,
|
|
46
|
-
});
|
|
47
|
-
if (!install) {
|
|
48
|
-
this.log.info(`Skipping the installation of '${bundleId}'`);
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
await this.device.installApp(srcAppPath, bundleId, {
|
|
53
|
-
timeoutMs: timeoutMs ?? this.opts.appPushTimeout
|
|
29
|
+
/**
|
|
30
|
+
* Installs the given application to the device under test.
|
|
31
|
+
*
|
|
32
|
+
* 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.
|
|
33
|
+
* @param {string} app - See docs for `appium:app` capability
|
|
34
|
+
* @param {number} [timeoutMs] - The maximum time to wait until app install is finished (in ms) on real devices.
|
|
35
|
+
* 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).
|
|
36
|
+
* @param {boolean} [checkVersion] - If the application installation follows currently installed application's version status if provided.
|
|
37
|
+
* No checking occurs if no this option.
|
|
38
|
+
* @privateRemarks Link to capability docs
|
|
39
|
+
* @returns {Promise<void>}
|
|
40
|
+
* @this {XCUITestDriver}
|
|
41
|
+
*/
|
|
42
|
+
async function mobileInstallApp(app, timeoutMs, checkVersion) {
|
|
43
|
+
const srcAppPath = await this.helpers.configureApp(app, {
|
|
44
|
+
onPostProcess: app_utils_1.onPostConfigureApp.bind(this),
|
|
45
|
+
onDownload: app_utils_1.onDownloadApp.bind(this),
|
|
46
|
+
supportedExtensions: app_utils_1.SUPPORTED_EXTENSIONS,
|
|
47
|
+
});
|
|
48
|
+
this.log.info(`Installing '${srcAppPath}' to the ${this.isRealDevice() ? 'real device' : 'Simulator'} ` +
|
|
49
|
+
`with UDID '${this.device.udid}'`);
|
|
50
|
+
if (!(await support_1.fs.exists(srcAppPath))) {
|
|
51
|
+
throw this.log.errorWithException(`The application at '${srcAppPath}' does not exist or is not accessible`);
|
|
52
|
+
}
|
|
53
|
+
const bundleId = await this.appInfosCache.extractBundleId(srcAppPath);
|
|
54
|
+
if (checkVersion) {
|
|
55
|
+
const { install } = await this.checkAutInstallationState({
|
|
56
|
+
enforceAppInstall: false,
|
|
57
|
+
fullReset: false,
|
|
58
|
+
noReset: false,
|
|
59
|
+
bundleId,
|
|
60
|
+
app: srcAppPath,
|
|
54
61
|
});
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
* Checks whether the given application is installed on the device under test.
|
|
59
|
-
* Offload app is handled as not installed.
|
|
60
|
-
*
|
|
61
|
-
* @param {string} bundleId - The bundle identifier of the application to be checked
|
|
62
|
-
* @returns {Promise<boolean>} `true` if the application is installed; `false` otherwise
|
|
63
|
-
* @this {XCUITestDriver}
|
|
64
|
-
*/
|
|
65
|
-
async mobileIsAppInstalled(bundleId) {
|
|
66
|
-
const installed = await this.device.isAppInstalled(bundleId);
|
|
67
|
-
this.log.info(`App '${bundleId}' is${installed ? '' : ' not'} installed`);
|
|
68
|
-
return installed;
|
|
69
|
-
},
|
|
70
|
-
/**
|
|
71
|
-
* Removes/uninstalls the given application from the device under test.
|
|
72
|
-
* Offload app data could also be removed.
|
|
73
|
-
*
|
|
74
|
-
* @param {string} bundleId - The bundle identifier of the application to be removed
|
|
75
|
-
* @returns {Promise<boolean>} `true` if the application has been removed successfully; `false` otherwise
|
|
76
|
-
* @this {XCUITestDriver}
|
|
77
|
-
*/
|
|
78
|
-
async mobileRemoveApp(bundleId) {
|
|
79
|
-
this.log.info(`Uninstalling the application with bundle identifier '${bundleId}' ` +
|
|
80
|
-
`from the ${this.isRealDevice() ? 'real device' : 'Simulator'} with UDID '${this.device.udid}'`);
|
|
81
|
-
try {
|
|
82
|
-
await this.device.removeApp(bundleId);
|
|
83
|
-
this.log.info(`Removal of '${bundleId}' succeeded`);
|
|
84
|
-
return true;
|
|
85
|
-
}
|
|
86
|
-
catch (err) {
|
|
87
|
-
this.log.warn(`Cannot remove '${bundleId}'. Original error: ${err.message}`);
|
|
88
|
-
return false;
|
|
89
|
-
}
|
|
90
|
-
},
|
|
91
|
-
/**
|
|
92
|
-
* Executes the given app on the device under test.
|
|
93
|
-
*
|
|
94
|
-
* 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.
|
|
95
|
-
* @param {string} bundleId - The bundle identifier of the application to be launched
|
|
96
|
-
* @param {string|string[]} [args] - One or more command line arguments for the app. If the app is already running then this argument is ignored.
|
|
97
|
-
* @param {object} [environment] - Environment variables mapping for the app. If the app is already running then this argument is ignored.
|
|
98
|
-
* @returns {Promise<void>}
|
|
99
|
-
* @this {XCUITestDriver}
|
|
100
|
-
*/
|
|
101
|
-
async mobileLaunchApp(bundleId, args, environment) {
|
|
102
|
-
/** @type { {arguments?: any[], environment?: any, bundleId: string} } */
|
|
103
|
-
const launchOptions = { bundleId };
|
|
104
|
-
if (args) {
|
|
105
|
-
launchOptions.arguments = Array.isArray(args) ? args : [args];
|
|
106
|
-
}
|
|
107
|
-
if (environment) {
|
|
108
|
-
launchOptions.environment = environment;
|
|
109
|
-
}
|
|
110
|
-
await this.proxyCommand('/wda/apps/launch', 'POST', launchOptions);
|
|
111
|
-
},
|
|
112
|
-
/**
|
|
113
|
-
* Terminates the given app on the device under test.
|
|
114
|
-
*
|
|
115
|
-
* 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.
|
|
116
|
-
* @param {string} bundleId - The bundle identifier of the application to be terminated
|
|
117
|
-
* @returns {Promise<boolean>} `true` if the app has been terminated successfully; `false` otherwise
|
|
118
|
-
* @this {XCUITestDriver}
|
|
119
|
-
*/
|
|
120
|
-
async mobileTerminateApp(bundleId) {
|
|
121
|
-
return /** @type {boolean} */ (await this.proxyCommand('/wda/apps/terminate', 'POST', { bundleId }));
|
|
122
|
-
},
|
|
123
|
-
/**
|
|
124
|
-
* Activate the given app on the device under test.
|
|
125
|
-
*
|
|
126
|
-
* 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.
|
|
127
|
-
*
|
|
128
|
-
* @param {string} bundleId - The bundle identifier of the application to be activated
|
|
129
|
-
* @returns {Promise<void>}
|
|
130
|
-
* @this {XCUITestDriver}
|
|
131
|
-
*/
|
|
132
|
-
async mobileActivateApp(bundleId) {
|
|
133
|
-
await this.proxyCommand('/wda/apps/activate', 'POST', { bundleId });
|
|
134
|
-
},
|
|
135
|
-
/**
|
|
136
|
-
* Kill the given app on the real device under test by instruments service.
|
|
137
|
-
*
|
|
138
|
-
* If the app is not running or kill failed, then nothing is done.
|
|
139
|
-
*
|
|
140
|
-
* @remarks `appium-xcuitest-driver` v4.4 does not require `py-ios-device` to be installed.
|
|
141
|
-
* @privateRemarks See implementation at https://github.com/YueChen-C/py-ios-device/blob/51f4683c5c3c385a015858ada07a5f1c62d3cf57/ios_device/cli/base.py#L220
|
|
142
|
-
* @see https://github.com/YueChen-C/py-ios-device
|
|
143
|
-
* @param {string} bundleId - The bundle identifier of the application to be killed
|
|
144
|
-
* @returns {Promise<boolean>} `true` if the app has been killed successfully; `false` otherwise
|
|
145
|
-
* @group Real Device Only
|
|
146
|
-
* @this {XCUITestDriver}
|
|
147
|
-
*/
|
|
148
|
-
async mobileKillApp(bundleId) {
|
|
149
|
-
if (!this.isRealDevice()) {
|
|
150
|
-
throw new driver_1.errors.UnsupportedOperationError('A real device is required');
|
|
151
|
-
}
|
|
152
|
-
return await /** @type {import('../real-device').RealDevice} */ (this.device).terminateApp(bundleId, String(this.opts.platformVersion));
|
|
153
|
-
},
|
|
154
|
-
/**
|
|
155
|
-
* Queries the state of an installed application from the device under test.
|
|
156
|
-
*
|
|
157
|
-
* If the app with the given `bundleId` is not installed, an exception will be thrown.
|
|
158
|
-
*
|
|
159
|
-
* @param {string} bundleId - The bundle identifier of the application to be queried
|
|
160
|
-
* @returns {Promise<AppState>} The actual application state code
|
|
161
|
-
* @see https://developer.apple.com/documentation/xctest/xcuiapplicationstate?language=objc
|
|
162
|
-
* @this {XCUITestDriver}
|
|
163
|
-
*/
|
|
164
|
-
async mobileQueryAppState(bundleId) {
|
|
165
|
-
return /** @type {AppState} */ (await this.proxyCommand('/wda/apps/state', 'POST', { bundleId }));
|
|
166
|
-
},
|
|
167
|
-
/**
|
|
168
|
-
* @param {string} appPath
|
|
169
|
-
* @param {object} opts
|
|
170
|
-
* @this {XCUITestDriver}
|
|
171
|
-
*/
|
|
172
|
-
async installApp(appPath, { timeoutMs, strategy } = {}) {
|
|
173
|
-
// @ts-ignore Probably a TS bug
|
|
174
|
-
await this.mobileInstallApp(appPath, timeoutMs, strategy);
|
|
175
|
-
},
|
|
176
|
-
/**
|
|
177
|
-
* @param {string} bundleId
|
|
178
|
-
* @param {object} opts
|
|
179
|
-
* @this {XCUITestDriver}
|
|
180
|
-
*/
|
|
181
|
-
async activateApp(bundleId, opts = {}) {
|
|
182
|
-
const { environment, arguments: args } = opts;
|
|
183
|
-
// @ts-ignore Probably a TS bug
|
|
184
|
-
return await this.mobileLaunchApp(bundleId, args, environment);
|
|
185
|
-
},
|
|
186
|
-
/**
|
|
187
|
-
* @param {string} bundleId
|
|
188
|
-
* @this {XCUITestDriver}
|
|
189
|
-
*/
|
|
190
|
-
async isAppInstalled(bundleId) {
|
|
191
|
-
return await this.mobileIsAppInstalled(bundleId);
|
|
192
|
-
},
|
|
193
|
-
/**
|
|
194
|
-
* @param {string} bundleId
|
|
195
|
-
* @this {XCUITestDriver}
|
|
196
|
-
* @returns {Promise<boolean>}
|
|
197
|
-
*/
|
|
198
|
-
async terminateApp(bundleId) {
|
|
199
|
-
return await this.mobileTerminateApp(bundleId);
|
|
200
|
-
},
|
|
201
|
-
/**
|
|
202
|
-
* @param {string} bundleId
|
|
203
|
-
* @this {XCUITestDriver}
|
|
204
|
-
*/
|
|
205
|
-
async queryAppState(bundleId) {
|
|
206
|
-
return await this.mobileQueryAppState(bundleId);
|
|
207
|
-
},
|
|
208
|
-
/**
|
|
209
|
-
* List applications installed on the real device under test
|
|
210
|
-
*
|
|
211
|
-
* Read [Pushing/Pulling files](https://appium.io/docs/en/writing-running-appium/ios/ios-xctest-file-movement/) for more details.
|
|
212
|
-
* @param {'User'|'System'} applicationType - The type of applications to list.
|
|
213
|
-
* @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.
|
|
214
|
-
* @remarks Having `UIFileSharingEnabled` set to `true` in the return app properties map means this app supports file upload/download in its `documents` container.
|
|
215
|
-
* @group Real Device Only
|
|
216
|
-
*/
|
|
217
|
-
async mobileListApps(applicationType = 'User') {
|
|
218
|
-
if (!this.isRealDevice()) {
|
|
219
|
-
throw new driver_1.errors.NotImplementedError(`This extension is only supported on real devices`);
|
|
220
|
-
}
|
|
221
|
-
const service = await appium_ios_device_1.services.startInstallationProxyService(this.device.udid);
|
|
222
|
-
try {
|
|
223
|
-
return await service.listApplications({ applicationType });
|
|
224
|
-
}
|
|
225
|
-
finally {
|
|
226
|
-
service.close();
|
|
62
|
+
if (!install) {
|
|
63
|
+
this.log.info(`Skipping the installation of '${bundleId}'`);
|
|
64
|
+
return;
|
|
227
65
|
}
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
66
|
+
}
|
|
67
|
+
await this.device.installApp(srcAppPath, bundleId, {
|
|
68
|
+
timeoutMs: timeoutMs ?? this.opts.appPushTimeout
|
|
69
|
+
});
|
|
70
|
+
this.log.info(`Installation of '${srcAppPath}' succeeded`);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Checks whether the given application is installed on the device under test.
|
|
74
|
+
* Offload app is handled as not installed.
|
|
75
|
+
*
|
|
76
|
+
* @param {string} bundleId - The bundle identifier of the application to be checked
|
|
77
|
+
* @returns {Promise<boolean>} `true` if the application is installed; `false` otherwise
|
|
78
|
+
* @this {XCUITestDriver}
|
|
79
|
+
*/
|
|
80
|
+
async function mobileIsAppInstalled(bundleId) {
|
|
81
|
+
const installed = await this.device.isAppInstalled(bundleId);
|
|
82
|
+
this.log.info(`App '${bundleId}' is${installed ? '' : ' not'} installed`);
|
|
83
|
+
return installed;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Removes/uninstalls the given application from the device under test.
|
|
87
|
+
* Offload app data could also be removed.
|
|
88
|
+
*
|
|
89
|
+
* @param {string} bundleId - The bundle identifier of the application to be removed
|
|
90
|
+
* @returns {Promise<boolean>} `true` if the application has been removed successfully; `false` otherwise
|
|
91
|
+
* @this {XCUITestDriver}
|
|
92
|
+
*/
|
|
93
|
+
async function mobileRemoveApp(bundleId) {
|
|
94
|
+
this.log.info(`Uninstalling the application with bundle identifier '${bundleId}' ` +
|
|
95
|
+
`from the ${this.isRealDevice() ? 'real device' : 'Simulator'} with UDID '${this.device.udid}'`);
|
|
96
|
+
try {
|
|
97
|
+
await this.device.removeApp(bundleId);
|
|
98
|
+
this.log.info(`Removal of '${bundleId}' succeeded`);
|
|
257
99
|
return true;
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
100
|
+
}
|
|
101
|
+
catch (err) {
|
|
102
|
+
this.log.warn(`Cannot remove '${bundleId}'. Original error: ${err.message}`);
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Executes the given app on the device under test.
|
|
108
|
+
*
|
|
109
|
+
* 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.
|
|
110
|
+
* @param {string} bundleId - The bundle identifier of the application to be launched
|
|
111
|
+
* @param {string|string[]} [args] - One or more command line arguments for the app. If the app is already running then this argument is ignored.
|
|
112
|
+
* @param {object} [environment] - Environment variables mapping for the app. If the app is already running then this argument is ignored.
|
|
113
|
+
* @returns {Promise<void>}
|
|
114
|
+
* @this {XCUITestDriver}
|
|
115
|
+
*/
|
|
116
|
+
async function mobileLaunchApp(bundleId, args, environment) {
|
|
117
|
+
/** @type { {arguments?: any[], environment?: any, bundleId: string} } */
|
|
118
|
+
const launchOptions = { bundleId };
|
|
119
|
+
if (args) {
|
|
120
|
+
launchOptions.arguments = Array.isArray(args) ? args : [args];
|
|
121
|
+
}
|
|
122
|
+
if (environment) {
|
|
123
|
+
launchOptions.environment = environment;
|
|
124
|
+
}
|
|
125
|
+
await this.proxyCommand('/wda/apps/launch', 'POST', launchOptions);
|
|
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
|
+
async function mobileTerminateApp(bundleId) {
|
|
136
|
+
return /** @type {boolean} */ (await this.proxyCommand('/wda/apps/terminate', 'POST', { bundleId }));
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Activate the given app on the device under test.
|
|
140
|
+
*
|
|
141
|
+
* 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.
|
|
142
|
+
*
|
|
143
|
+
* @param {string} bundleId - The bundle identifier of the application to be activated
|
|
144
|
+
* @returns {Promise<void>}
|
|
145
|
+
* @this {XCUITestDriver}
|
|
146
|
+
*/
|
|
147
|
+
async function mobileActivateApp(bundleId) {
|
|
148
|
+
await this.proxyCommand('/wda/apps/activate', 'POST', { bundleId });
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Kill the given app on the real device under test by instruments service.
|
|
152
|
+
*
|
|
153
|
+
* If the app is not running or kill failed, then nothing is done.
|
|
154
|
+
*
|
|
155
|
+
* @remarks `appium-xcuitest-driver` v4.4 does not require `py-ios-device` to be installed.
|
|
156
|
+
* @privateRemarks See implementation at https://github.com/YueChen-C/py-ios-device/blob/51f4683c5c3c385a015858ada07a5f1c62d3cf57/ios_device/cli/base.py#L220
|
|
157
|
+
* @see https://github.com/YueChen-C/py-ios-device
|
|
158
|
+
* @param {string} bundleId - The bundle identifier of the application to be killed
|
|
159
|
+
* @returns {Promise<boolean>} `true` if the app has been killed successfully; `false` otherwise
|
|
160
|
+
* @group Real Device Only
|
|
161
|
+
* @this {XCUITestDriver}
|
|
162
|
+
*/
|
|
163
|
+
async function mobileKillApp(bundleId) {
|
|
164
|
+
if (!this.isRealDevice()) {
|
|
165
|
+
throw new driver_1.errors.UnsupportedOperationError('A real device is required');
|
|
166
|
+
}
|
|
167
|
+
return await /** @type {import('../real-device').RealDevice} */ (this.device).terminateApp(bundleId, String(this.opts.platformVersion));
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Queries the state of an installed application from the device under test.
|
|
171
|
+
*
|
|
172
|
+
* If the app with the given `bundleId` is not installed, an exception will be thrown.
|
|
173
|
+
*
|
|
174
|
+
* @param {string} bundleId - The bundle identifier of the application to be queried
|
|
175
|
+
* @returns {Promise<AppState>} The actual application state code
|
|
176
|
+
* @see https://developer.apple.com/documentation/xctest/xcuiapplicationstate?language=objc
|
|
177
|
+
* @this {XCUITestDriver}
|
|
178
|
+
*/
|
|
179
|
+
async function mobileQueryAppState(bundleId) {
|
|
180
|
+
return /** @type {AppState} */ (await this.proxyCommand('/wda/apps/state', 'POST', { bundleId }));
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* @param {string} appPath
|
|
184
|
+
* @param {object} opts
|
|
185
|
+
* @this {XCUITestDriver}
|
|
186
|
+
*/
|
|
187
|
+
async function installApp(appPath, { timeoutMs, strategy } = {}) {
|
|
188
|
+
// @ts-ignore Probably a TS bug
|
|
189
|
+
await this.mobileInstallApp(appPath, timeoutMs, strategy);
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* @param {string} bundleId
|
|
193
|
+
* @param {object} opts
|
|
194
|
+
* @this {XCUITestDriver}
|
|
195
|
+
*/
|
|
196
|
+
async function activateApp(bundleId, opts = {}) {
|
|
197
|
+
const { environment, arguments: args } = opts;
|
|
198
|
+
// @ts-ignore Probably a TS bug
|
|
199
|
+
return await this.mobileLaunchApp(bundleId, args, environment);
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* @param {string} bundleId
|
|
203
|
+
* @this {XCUITestDriver}
|
|
204
|
+
*/
|
|
205
|
+
async function isAppInstalled(bundleId) {
|
|
206
|
+
return await this.mobileIsAppInstalled(bundleId);
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* @param {string} bundleId
|
|
210
|
+
* @this {XCUITestDriver}
|
|
211
|
+
* @returns {Promise<boolean>}
|
|
212
|
+
*/
|
|
213
|
+
async function terminateApp(bundleId) {
|
|
214
|
+
return await this.mobileTerminateApp(bundleId);
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* @param {string} bundleId
|
|
218
|
+
* @this {XCUITestDriver}
|
|
219
|
+
*/
|
|
220
|
+
async function queryAppState(bundleId) {
|
|
221
|
+
return await this.mobileQueryAppState(bundleId);
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* List applications installed on the real device under test
|
|
225
|
+
*
|
|
226
|
+
* Read [Pushing/Pulling files](https://appium.io/docs/en/writing-running-appium/ios/ios-xctest-file-movement/) for more details.
|
|
227
|
+
* @param {'User'|'System'} applicationType - The type of applications to list.
|
|
228
|
+
* @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.
|
|
229
|
+
* @remarks Having `UIFileSharingEnabled` set to `true` in the return app properties map means this app supports file upload/download in its `documents` container.
|
|
230
|
+
* @group Real Device Only
|
|
231
|
+
*/
|
|
232
|
+
async function mobileListApps(applicationType = 'User') {
|
|
233
|
+
if (!this.isRealDevice()) {
|
|
234
|
+
throw new driver_1.errors.NotImplementedError(`This extension is only supported on real devices`);
|
|
235
|
+
}
|
|
236
|
+
const service = await appium_ios_device_1.services.startInstallationProxyService(this.device.udid);
|
|
237
|
+
try {
|
|
238
|
+
return await service.listApplications({ applicationType });
|
|
239
|
+
}
|
|
240
|
+
finally {
|
|
241
|
+
service.close();
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Deletes application data files, so it could start from the clean state next time
|
|
246
|
+
* it is launched.
|
|
247
|
+
* This API only works on a Simulator.
|
|
248
|
+
*
|
|
249
|
+
* @param {string} bundleId Application bundle identifier
|
|
250
|
+
* @this {XCUITestDriver}
|
|
251
|
+
* @returns {Promise<boolean>} true if any files from the app's data container have been deleted
|
|
252
|
+
*/
|
|
253
|
+
async function mobileClearApp(bundleId) {
|
|
254
|
+
if (this.isRealDevice()) {
|
|
255
|
+
throw new driver_1.errors.NotImplementedError(`This extension is only supported on simulators. ` +
|
|
256
|
+
`The only known way to clear app data on real devices ` +
|
|
257
|
+
`would be to uninstall the app then perform a fresh install of it.`);
|
|
258
|
+
}
|
|
259
|
+
const simctl = /** @type {import('../driver').Simulator} */ (this.device).simctl;
|
|
260
|
+
const dataRoot = await simctl.getAppContainer(bundleId, 'data');
|
|
261
|
+
this.log.debug(`Got the data container root of ${bundleId} at '${dataRoot}'`);
|
|
262
|
+
if (!await support_1.fs.exists(dataRoot)) {
|
|
263
|
+
return false;
|
|
264
|
+
}
|
|
265
|
+
await this.mobileTerminateApp(bundleId);
|
|
266
|
+
const items = await support_1.fs.readdir(dataRoot);
|
|
267
|
+
if (!items.length) {
|
|
268
|
+
return false;
|
|
269
|
+
}
|
|
270
|
+
await bluebird_1.default.all(items.map((item) => support_1.fs.rimraf(node_path_1.default.join(dataRoot, item))));
|
|
271
|
+
this.log.info(`Cleaned up ${support_1.util.pluralize('item', items.length, true)} from ${bundleId}'s data container`);
|
|
272
|
+
return true;
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Close app (simulate device home button). It is possible to restore
|
|
276
|
+
* the app after the timeout or keep it minimized based on the parameter value.
|
|
277
|
+
*
|
|
278
|
+
* @param {number|{timeout: number?}} [seconds]
|
|
279
|
+
* - any positive number of seconds: come back after X seconds
|
|
280
|
+
* - any negative number of seconds or zero: never come back
|
|
281
|
+
* - undefined/null: never come back
|
|
282
|
+
* - {timeout: 5000}: come back after 5 seconds
|
|
283
|
+
* - {timeout: null}, {timeout: -2}: never come back
|
|
284
|
+
* @this {XCUITestDriver}
|
|
285
|
+
*/
|
|
286
|
+
async function background(seconds) {
|
|
287
|
+
const homescreen = '/wda/homescreen';
|
|
288
|
+
const deactivateApp = '/wda/deactivateApp';
|
|
289
|
+
let endpoint;
|
|
290
|
+
let params = {};
|
|
291
|
+
const selectEndpoint = (timeoutSeconds) => {
|
|
292
|
+
if (!support_1.util.hasValue(timeoutSeconds)) {
|
|
293
|
+
endpoint = homescreen;
|
|
294
|
+
}
|
|
295
|
+
else if (!isNaN(timeoutSeconds)) {
|
|
296
|
+
const duration = parseFloat(timeoutSeconds);
|
|
297
|
+
if (duration >= 0) {
|
|
298
|
+
params = { duration };
|
|
299
|
+
endpoint = deactivateApp;
|
|
279
300
|
}
|
|
280
|
-
else
|
|
281
|
-
|
|
282
|
-
if (duration >= 0) {
|
|
283
|
-
params = { duration };
|
|
284
|
-
endpoint = deactivateApp;
|
|
285
|
-
}
|
|
286
|
-
else {
|
|
287
|
-
endpoint = homescreen;
|
|
288
|
-
}
|
|
301
|
+
else {
|
|
302
|
+
endpoint = homescreen;
|
|
289
303
|
}
|
|
290
|
-
};
|
|
291
|
-
if (seconds && !lodash_1.default.isNumber(seconds) && lodash_1.default.has(seconds, 'timeout')) {
|
|
292
|
-
const timeout = seconds.timeout;
|
|
293
|
-
selectEndpoint(isNaN(Number(timeout)) ? timeout : parseFloat(String(timeout)) / 1000.0);
|
|
294
304
|
}
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
+
};
|
|
306
|
+
if (seconds && !lodash_1.default.isNumber(seconds) && lodash_1.default.has(seconds, 'timeout')) {
|
|
307
|
+
const timeout = seconds.timeout;
|
|
308
|
+
selectEndpoint(isNaN(Number(timeout)) ? timeout : parseFloat(String(timeout)) / 1000.0);
|
|
309
|
+
}
|
|
310
|
+
else {
|
|
311
|
+
selectEndpoint(seconds);
|
|
312
|
+
}
|
|
313
|
+
if (!endpoint) {
|
|
314
|
+
throw new driver_1.errors.InvalidArgumentError(`Argument value is expected to be a valid number. ` +
|
|
315
|
+
`${JSON.stringify(seconds)} has been provided instead`);
|
|
316
|
+
}
|
|
317
|
+
return await this.proxyCommand(endpoint, 'POST', params, endpoint !== homescreen);
|
|
318
|
+
}
|
|
305
319
|
/**
|
|
306
320
|
* @typedef {import('../driver').XCUITestDriver} XCUITestDriver
|
|
307
321
|
* @typedef {import('./enum').AppState} AppState
|