appium-xcuitest-driver 10.8.3 → 10.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/build/lib/app-utils.d.ts +2 -2
- package/build/lib/app-utils.d.ts.map +1 -1
- package/build/lib/app-utils.js +4 -1
- package/build/lib/app-utils.js.map +1 -1
- package/build/lib/commands/app-management.js +2 -2
- package/build/lib/commands/app-management.js.map +1 -1
- package/build/lib/commands/appearance.js +2 -2
- package/build/lib/commands/appearance.js.map +1 -1
- package/build/lib/commands/biometric.js +3 -3
- package/build/lib/commands/biometric.js.map +1 -1
- package/build/lib/commands/certificate.d.ts.map +1 -1
- package/build/lib/commands/certificate.js +9 -3
- package/build/lib/commands/certificate.js.map +1 -1
- package/build/lib/commands/context.d.ts +5 -5
- package/build/lib/commands/context.d.ts.map +1 -1
- package/build/lib/commands/context.js +6 -6
- package/build/lib/commands/context.js.map +1 -1
- package/build/lib/commands/file-movement.d.ts.map +1 -1
- package/build/lib/commands/file-movement.js +7 -7
- package/build/lib/commands/file-movement.js.map +1 -1
- package/build/lib/commands/general.js +1 -1
- package/build/lib/commands/general.js.map +1 -1
- package/build/lib/commands/gesture.js +1 -1
- package/build/lib/commands/gesture.js.map +1 -1
- package/build/lib/commands/keychains.js +1 -1
- package/build/lib/commands/keychains.js.map +1 -1
- package/build/lib/commands/localization.js +1 -1
- package/build/lib/commands/localization.js.map +1 -1
- package/build/lib/commands/location.js +1 -1
- package/build/lib/commands/location.js.map +1 -1
- package/build/lib/commands/log.js +7 -7
- package/build/lib/commands/log.js.map +1 -1
- package/build/lib/commands/memory.js +1 -1
- package/build/lib/commands/memory.js.map +1 -1
- package/build/lib/commands/notifications.js +1 -1
- package/build/lib/commands/notifications.js.map +1 -1
- package/build/lib/commands/pasteboard.js +2 -2
- package/build/lib/commands/pasteboard.js.map +1 -1
- package/build/lib/commands/pcap.js +1 -1
- package/build/lib/commands/pcap.js.map +1 -1
- package/build/lib/commands/performance.d.ts.map +1 -1
- package/build/lib/commands/performance.js +13 -4
- package/build/lib/commands/performance.js.map +1 -1
- package/build/lib/commands/permissions.js +2 -2
- package/build/lib/commands/permissions.js.map +1 -1
- package/build/lib/commands/proxy-helper.d.ts.map +1 -1
- package/build/lib/commands/proxy-helper.js +0 -3
- package/build/lib/commands/proxy-helper.js.map +1 -1
- package/build/lib/commands/screenshots.js +1 -1
- package/build/lib/commands/screenshots.js.map +1 -1
- package/build/lib/commands/simctl.d.ts +1 -1
- package/build/lib/commands/simctl.d.ts.map +1 -1
- package/build/lib/commands/simctl.js +1 -1
- package/build/lib/commands/simctl.js.map +1 -1
- package/build/lib/commands/web.js +1 -1
- package/build/lib/commands/web.js.map +1 -1
- package/build/lib/commands/xctest-record-screen.js +2 -2
- package/build/lib/commands/xctest-record-screen.js.map +1 -1
- package/build/lib/desired-caps.d.ts +383 -507
- package/build/lib/desired-caps.d.ts.map +1 -1
- package/build/lib/desired-caps.js +6 -10
- package/build/lib/desired-caps.js.map +1 -1
- package/build/lib/device/clients/base-device-client.d.ts.map +1 -0
- package/build/lib/device/clients/base-device-client.js.map +1 -0
- package/build/lib/{real-device-clients → device/clients}/py-ios-device-client.d.ts +1 -1
- package/build/lib/device/clients/py-ios-device-client.d.ts.map +1 -0
- package/build/lib/device/clients/py-ios-device-client.js.map +1 -0
- package/build/lib/device/device-connections-factory.d.ts +18 -0
- package/build/lib/device/device-connections-factory.d.ts.map +1 -0
- package/build/lib/{device-connections-factory.js → device/device-connections-factory.js} +57 -41
- package/build/lib/device/device-connections-factory.js.map +1 -0
- package/build/lib/{device-log → device/log}/helpers.d.ts +1 -1
- package/build/lib/device/log/helpers.d.ts.map +1 -0
- package/build/lib/device/log/helpers.js.map +1 -0
- package/build/lib/{device-log → device/log}/ios-crash-log.d.ts +1 -1
- package/build/lib/device/log/ios-crash-log.d.ts.map +1 -0
- package/build/lib/{device-log → device/log}/ios-crash-log.js +1 -1
- package/build/lib/device/log/ios-crash-log.js.map +1 -0
- package/build/lib/device/log/ios-device-log.d.ts.map +1 -0
- package/build/lib/device/log/ios-device-log.js.map +1 -0
- package/build/lib/{device-log → device/log}/ios-log.d.ts +1 -1
- package/build/lib/device/log/ios-log.d.ts.map +1 -0
- package/build/lib/device/log/ios-log.js.map +1 -0
- package/build/lib/device/log/ios-performance-log.d.ts.map +1 -0
- package/build/lib/device/log/ios-performance-log.js.map +1 -0
- package/build/lib/device/log/ios-simulator-log.d.ts.map +1 -0
- package/build/lib/device/log/ios-simulator-log.js.map +1 -0
- package/build/lib/{device-log → device/log}/line-consuming-log.d.ts +1 -1
- package/build/lib/device/log/line-consuming-log.d.ts.map +1 -0
- package/build/lib/device/log/line-consuming-log.js.map +1 -0
- package/build/lib/{device-log → device/log}/safari-console-log.d.ts +1 -1
- package/build/lib/device/log/safari-console-log.d.ts.map +1 -0
- package/build/lib/device/log/safari-console-log.js.map +1 -0
- package/build/lib/device/log/safari-network-log.d.ts.map +1 -0
- package/build/lib/device/log/safari-network-log.js.map +1 -0
- package/build/lib/device/real-device-management.d.ts +146 -0
- package/build/lib/device/real-device-management.d.ts.map +1 -0
- package/build/lib/device/real-device-management.js +728 -0
- package/build/lib/device/real-device-management.js.map +1 -0
- package/build/lib/device/simulator-management.d.ts +65 -0
- package/build/lib/device/simulator-management.d.ts.map +1 -0
- package/build/lib/{simulator-management.js → device/simulator-management.js} +24 -43
- package/build/lib/device/simulator-management.js.map +1 -0
- package/build/lib/driver.d.ts +129 -1385
- package/build/lib/driver.d.ts.map +1 -1
- package/build/lib/driver.js +476 -600
- package/build/lib/driver.js.map +1 -1
- package/build/lib/method-map.d.ts +1 -1
- package/build/lib/method-map.d.ts.map +1 -1
- package/build/lib/method-map.js +2 -2
- package/build/lib/method-map.js.map +1 -1
- package/lib/app-utils.js +5 -1
- package/lib/commands/app-management.js +2 -2
- package/lib/commands/appearance.js +2 -2
- package/lib/commands/biometric.js +3 -3
- package/lib/commands/certificate.js +9 -3
- package/lib/commands/context.js +6 -6
- package/lib/commands/file-movement.js +11 -7
- package/lib/commands/general.js +1 -1
- package/lib/commands/gesture.js +1 -1
- package/lib/commands/keychains.js +1 -1
- package/lib/commands/localization.js +1 -1
- package/lib/commands/location.js +1 -1
- package/lib/commands/log.js +7 -7
- package/lib/commands/memory.js +1 -1
- package/lib/commands/notifications.js +1 -1
- package/lib/commands/pasteboard.js +2 -2
- package/lib/commands/pcap.js +1 -1
- package/lib/commands/performance.js +12 -1
- package/lib/commands/permissions.js +2 -2
- package/lib/commands/proxy-helper.js +0 -3
- package/lib/commands/screenshots.js +1 -1
- package/lib/commands/simctl.js +1 -1
- package/lib/commands/web.js +1 -1
- package/lib/commands/xctest-record-screen.js +2 -2
- package/lib/{desired-caps.js → desired-caps.ts} +7 -6
- package/lib/{real-device-clients → device/clients}/py-ios-device-client.ts +1 -1
- package/lib/{device-connections-factory.js → device/device-connections-factory.ts} +96 -60
- package/lib/{device-log → device/log}/helpers.ts +1 -1
- package/lib/{device-log → device/log}/ios-crash-log.ts +3 -3
- package/lib/{device-log → device/log}/ios-log.ts +1 -1
- package/lib/{device-log → device/log}/line-consuming-log.ts +1 -1
- package/lib/{device-log → device/log}/safari-console-log.ts +1 -1
- package/lib/device/real-device-management.ts +819 -0
- package/lib/{simulator-management.js → device/simulator-management.ts} +69 -62
- package/lib/{driver.js → driver.ts} +619 -713
- package/lib/{method-map.js → method-map.ts} +5 -2
- package/npm-shrinkwrap.json +5 -5
- package/package.json +1 -1
- package/build/lib/device-connections-factory.d.ts +0 -13
- package/build/lib/device-connections-factory.d.ts.map +0 -1
- package/build/lib/device-connections-factory.js.map +0 -1
- package/build/lib/device-log/helpers.d.ts.map +0 -1
- package/build/lib/device-log/helpers.js.map +0 -1
- package/build/lib/device-log/ios-crash-log.d.ts.map +0 -1
- package/build/lib/device-log/ios-crash-log.js.map +0 -1
- package/build/lib/device-log/ios-device-log.d.ts.map +0 -1
- package/build/lib/device-log/ios-device-log.js.map +0 -1
- package/build/lib/device-log/ios-log.d.ts.map +0 -1
- package/build/lib/device-log/ios-log.js.map +0 -1
- package/build/lib/device-log/ios-performance-log.d.ts.map +0 -1
- package/build/lib/device-log/ios-performance-log.js.map +0 -1
- package/build/lib/device-log/ios-simulator-log.d.ts.map +0 -1
- package/build/lib/device-log/ios-simulator-log.js.map +0 -1
- package/build/lib/device-log/line-consuming-log.d.ts.map +0 -1
- package/build/lib/device-log/line-consuming-log.js.map +0 -1
- package/build/lib/device-log/safari-console-log.d.ts.map +0 -1
- package/build/lib/device-log/safari-console-log.js.map +0 -1
- package/build/lib/device-log/safari-network-log.d.ts.map +0 -1
- package/build/lib/device-log/safari-network-log.js.map +0 -1
- package/build/lib/ios-fs-helpers.d.ts +0 -75
- package/build/lib/ios-fs-helpers.d.ts.map +0 -1
- package/build/lib/ios-fs-helpers.js +0 -370
- package/build/lib/ios-fs-helpers.js.map +0 -1
- package/build/lib/real-device-clients/base-device-client.d.ts.map +0 -1
- package/build/lib/real-device-clients/base-device-client.js.map +0 -1
- package/build/lib/real-device-clients/py-ios-device-client.d.ts.map +0 -1
- package/build/lib/real-device-clients/py-ios-device-client.js.map +0 -1
- package/build/lib/real-device-management.d.ts +0 -53
- package/build/lib/real-device-management.d.ts.map +0 -1
- package/build/lib/real-device-management.js +0 -128
- package/build/lib/real-device-management.js.map +0 -1
- package/build/lib/real-device.d.ts +0 -112
- package/build/lib/real-device.d.ts.map +0 -1
- package/build/lib/real-device.js +0 -352
- package/build/lib/real-device.js.map +0 -1
- package/build/lib/simulator-management.d.ts +0 -96
- package/build/lib/simulator-management.d.ts.map +0 -1
- package/build/lib/simulator-management.js.map +0 -1
- package/build/lib/xcrun.d.ts +0 -3
- package/build/lib/xcrun.d.ts.map +0 -1
- package/build/lib/xcrun.js +0 -17
- package/build/lib/xcrun.js.map +0 -1
- package/lib/ios-fs-helpers.js +0 -355
- package/lib/real-device-management.js +0 -133
- package/lib/real-device.js +0 -347
- package/lib/xcrun.js +0 -16
- /package/build/lib/{real-device-clients → device/clients}/base-device-client.d.ts +0 -0
- /package/build/lib/{real-device-clients → device/clients}/base-device-client.js +0 -0
- /package/build/lib/{real-device-clients → device/clients}/py-ios-device-client.js +0 -0
- /package/build/lib/{device-log → device/log}/helpers.js +0 -0
- /package/build/lib/{device-log → device/log}/ios-device-log.d.ts +0 -0
- /package/build/lib/{device-log → device/log}/ios-device-log.js +0 -0
- /package/build/lib/{device-log → device/log}/ios-log.js +0 -0
- /package/build/lib/{device-log → device/log}/ios-performance-log.d.ts +0 -0
- /package/build/lib/{device-log → device/log}/ios-performance-log.js +0 -0
- /package/build/lib/{device-log → device/log}/ios-simulator-log.d.ts +0 -0
- /package/build/lib/{device-log → device/log}/ios-simulator-log.js +0 -0
- /package/build/lib/{device-log → device/log}/line-consuming-log.js +0 -0
- /package/build/lib/{device-log → device/log}/safari-console-log.js +0 -0
- /package/build/lib/{device-log → device/log}/safari-network-log.d.ts +0 -0
- /package/build/lib/{device-log → device/log}/safari-network-log.js +0 -0
- /package/lib/{real-device-clients → device/clients}/base-device-client.ts +0 -0
- /package/lib/{device-log → device/log}/ios-device-log.ts +0 -0
- /package/lib/{device-log → device/log}/ios-performance-log.ts +0 -0
- /package/lib/{device-log → device/log}/ios-simulator-log.ts +0 -0
- /package/lib/{device-log → device/log}/safari-network-log.ts +0 -0
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import {getSimulator} from 'appium-ios-simulator';
|
|
1
|
+
import {getSimulator, type Simulator, type LocalizationOptions} from 'appium-ios-simulator';
|
|
2
2
|
import {Simctl} from 'node-simctl';
|
|
3
3
|
import {resetTestProcesses} from 'appium-webdriveragent';
|
|
4
4
|
import _ from 'lodash';
|
|
5
5
|
import {util, timing} from 'appium/support';
|
|
6
|
-
import {UDID_AUTO, normalizePlatformName} from '
|
|
7
|
-
import {buildSafariPreferences} from '
|
|
6
|
+
import {UDID_AUTO, normalizePlatformName} from '../utils';
|
|
7
|
+
import {buildSafariPreferences} from '../app-utils';
|
|
8
|
+
import type { XCUITestDriver } from '../driver';
|
|
8
9
|
|
|
9
10
|
const APPIUM_SIM_PREFIX = 'appiumTest';
|
|
10
11
|
|
|
11
12
|
/**
|
|
12
13
|
* Create a new simulator with `appiumTest-` prefix and return the object.
|
|
13
14
|
*
|
|
14
|
-
* @
|
|
15
|
-
* @returns {Promise<object>} Simulator object associated with the udid passed in.
|
|
15
|
+
* @returns Simulator object associated with the udid passed in.
|
|
16
16
|
*/
|
|
17
|
-
export async function createSim() {
|
|
17
|
+
export async function createSim(this: XCUITestDriver): Promise<Simulator> {
|
|
18
18
|
const {simulatorDevicesSetPath: devicesSetPath, deviceName, platformVersion} = this.opts;
|
|
19
19
|
const platform = normalizePlatformName(this.opts.platformName);
|
|
20
20
|
const simctl = new Simctl({devicesSetPath});
|
|
21
21
|
if (!deviceName) {
|
|
22
|
-
let deviceNames = 'none';
|
|
22
|
+
let deviceNames: string | string[] = 'none';
|
|
23
23
|
try {
|
|
24
24
|
deviceNames = (await simctl
|
|
25
25
|
.getDevices(platformVersion, platform))
|
|
@@ -47,22 +47,12 @@ export async function createSim() {
|
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
/**
|
|
51
|
-
* @typedef {Object} SimulatorLookupOptions
|
|
52
|
-
* @property {string} [deviceName] - The name of the device to lookup
|
|
53
|
-
* @property {string} platformVersion - The platform version string
|
|
54
|
-
* @property {string} [simulatorDevicesSetPath] - The full path to the simulator devices set
|
|
55
|
-
* @property {string} [udid] - Simulator udid
|
|
56
|
-
* @property {string} [platformName] The name of the current platform
|
|
57
|
-
*/
|
|
58
|
-
|
|
59
50
|
/**
|
|
60
51
|
* Get an existing simulator matching the provided capabilities.
|
|
61
52
|
*
|
|
62
|
-
* @
|
|
63
|
-
* @returns {Promise<import('./driver').Simulator|null>} The matched Simulator instance or `null` if no matching device is found.
|
|
53
|
+
* @returns The matched Simulator instance or `null` if no matching device is found.
|
|
64
54
|
*/
|
|
65
|
-
export async function getExistingSim() {
|
|
55
|
+
export async function getExistingSim(this: XCUITestDriver): Promise<Simulator | null> {
|
|
66
56
|
const {
|
|
67
57
|
platformVersion,
|
|
68
58
|
deviceName,
|
|
@@ -72,7 +62,7 @@ export async function getExistingSim() {
|
|
|
72
62
|
} = this.opts;
|
|
73
63
|
|
|
74
64
|
const platform = normalizePlatformName(platformName);
|
|
75
|
-
const selectSim = async (
|
|
65
|
+
const selectSim = async (dev: { udid: string; platform: string; }): Promise<Simulator> =>
|
|
76
66
|
await getSimulator(dev.udid, {
|
|
77
67
|
platform,
|
|
78
68
|
checkExistence: false,
|
|
@@ -82,7 +72,7 @@ export async function getExistingSim() {
|
|
|
82
72
|
});
|
|
83
73
|
|
|
84
74
|
const simctl = new Simctl({devicesSetPath});
|
|
85
|
-
let devicesMap;
|
|
75
|
+
let devicesMap: Record<string, any[]> | undefined;
|
|
86
76
|
if (udid && _.toLower(udid) !== UDID_AUTO) {
|
|
87
77
|
this.log.debug(`Looking for an existing Simulator with UDID '${udid}'`);
|
|
88
78
|
devicesMap = await simctl.getDevices(null, platform);
|
|
@@ -123,21 +113,23 @@ export async function getExistingSim() {
|
|
|
123
113
|
}
|
|
124
114
|
|
|
125
115
|
/**
|
|
126
|
-
*
|
|
116
|
+
* Shutdown simulator
|
|
127
117
|
*/
|
|
128
|
-
export async function shutdownSimulator() {
|
|
129
|
-
const device =
|
|
118
|
+
export async function shutdownSimulator(this: XCUITestDriver): Promise<void> {
|
|
119
|
+
const device = this.device as Simulator;
|
|
130
120
|
// stop XCTest processes if running to avoid unexpected side effects
|
|
131
121
|
await resetTestProcesses(device.udid, true);
|
|
132
122
|
await device.shutdown();
|
|
133
123
|
}
|
|
134
124
|
|
|
135
125
|
/**
|
|
136
|
-
*
|
|
137
|
-
* @
|
|
138
|
-
* @returns {Promise<void>}
|
|
126
|
+
* Run simulator reset
|
|
127
|
+
* @param enforceSimulatorShutdown Whether to enforce simulator shutdown
|
|
139
128
|
*/
|
|
140
|
-
export async function runSimulatorReset(
|
|
129
|
+
export async function runSimulatorReset(
|
|
130
|
+
this: XCUITestDriver,
|
|
131
|
+
enforceSimulatorShutdown: boolean = false
|
|
132
|
+
): Promise<void> {
|
|
141
133
|
const {
|
|
142
134
|
noReset,
|
|
143
135
|
fullReset,
|
|
@@ -152,7 +144,7 @@ export async function runSimulatorReset(enforceSimulatorShutdown = false) {
|
|
|
152
144
|
this.log.debug('Reset: noReset is on. Leaving simulator as is');
|
|
153
145
|
return;
|
|
154
146
|
}
|
|
155
|
-
const device =
|
|
147
|
+
const device = this.device as Simulator;
|
|
156
148
|
|
|
157
149
|
if (!this.device) {
|
|
158
150
|
this.log.debug('Reset: no device available. Skipping');
|
|
@@ -165,7 +157,7 @@ export async function runSimulatorReset(enforceSimulatorShutdown = false) {
|
|
|
165
157
|
const isKeychainsBackupSuccessful = (keychainsExcludePatterns || keepKeyChains) && (await device.backupKeychains());
|
|
166
158
|
await device.clean();
|
|
167
159
|
if (isKeychainsBackupSuccessful) {
|
|
168
|
-
await device.restoreKeychains(keychainsExcludePatterns || []);
|
|
160
|
+
await device.restoreKeychains(keychainsExcludePatterns?.split(',')?.map(_.trim) || []);
|
|
169
161
|
this.log.info(`Successfully restored keychains after full reset`);
|
|
170
162
|
} else if (keychainsExcludePatterns || keepKeyChains) {
|
|
171
163
|
this.log.warn(
|
|
@@ -194,8 +186,8 @@ export async function runSimulatorReset(enforceSimulatorShutdown = false) {
|
|
|
194
186
|
await device.scrubApp(bundleId);
|
|
195
187
|
}
|
|
196
188
|
} catch (err) {
|
|
197
|
-
this.log.debug(err.stack);
|
|
198
|
-
this.log.warn(err.message);
|
|
189
|
+
this.log.debug((err as Error).stack);
|
|
190
|
+
this.log.warn((err as Error).message);
|
|
199
191
|
this.log.warn(
|
|
200
192
|
`Reset: could not scrub ${
|
|
201
193
|
isSafari ? 'Safari browser' : 'application with id "' + this.opts.bundleId + '"'
|
|
@@ -205,36 +197,30 @@ export async function runSimulatorReset(enforceSimulatorShutdown = false) {
|
|
|
205
197
|
}
|
|
206
198
|
|
|
207
199
|
if (enforceSimulatorShutdown && (await device.isRunning())) {
|
|
208
|
-
await shutdownSimulator.bind(this)(
|
|
200
|
+
await shutdownSimulator.bind(this)();
|
|
209
201
|
}
|
|
210
202
|
}
|
|
211
203
|
}
|
|
212
204
|
|
|
213
205
|
/**
|
|
214
|
-
*
|
|
215
|
-
*
|
|
216
|
-
* @
|
|
217
|
-
* @
|
|
218
|
-
*/
|
|
219
|
-
|
|
220
|
-
/**
|
|
221
|
-
* @this {import('./driver').XCUITestDriver}
|
|
222
|
-
* @param {string} app The app to the path
|
|
223
|
-
* @param {string} [bundleId] The bundle id to ensure it is already installed and uninstall it
|
|
224
|
-
* @param {InstallOptions} [opts={}]
|
|
206
|
+
* Install app to simulator
|
|
207
|
+
* @param app The app to the path
|
|
208
|
+
* @param bundleId The bundle id to ensure it is already installed and uninstall it
|
|
209
|
+
* @param opts Install options
|
|
225
210
|
*/
|
|
226
211
|
export async function installToSimulator(
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
212
|
+
this: XCUITestDriver,
|
|
213
|
+
app: string,
|
|
214
|
+
bundleId?: string,
|
|
215
|
+
opts: SimulatorInstallOptions = {},
|
|
216
|
+
): Promise<void> {
|
|
231
217
|
if (!app) {
|
|
232
218
|
this.log.debug('No app path is given. Nothing to install.');
|
|
233
219
|
return;
|
|
234
220
|
}
|
|
235
221
|
|
|
236
222
|
const {skipUninstall, newSimulator = false} = opts;
|
|
237
|
-
const device =
|
|
223
|
+
const device = this.device as Simulator;
|
|
238
224
|
|
|
239
225
|
if (!skipUninstall && !newSimulator && bundleId && (await device.isAppInstalled(bundleId))) {
|
|
240
226
|
this.log.debug(`Reset requested. Removing app with id '${bundleId}' from the device`);
|
|
@@ -248,10 +234,10 @@ export async function installToSimulator(
|
|
|
248
234
|
}
|
|
249
235
|
|
|
250
236
|
/**
|
|
251
|
-
*
|
|
237
|
+
* Shutdown other simulators
|
|
252
238
|
*/
|
|
253
|
-
export async function shutdownOtherSimulators() {
|
|
254
|
-
const device =
|
|
239
|
+
export async function shutdownOtherSimulators(this: XCUITestDriver): Promise<void> {
|
|
240
|
+
const device = this.device as Simulator;
|
|
255
241
|
const simctl = new Simctl({
|
|
256
242
|
devicesSetPath: device.devicesSetPath,
|
|
257
243
|
});
|
|
@@ -281,30 +267,27 @@ export async function shutdownOtherSimulators() {
|
|
|
281
267
|
/**
|
|
282
268
|
* Configures Safari options based on the given session capabilities
|
|
283
269
|
*
|
|
284
|
-
* @
|
|
285
|
-
* @return {Promise<boolean>} true if any preferences have been updated
|
|
270
|
+
* @returns true if any preferences have been updated
|
|
286
271
|
*/
|
|
287
|
-
export async function setSafariPrefs() {
|
|
272
|
+
export async function setSafariPrefs(this: XCUITestDriver): Promise<boolean> {
|
|
288
273
|
const prefs = buildSafariPreferences(this.opts);
|
|
289
274
|
if (_.isEmpty(prefs)) {
|
|
290
275
|
return false;
|
|
291
276
|
}
|
|
292
277
|
|
|
293
278
|
this.log.debug(`About to update Safari preferences: ${JSON.stringify(prefs)}`);
|
|
294
|
-
await
|
|
279
|
+
await (this.device as Simulator).updateSafariSettings(prefs);
|
|
295
280
|
return true;
|
|
296
281
|
}
|
|
297
282
|
|
|
298
283
|
/**
|
|
299
284
|
* Changes Simulator localization preferences
|
|
300
285
|
*
|
|
301
|
-
* @
|
|
302
|
-
* @returns {Promise<boolean>} True if preferences were changed
|
|
286
|
+
* @returns True if preferences were changed
|
|
303
287
|
*/
|
|
304
|
-
export async function setLocalizationPrefs() {
|
|
288
|
+
export async function setLocalizationPrefs(this: XCUITestDriver): Promise<boolean> {
|
|
305
289
|
const {language, locale, calendarFormat, skipSyncUiDialogTranslation} = this.opts;
|
|
306
|
-
|
|
307
|
-
const l10nConfig = {};
|
|
290
|
+
const l10nConfig: LocalizationOptions = {};
|
|
308
291
|
if (language) {
|
|
309
292
|
l10nConfig.language = {name: language, skipSyncUiDialogTranslation };
|
|
310
293
|
}
|
|
@@ -319,6 +302,30 @@ export async function setLocalizationPrefs() {
|
|
|
319
302
|
}
|
|
320
303
|
|
|
321
304
|
this.log.debug(`About to update localization preferences: ${JSON.stringify(l10nConfig)}`);
|
|
322
|
-
await
|
|
305
|
+
await (this.device as Simulator).configureLocalization(l10nConfig);
|
|
323
306
|
return true;
|
|
324
307
|
}
|
|
308
|
+
|
|
309
|
+
//#region Type Definitions
|
|
310
|
+
|
|
311
|
+
export interface SimulatorLookupOptions {
|
|
312
|
+
/** The name of the device to lookup */
|
|
313
|
+
deviceName?: string;
|
|
314
|
+
/** The platform version string */
|
|
315
|
+
platformVersion: string;
|
|
316
|
+
/** The full path to the simulator devices set */
|
|
317
|
+
simulatorDevicesSetPath?: string;
|
|
318
|
+
/** Simulator udid */
|
|
319
|
+
udid?: string;
|
|
320
|
+
/** The name of the current platform */
|
|
321
|
+
platformName?: string;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
export interface SimulatorInstallOptions {
|
|
325
|
+
/** Whether to skip app uninstall before installing it */
|
|
326
|
+
skipUninstall?: boolean;
|
|
327
|
+
/** Whether the simulator is brand new */
|
|
328
|
+
newSimulator?: boolean;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
//#endregion
|