@limrun/appium-xcuitest-driver 10.4.3-lim.1 → 10.10.1-lim.10
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 +84 -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/bidi/models.d.ts.map +1 -1
- package/build/lib/commands/bidi/models.js +1 -0
- package/build/lib/commands/bidi/models.js.map +1 -1
- package/build/lib/commands/bidi/types.d.ts +1 -0
- package/build/lib/commands/bidi/types.d.ts.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/condition.d.ts +2 -0
- package/build/lib/commands/condition.d.ts.map +1 -1
- package/build/lib/commands/condition.js +75 -2
- package/build/lib/commands/condition.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.d.ts +3 -2
- package/build/lib/commands/location.d.ts.map +1 -1
- package/build/lib/commands/location.js +10 -4
- package/build/lib/commands/location.js.map +1 -1
- package/build/lib/commands/log.js +9 -9
- 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 +392 -505
- package/build/lib/desired-caps.d.ts.map +1 -1
- package/build/lib/desired-caps.js +19 -10
- package/build/lib/desired-caps.js.map +1 -1
- package/build/lib/device/clients/base-device-client.d.ts +22 -0
- package/build/lib/device/clients/base-device-client.d.ts.map +1 -0
- package/build/lib/device/clients/base-device-client.js +14 -0
- package/build/lib/device/clients/base-device-client.js.map +1 -0
- package/build/lib/device/clients/py-ios-device-client.d.ts +21 -0
- package/build/lib/device/clients/py-ios-device-client.d.ts.map +1 -0
- package/build/lib/device/clients/py-ios-device-client.js +125 -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/device-connections-factory.js +260 -0
- package/build/lib/device/device-connections-factory.js.map +1 -0
- package/build/lib/device/log/helpers.d.ts +10 -0
- package/build/lib/device/log/helpers.d.ts.map +1 -0
- package/build/lib/device/log/helpers.js +37 -0
- package/build/lib/device/log/helpers.js.map +1 -0
- package/build/lib/device/log/ios-crash-log.d.ts +34 -0
- package/build/lib/device/log/ios-crash-log.d.ts.map +1 -0
- package/build/lib/device/log/ios-crash-log.js +141 -0
- package/build/lib/device/log/ios-crash-log.js.map +1 -0
- package/build/lib/device/log/ios-device-log.d.ts +19 -0
- package/build/lib/device/log/ios-device-log.d.ts.map +1 -0
- package/build/lib/device/log/ios-device-log.js +42 -0
- package/build/lib/device/log/ios-device-log.js.map +1 -0
- package/build/lib/device/log/ios-log.d.ts +24 -0
- package/build/lib/device/log/ios-log.d.ts.map +1 -0
- package/build/lib/device/log/ios-log.js +50 -0
- package/build/lib/device/log/ios-log.js.map +1 -0
- package/build/lib/device/log/ios-performance-log.d.ts +18 -0
- package/build/lib/device/log/ios-performance-log.d.ts.map +1 -0
- package/build/lib/device/log/ios-performance-log.js +43 -0
- package/build/lib/device/log/ios-performance-log.js.map +1 -0
- package/build/lib/device/log/ios-simulator-log.d.ts +38 -0
- package/build/lib/device/log/ios-simulator-log.d.ts.map +1 -0
- package/build/lib/device/log/ios-simulator-log.js +184 -0
- package/build/lib/device/log/ios-simulator-log.js.map +1 -0
- package/build/lib/device/log/line-consuming-log.d.ts +9 -0
- package/build/lib/device/log/line-consuming-log.d.ts.map +1 -0
- package/build/lib/device/log/line-consuming-log.js +16 -0
- package/build/lib/device/log/line-consuming-log.js.map +1 -0
- package/build/lib/device/log/safari-console-log.d.ts +67 -0
- package/build/lib/device/log/safari-console-log.d.ts.map +1 -0
- package/build/lib/device/log/safari-console-log.js +81 -0
- package/build/lib/device/log/safari-console-log.js.map +1 -0
- package/build/lib/device/log/safari-network-log.d.ts +75 -0
- package/build/lib/device/log/safari-network-log.d.ts.map +1 -0
- package/build/lib/device/log/safari-network-log.js +47 -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 +740 -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/device/simulator-management.js +261 -0
- package/build/lib/device/simulator-management.js.map +1 -0
- package/build/lib/device-log/ios-crash-log.d.ts +1 -1
- package/build/lib/device-log/ios-crash-log.d.ts.map +1 -1
- package/build/lib/device-log/ios-simulator-log.d.ts +1 -1
- package/build/lib/device-log/ios-simulator-log.d.ts.map +1 -1
- package/build/lib/doctor/required-checks.js +1 -1
- package/build/lib/doctor/required-checks.js.map +1 -1
- package/build/lib/driver.d.ts +129 -1377
- package/build/lib/driver.d.ts.map +1 -1
- package/build/lib/driver.js +461 -573
- 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/build/lib/simulator-management.d.ts +10 -0
- package/build/lib/simulator-management.d.ts.map +1 -1
- package/build/lib/simulator-management.js +9 -5
- package/build/lib/simulator-management.js.map +1 -1
- package/build/lib/utils.d.ts +2 -9
- package/build/lib/utils.d.ts.map +1 -1
- package/build/lib/utils.js +3 -47
- package/build/lib/utils.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/bidi/models.ts +1 -0
- package/lib/commands/bidi/types.ts +1 -0
- package/lib/commands/biometric.js +3 -3
- package/lib/commands/certificate.js +9 -3
- package/lib/commands/condition.js +85 -2
- 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 +11 -4
- package/lib/commands/log.js +9 -9
- 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} +20 -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 +4 -4
- package/lib/{device-log → device/log}/ios-log.ts +1 -1
- package/lib/{device-log → device/log}/ios-simulator-log.ts +9 -9
- 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 +831 -0
- package/lib/{simulator-management.js → device/simulator-management.ts} +75 -64
- package/lib/doctor/required-checks.ts +1 -1
- package/lib/{driver.js → driver.ts} +623 -707
- package/lib/{method-map.js → method-map.ts} +5 -2
- package/lib/utils.js +3 -54
- package/package.json +17 -19
- package/scripts/build-wda.js +3 -3
- package/lib/ios-fs-helpers.js +0 -355
- package/lib/ios-generic-simulators.js +0 -11
- package/lib/real-device-management.js +0 -133
- package/lib/real-device.js +0 -347
- package/lib/xcrun.js +0 -16
- /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}/safari-network-log.ts +0 -0
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import {getSimulator} from '
|
|
2
|
-
import {Simctl} from '
|
|
1
|
+
import {getSimulator, type Simulator, type LocalizationOptions} from 'appium-ios-simulator';
|
|
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,42 +47,36 @@ 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,
|
|
69
59
|
udid,
|
|
70
60
|
simulatorDevicesSetPath: devicesSetPath,
|
|
71
61
|
platformName,
|
|
62
|
+
limInstanceApiUrl,
|
|
63
|
+
limInstanceToken,
|
|
72
64
|
} = this.opts;
|
|
73
65
|
|
|
74
66
|
const platform = normalizePlatformName(platformName);
|
|
75
|
-
const selectSim = async (
|
|
67
|
+
const selectSim = async (dev: { udid: string; platform: string; }): Promise<Simulator> =>
|
|
76
68
|
await getSimulator(dev.udid, {
|
|
77
69
|
platform,
|
|
78
70
|
checkExistence: false,
|
|
79
71
|
devicesSetPath,
|
|
80
72
|
// @ts-ignore This is ok
|
|
81
73
|
logger: this.log,
|
|
74
|
+
limInstanceApiUrl,
|
|
75
|
+
limInstanceToken,
|
|
82
76
|
});
|
|
83
77
|
|
|
84
|
-
const simctl = new Simctl({devicesSetPath});
|
|
85
|
-
let devicesMap;
|
|
78
|
+
const simctl = new Simctl({devicesSetPath, limInstanceApiUrl, limInstanceToken});
|
|
79
|
+
let devicesMap: Record<string, any[]> | undefined;
|
|
86
80
|
if (udid && _.toLower(udid) !== UDID_AUTO) {
|
|
87
81
|
this.log.debug(`Looking for an existing Simulator with UDID '${udid}'`);
|
|
88
82
|
devicesMap = await simctl.getDevices(null, platform);
|
|
@@ -123,21 +117,23 @@ export async function getExistingSim() {
|
|
|
123
117
|
}
|
|
124
118
|
|
|
125
119
|
/**
|
|
126
|
-
*
|
|
120
|
+
* Shutdown simulator
|
|
127
121
|
*/
|
|
128
|
-
export async function shutdownSimulator() {
|
|
129
|
-
const device =
|
|
122
|
+
export async function shutdownSimulator(this: XCUITestDriver): Promise<void> {
|
|
123
|
+
const device = this.device as Simulator;
|
|
130
124
|
// stop XCTest processes if running to avoid unexpected side effects
|
|
131
125
|
await resetTestProcesses(device.udid, true);
|
|
132
126
|
await device.shutdown();
|
|
133
127
|
}
|
|
134
128
|
|
|
135
129
|
/**
|
|
136
|
-
*
|
|
137
|
-
* @
|
|
138
|
-
* @returns {Promise<void>}
|
|
130
|
+
* Run simulator reset
|
|
131
|
+
* @param enforceSimulatorShutdown Whether to enforce simulator shutdown
|
|
139
132
|
*/
|
|
140
|
-
export async function runSimulatorReset(
|
|
133
|
+
export async function runSimulatorReset(
|
|
134
|
+
this: XCUITestDriver,
|
|
135
|
+
enforceSimulatorShutdown: boolean = false
|
|
136
|
+
): Promise<void> {
|
|
141
137
|
const {
|
|
142
138
|
noReset,
|
|
143
139
|
fullReset,
|
|
@@ -152,7 +148,7 @@ export async function runSimulatorReset(enforceSimulatorShutdown = false) {
|
|
|
152
148
|
this.log.debug('Reset: noReset is on. Leaving simulator as is');
|
|
153
149
|
return;
|
|
154
150
|
}
|
|
155
|
-
const device =
|
|
151
|
+
const device = this.device as Simulator;
|
|
156
152
|
|
|
157
153
|
if (!this.device) {
|
|
158
154
|
this.log.debug('Reset: no device available. Skipping');
|
|
@@ -165,7 +161,7 @@ export async function runSimulatorReset(enforceSimulatorShutdown = false) {
|
|
|
165
161
|
const isKeychainsBackupSuccessful = (keychainsExcludePatterns || keepKeyChains) && (await device.backupKeychains());
|
|
166
162
|
await device.clean();
|
|
167
163
|
if (isKeychainsBackupSuccessful) {
|
|
168
|
-
await device.restoreKeychains(keychainsExcludePatterns || []);
|
|
164
|
+
await device.restoreKeychains(keychainsExcludePatterns?.split(',')?.map(_.trim) || []);
|
|
169
165
|
this.log.info(`Successfully restored keychains after full reset`);
|
|
170
166
|
} else if (keychainsExcludePatterns || keepKeyChains) {
|
|
171
167
|
this.log.warn(
|
|
@@ -194,8 +190,8 @@ export async function runSimulatorReset(enforceSimulatorShutdown = false) {
|
|
|
194
190
|
await device.scrubApp(bundleId);
|
|
195
191
|
}
|
|
196
192
|
} catch (err) {
|
|
197
|
-
this.log.debug(err.stack);
|
|
198
|
-
this.log.warn(err.message);
|
|
193
|
+
this.log.debug((err as Error).stack);
|
|
194
|
+
this.log.warn((err as Error).message);
|
|
199
195
|
this.log.warn(
|
|
200
196
|
`Reset: could not scrub ${
|
|
201
197
|
isSafari ? 'Safari browser' : 'application with id "' + this.opts.bundleId + '"'
|
|
@@ -205,36 +201,30 @@ export async function runSimulatorReset(enforceSimulatorShutdown = false) {
|
|
|
205
201
|
}
|
|
206
202
|
|
|
207
203
|
if (enforceSimulatorShutdown && (await device.isRunning())) {
|
|
208
|
-
await shutdownSimulator.bind(this)(
|
|
204
|
+
await shutdownSimulator.bind(this)();
|
|
209
205
|
}
|
|
210
206
|
}
|
|
211
207
|
}
|
|
212
208
|
|
|
213
209
|
/**
|
|
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={}]
|
|
210
|
+
* Install app to simulator
|
|
211
|
+
* @param app The app to the path
|
|
212
|
+
* @param bundleId The bundle id to ensure it is already installed and uninstall it
|
|
213
|
+
* @param opts Install options
|
|
225
214
|
*/
|
|
226
215
|
export async function installToSimulator(
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
216
|
+
this: XCUITestDriver,
|
|
217
|
+
app: string,
|
|
218
|
+
bundleId?: string,
|
|
219
|
+
opts: SimulatorInstallOptions = {},
|
|
220
|
+
): Promise<void> {
|
|
231
221
|
if (!app) {
|
|
232
222
|
this.log.debug('No app path is given. Nothing to install.');
|
|
233
223
|
return;
|
|
234
224
|
}
|
|
235
225
|
|
|
236
226
|
const {skipUninstall, newSimulator = false} = opts;
|
|
237
|
-
const device =
|
|
227
|
+
const device = this.device as Simulator;
|
|
238
228
|
|
|
239
229
|
if (!skipUninstall && !newSimulator && bundleId && (await device.isAppInstalled(bundleId))) {
|
|
240
230
|
this.log.debug(`Reset requested. Removing app with id '${bundleId}' from the device`);
|
|
@@ -248,10 +238,10 @@ export async function installToSimulator(
|
|
|
248
238
|
}
|
|
249
239
|
|
|
250
240
|
/**
|
|
251
|
-
*
|
|
241
|
+
* Shutdown other simulators
|
|
252
242
|
*/
|
|
253
|
-
export async function shutdownOtherSimulators() {
|
|
254
|
-
const device =
|
|
243
|
+
export async function shutdownOtherSimulators(this: XCUITestDriver): Promise<void> {
|
|
244
|
+
const device = this.device as Simulator;
|
|
255
245
|
const simctl = new Simctl({
|
|
256
246
|
devicesSetPath: device.devicesSetPath,
|
|
257
247
|
});
|
|
@@ -281,30 +271,27 @@ export async function shutdownOtherSimulators() {
|
|
|
281
271
|
/**
|
|
282
272
|
* Configures Safari options based on the given session capabilities
|
|
283
273
|
*
|
|
284
|
-
* @
|
|
285
|
-
* @return {Promise<boolean>} true if any preferences have been updated
|
|
274
|
+
* @returns true if any preferences have been updated
|
|
286
275
|
*/
|
|
287
|
-
export async function setSafariPrefs() {
|
|
276
|
+
export async function setSafariPrefs(this: XCUITestDriver): Promise<boolean> {
|
|
288
277
|
const prefs = buildSafariPreferences(this.opts);
|
|
289
278
|
if (_.isEmpty(prefs)) {
|
|
290
279
|
return false;
|
|
291
280
|
}
|
|
292
281
|
|
|
293
282
|
this.log.debug(`About to update Safari preferences: ${JSON.stringify(prefs)}`);
|
|
294
|
-
await
|
|
283
|
+
await (this.device as Simulator).updateSafariSettings(prefs);
|
|
295
284
|
return true;
|
|
296
285
|
}
|
|
297
286
|
|
|
298
287
|
/**
|
|
299
288
|
* Changes Simulator localization preferences
|
|
300
289
|
*
|
|
301
|
-
* @
|
|
302
|
-
* @returns {Promise<boolean>} True if preferences were changed
|
|
290
|
+
* @returns True if preferences were changed
|
|
303
291
|
*/
|
|
304
|
-
export async function setLocalizationPrefs() {
|
|
292
|
+
export async function setLocalizationPrefs(this: XCUITestDriver): Promise<boolean> {
|
|
305
293
|
const {language, locale, calendarFormat, skipSyncUiDialogTranslation} = this.opts;
|
|
306
|
-
|
|
307
|
-
const l10nConfig = {};
|
|
294
|
+
const l10nConfig: LocalizationOptions = {};
|
|
308
295
|
if (language) {
|
|
309
296
|
l10nConfig.language = {name: language, skipSyncUiDialogTranslation };
|
|
310
297
|
}
|
|
@@ -319,6 +306,30 @@ export async function setLocalizationPrefs() {
|
|
|
319
306
|
}
|
|
320
307
|
|
|
321
308
|
this.log.debug(`About to update localization preferences: ${JSON.stringify(l10nConfig)}`);
|
|
322
|
-
await
|
|
309
|
+
await (this.device as Simulator).configureLocalization(l10nConfig);
|
|
323
310
|
return true;
|
|
324
311
|
}
|
|
312
|
+
|
|
313
|
+
//#region Type Definitions
|
|
314
|
+
|
|
315
|
+
export interface SimulatorLookupOptions {
|
|
316
|
+
/** The name of the device to lookup */
|
|
317
|
+
deviceName?: string;
|
|
318
|
+
/** The platform version string */
|
|
319
|
+
platformVersion: string;
|
|
320
|
+
/** The full path to the simulator devices set */
|
|
321
|
+
simulatorDevicesSetPath?: string;
|
|
322
|
+
/** Simulator udid */
|
|
323
|
+
udid?: string;
|
|
324
|
+
/** The name of the current platform */
|
|
325
|
+
platformName?: string;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
export interface SimulatorInstallOptions {
|
|
329
|
+
/** Whether to skip app uninstall before installing it */
|
|
330
|
+
skipUninstall?: boolean;
|
|
331
|
+
/** Whether the simulator is brand new */
|
|
332
|
+
newSimulator?: boolean;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
//#endregion
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {fs, doctor} from 'appium/support';
|
|
2
2
|
import {exec} from 'teen_process';
|
|
3
|
-
import { getPath as getXcodePath } from '
|
|
3
|
+
import { getPath as getXcodePath } from 'appium-xcode';
|
|
4
4
|
import type {IDoctorCheck, AppiumLogger, DoctorCheckResult} from '@appium/types';
|
|
5
5
|
import '@colors/colors';
|
|
6
6
|
|