appium-xcuitest-driver 7.6.0 → 7.7.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 +14 -0
- package/build/lib/commands/app-management.d.ts.map +1 -1
- package/build/lib/commands/app-management.js +9 -17
- package/build/lib/commands/app-management.js.map +1 -1
- package/build/lib/commands/appearance.d.ts.map +1 -1
- package/build/lib/commands/appearance.js +2 -4
- package/build/lib/commands/appearance.js.map +1 -1
- package/build/lib/commands/biometric.d.ts.map +1 -1
- package/build/lib/commands/biometric.js +3 -6
- package/build/lib/commands/biometric.js.map +1 -1
- package/build/lib/commands/certificate.d.ts +1 -1
- package/build/lib/commands/certificate.d.ts.map +1 -1
- package/build/lib/commands/certificate.js +3 -5
- package/build/lib/commands/certificate.js.map +1 -1
- package/build/lib/commands/condition.d.ts.map +1 -1
- package/build/lib/commands/condition.js +2 -4
- package/build/lib/commands/condition.js.map +1 -1
- package/build/lib/commands/context.d.ts.map +1 -1
- package/build/lib/commands/context.js +1 -2
- package/build/lib/commands/context.js.map +1 -1
- package/build/lib/commands/deviceInfo.d.ts.map +1 -1
- package/build/lib/commands/deviceInfo.js +1 -2
- package/build/lib/commands/deviceInfo.js.map +1 -1
- package/build/lib/commands/file-movement.d.ts.map +1 -1
- package/build/lib/commands/file-movement.js +14 -22
- package/build/lib/commands/file-movement.js.map +1 -1
- package/build/lib/commands/general.d.ts.map +1 -1
- package/build/lib/commands/general.js +1 -2
- package/build/lib/commands/general.js.map +1 -1
- package/build/lib/commands/gesture.d.ts.map +1 -1
- package/build/lib/commands/gesture.js +1 -2
- package/build/lib/commands/gesture.js.map +1 -1
- package/build/lib/commands/keychains.js +1 -2
- package/build/lib/commands/keychains.js.map +1 -1
- package/build/lib/commands/localization.d.ts.map +1 -1
- package/build/lib/commands/localization.js +1 -3
- package/build/lib/commands/localization.js.map +1 -1
- package/build/lib/commands/location.d.ts.map +1 -1
- package/build/lib/commands/location.js +1 -2
- package/build/lib/commands/location.js.map +1 -1
- package/build/lib/commands/log.d.ts.map +1 -1
- package/build/lib/commands/log.js +2 -4
- package/build/lib/commands/log.js.map +1 -1
- package/build/lib/commands/memory.d.ts.map +1 -1
- package/build/lib/commands/memory.js +2 -2
- package/build/lib/commands/memory.js.map +1 -1
- package/build/lib/commands/notifications.d.ts +1 -1
- package/build/lib/commands/notifications.d.ts.map +1 -1
- package/build/lib/commands/notifications.js +1 -2
- package/build/lib/commands/notifications.js.map +1 -1
- package/build/lib/commands/pasteboard.d.ts.map +1 -1
- package/build/lib/commands/pasteboard.js +2 -4
- package/build/lib/commands/pasteboard.js.map +1 -1
- package/build/lib/commands/pcap.d.ts.map +1 -1
- package/build/lib/commands/pcap.js +1 -2
- 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 +4 -9
- package/build/lib/commands/performance.js.map +1 -1
- package/build/lib/commands/permissions.d.ts.map +1 -1
- package/build/lib/commands/permissions.js +2 -4
- package/build/lib/commands/permissions.js.map +1 -1
- package/build/lib/commands/recordscreen.d.ts.map +1 -1
- package/build/lib/commands/recordscreen.js +1 -2
- package/build/lib/commands/recordscreen.js.map +1 -1
- package/build/lib/commands/screenshots.d.ts +3 -2
- package/build/lib/commands/screenshots.d.ts.map +1 -1
- package/build/lib/commands/screenshots.js +8 -3
- package/build/lib/commands/screenshots.js.map +1 -1
- package/build/lib/commands/web.d.ts.map +1 -1
- package/build/lib/commands/web.js +1 -2
- package/build/lib/commands/web.js.map +1 -1
- package/build/lib/commands/xctest-record-screen.d.ts.map +1 -1
- package/build/lib/commands/xctest-record-screen.js +2 -4
- package/build/lib/commands/xctest-record-screen.js.map +1 -1
- package/build/lib/commands/xctest.d.ts.map +1 -1
- package/build/lib/commands/xctest.js +2 -4
- package/build/lib/commands/xctest.js.map +1 -1
- package/build/lib/devicectl.d.ts.map +1 -1
- package/build/lib/devicectl.js +4 -1
- package/build/lib/devicectl.js.map +1 -1
- package/build/lib/driver.d.ts +26 -8
- package/build/lib/driver.d.ts.map +1 -1
- package/build/lib/driver.js +75 -77
- package/build/lib/driver.js.map +1 -1
- package/build/lib/py-ios-device-client.d.ts +1 -1
- package/build/lib/real-device-management.d.ts +30 -27
- package/build/lib/real-device-management.d.ts.map +1 -1
- package/build/lib/real-device-management.js +34 -35
- package/build/lib/real-device-management.js.map +1 -1
- package/build/lib/real-device.d.ts +36 -9
- package/build/lib/real-device.d.ts.map +1 -1
- package/build/lib/real-device.js +46 -15
- package/build/lib/real-device.js.map +1 -1
- package/build/lib/simulator-management.d.ts +58 -68
- package/build/lib/simulator-management.d.ts.map +1 -1
- package/build/lib/simulator-management.js +74 -66
- package/build/lib/simulator-management.js.map +1 -1
- package/lib/commands/app-management.js +11 -18
- package/lib/commands/appearance.js +4 -4
- package/lib/commands/biometric.js +3 -6
- package/lib/commands/certificate.js +3 -5
- package/lib/commands/condition.js +2 -4
- package/lib/commands/context.js +1 -2
- package/lib/commands/deviceInfo.js +1 -2
- package/lib/commands/file-movement.js +14 -22
- package/lib/commands/general.js +1 -2
- package/lib/commands/gesture.js +1 -2
- package/lib/commands/keychains.js +2 -2
- package/lib/commands/localization.js +1 -4
- package/lib/commands/location.js +1 -2
- package/lib/commands/log.js +2 -4
- package/lib/commands/memory.js +2 -2
- package/lib/commands/notifications.js +1 -2
- package/lib/commands/pasteboard.js +4 -4
- package/lib/commands/pcap.js +1 -2
- package/lib/commands/performance.js +4 -8
- package/lib/commands/permissions.js +6 -4
- package/lib/commands/recordscreen.js +1 -2
- package/lib/commands/screenshots.js +8 -3
- package/lib/commands/web.js +1 -2
- package/lib/commands/xctest-record-screen.js +2 -4
- package/lib/commands/xctest.js +2 -4
- package/lib/devicectl.js +4 -1
- package/lib/driver.js +79 -78
- package/lib/real-device-management.js +37 -44
- package/lib/real-device.js +47 -17
- package/lib/simulator-management.js +83 -82
- package/npm-shrinkwrap.json +7 -29
- package/package.json +2 -2
|
@@ -3,12 +3,11 @@ 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.setLocalizationPrefs = exports.setSafariPrefs = exports.shutdownOtherSimulators = exports.
|
|
6
|
+
exports.setLocalizationPrefs = exports.setSafariPrefs = exports.shutdownOtherSimulators = exports.installToSimulator = exports.runSimulatorReset = exports.shutdownSimulator = exports.getExistingSim = exports.createSim = void 0;
|
|
7
7
|
const appium_ios_simulator_1 = require("appium-ios-simulator");
|
|
8
8
|
const node_simctl_1 = __importDefault(require("node-simctl"));
|
|
9
9
|
const appium_webdriveragent_1 = require("appium-webdriveragent");
|
|
10
10
|
const lodash_1 = __importDefault(require("lodash"));
|
|
11
|
-
const logger_1 = __importDefault(require("./logger"));
|
|
12
11
|
const support_1 = require("appium/support");
|
|
13
12
|
const utils_1 = require("./utils");
|
|
14
13
|
const APPIUM_SIM_PREFIX = 'appiumTest';
|
|
@@ -20,22 +19,15 @@ const SAFARI_OPTS_ALIASES_MAP = /** @type {const} */ ({
|
|
|
20
19
|
safariIgnoreFraudWarning: [['WarnAboutFraudulentWebsites'], (x) => Number(!x)],
|
|
21
20
|
safariOpenLinksInBackground: [['OpenLinksInBackground'], (x) => Number(Boolean(x))],
|
|
22
21
|
});
|
|
23
|
-
/**
|
|
24
|
-
* @typedef {Object} SimulatorCreationOptions
|
|
25
|
-
* @property {string} deviceName - A name for the device
|
|
26
|
-
* @property {string} platformVersion - The version of iOS to use
|
|
27
|
-
* @property {string} [simulatorDevicesSetPath]
|
|
28
|
-
* @property {string} [platformName]
|
|
29
|
-
*/
|
|
30
22
|
/**
|
|
31
23
|
* Create a new simulator with `appiumTest-` prefix and return the object.
|
|
32
24
|
*
|
|
33
|
-
* @
|
|
25
|
+
* @this {import('./driver').XCUITestDriver}
|
|
34
26
|
* @returns {Promise<object>} Simulator object associated with the udid passed in.
|
|
35
27
|
*/
|
|
36
|
-
async function createSim(
|
|
37
|
-
const { simulatorDevicesSetPath: devicesSetPath, deviceName, platformVersion } =
|
|
38
|
-
const platform = (0, utils_1.normalizePlatformName)(
|
|
28
|
+
async function createSim() {
|
|
29
|
+
const { simulatorDevicesSetPath: devicesSetPath, deviceName, platformVersion } = this.opts;
|
|
30
|
+
const platform = (0, utils_1.normalizePlatformName)(this.opts.platformName);
|
|
39
31
|
const simctl = new node_simctl_1.default({ devicesSetPath });
|
|
40
32
|
if (!deviceName) {
|
|
41
33
|
let deviceNames = 'none';
|
|
@@ -52,12 +44,13 @@ async function createSim(caps) {
|
|
|
52
44
|
throw new Error(`'platformVersion' is required.`);
|
|
53
45
|
}
|
|
54
46
|
const simName = `${APPIUM_SIM_PREFIX}-${support_1.util.uuidV4().toUpperCase()}-${deviceName}`;
|
|
55
|
-
|
|
47
|
+
this.log.debug(`Creating a temporary Simulator device '${simName}'`);
|
|
56
48
|
const udid = await simctl.createDevice(simName, deviceName, platformVersion, { platform });
|
|
57
49
|
return await (0, appium_ios_simulator_1.getSimulator)(udid, {
|
|
58
50
|
platform,
|
|
59
51
|
checkExistence: false,
|
|
60
52
|
devicesSetPath,
|
|
53
|
+
logger: this.log,
|
|
61
54
|
});
|
|
62
55
|
}
|
|
63
56
|
exports.createSim = createSim;
|
|
@@ -72,21 +65,22 @@ exports.createSim = createSim;
|
|
|
72
65
|
/**
|
|
73
66
|
* Get an existing simulator matching the provided capabilities.
|
|
74
67
|
*
|
|
75
|
-
* @
|
|
76
|
-
* @returns {Promise<
|
|
68
|
+
* @this {import('./driver').XCUITestDriver}
|
|
69
|
+
* @returns {Promise<import('./driver').Simulator|null>} The matched Simulator instance or `null` if no matching device is found.
|
|
77
70
|
*/
|
|
78
|
-
async function getExistingSim(
|
|
79
|
-
const { platformVersion, deviceName, udid, simulatorDevicesSetPath: devicesSetPath } = opts;
|
|
80
|
-
const platform = (0, utils_1.normalizePlatformName)(
|
|
71
|
+
async function getExistingSim() {
|
|
72
|
+
const { platformVersion, deviceName, udid, simulatorDevicesSetPath: devicesSetPath, platformName, } = this.opts;
|
|
73
|
+
const platform = (0, utils_1.normalizePlatformName)(platformName);
|
|
81
74
|
const selectSim = async (/** @type {{ udid: string; platform: string; }} */ dev) => await (0, appium_ios_simulator_1.getSimulator)(dev.udid, {
|
|
82
75
|
platform,
|
|
83
76
|
checkExistence: false,
|
|
84
77
|
devicesSetPath,
|
|
78
|
+
logger: this.log,
|
|
85
79
|
});
|
|
86
80
|
const simctl = new node_simctl_1.default({ devicesSetPath });
|
|
87
81
|
let devicesMap;
|
|
88
82
|
if (udid && lodash_1.default.toLower(udid) !== utils_1.UDID_AUTO) {
|
|
89
|
-
|
|
83
|
+
this.log.debug(`Looking for an existing Simulator with UDID '${udid}'`);
|
|
90
84
|
devicesMap = await simctl.getDevices(null, platform);
|
|
91
85
|
for (const device of lodash_1.default.flatMap(lodash_1.default.values(devicesMap))) {
|
|
92
86
|
if (device.udid === udid) {
|
|
@@ -96,16 +90,16 @@ async function getExistingSim(opts = /** @type {SimulatorLookupOptions} */ ({}))
|
|
|
96
90
|
return null;
|
|
97
91
|
}
|
|
98
92
|
if (!platformVersion) {
|
|
99
|
-
|
|
93
|
+
this.log.debug(`Provide 'platformVersion' capability if you prefer an existing Simulator to be selected`);
|
|
100
94
|
return null;
|
|
101
95
|
}
|
|
102
96
|
const devices = devicesMap?.[platformVersion] ?? (await simctl.getDevices(platformVersion, platform));
|
|
103
|
-
|
|
97
|
+
this.log.debug(`Looking for an existing Simulator with platformName: ${platform}, ` +
|
|
104
98
|
`platformVersion: ${platformVersion}, deviceName: ${deviceName}`);
|
|
105
99
|
for (const device of devices) {
|
|
106
100
|
if ((deviceName && device.name === deviceName) || !deviceName) {
|
|
107
101
|
if (!deviceName) {
|
|
108
|
-
|
|
102
|
+
this.log.debug(`The 'deviceName' capability value is empty. ` +
|
|
109
103
|
`Selecting the first matching device '${device.name}' having the ` +
|
|
110
104
|
`'platformVersion' set to ${platformVersion}`);
|
|
111
105
|
}
|
|
@@ -115,34 +109,44 @@ async function getExistingSim(opts = /** @type {SimulatorLookupOptions} */ ({}))
|
|
|
115
109
|
return null;
|
|
116
110
|
}
|
|
117
111
|
exports.getExistingSim = getExistingSim;
|
|
118
|
-
|
|
112
|
+
/**
|
|
113
|
+
* @this {import('./driver').XCUITestDriver}
|
|
114
|
+
*/
|
|
115
|
+
async function shutdownSimulator() {
|
|
116
|
+
const device = /** @type {import('./driver').Simulator} */ (this.device);
|
|
119
117
|
// stop XCTest processes if running to avoid unexpected side effects
|
|
120
118
|
await (0, appium_webdriveragent_1.resetTestProcesses)(device.udid, true);
|
|
121
119
|
await device.shutdown();
|
|
122
120
|
}
|
|
123
121
|
exports.shutdownSimulator = shutdownSimulator;
|
|
124
|
-
|
|
125
|
-
|
|
122
|
+
/**
|
|
123
|
+
* @this {import('./driver').XCUITestDriver}
|
|
124
|
+
* @property {boolean} [enforceSimulatorShutdown=false]
|
|
125
|
+
* @returns {Promise<void>}
|
|
126
|
+
*/
|
|
127
|
+
async function runSimulatorReset(enforceSimulatorShutdown = false) {
|
|
128
|
+
const { noReset, fullReset, keychainsExcludePatterns, keepKeyChains, bundleId, app, browserName, } = this.opts;
|
|
126
129
|
if (noReset && !fullReset) {
|
|
127
130
|
// noReset === true && fullReset === false
|
|
128
|
-
|
|
131
|
+
this.log.debug('Reset: noReset is on. Leaving simulator as is');
|
|
129
132
|
return;
|
|
130
133
|
}
|
|
131
|
-
|
|
132
|
-
|
|
134
|
+
const device = /** @type {import('./driver').Simulator} */ (this.device);
|
|
135
|
+
if (!this.device) {
|
|
136
|
+
this.log.debug('Reset: no device available. Skipping');
|
|
133
137
|
return;
|
|
134
138
|
}
|
|
135
139
|
if (fullReset) {
|
|
136
|
-
|
|
137
|
-
await shutdownSimulator(
|
|
140
|
+
this.log.debug('Reset: fullReset is on. Cleaning simulator');
|
|
141
|
+
await shutdownSimulator.bind(this)();
|
|
138
142
|
const isKeychainsBackupSuccessful = (keychainsExcludePatterns || keepKeyChains) && (await device.backupKeychains());
|
|
139
143
|
await device.clean();
|
|
140
144
|
if (isKeychainsBackupSuccessful) {
|
|
141
145
|
await device.restoreKeychains(keychainsExcludePatterns || []);
|
|
142
|
-
|
|
146
|
+
this.log.info(`Successfully restored keychains after full reset`);
|
|
143
147
|
}
|
|
144
148
|
else if (keychainsExcludePatterns || keepKeyChains) {
|
|
145
|
-
|
|
149
|
+
this.log.warn('Cannot restore keychains after full reset, because ' +
|
|
146
150
|
'the backup operation did not succeed');
|
|
147
151
|
}
|
|
148
152
|
}
|
|
@@ -153,29 +157,29 @@ async function runSimulatorReset(device, opts) {
|
|
|
153
157
|
await device.terminateApp(bundleId);
|
|
154
158
|
}
|
|
155
159
|
catch (err) {
|
|
156
|
-
|
|
160
|
+
this.log.warn(`Reset: failed to terminate Simulator application with id "${bundleId}"`);
|
|
157
161
|
}
|
|
158
162
|
if (app) {
|
|
159
|
-
|
|
163
|
+
this.log.info('Not scrubbing third party app in anticipation of uninstall');
|
|
160
164
|
}
|
|
161
165
|
else {
|
|
162
166
|
const isSafari = lodash_1.default.toLower(browserName) === 'safari';
|
|
163
167
|
try {
|
|
164
168
|
if (isSafari) {
|
|
165
|
-
await device.scrubSafari();
|
|
169
|
+
await device.scrubSafari(true);
|
|
166
170
|
}
|
|
167
171
|
else {
|
|
168
172
|
await device.scrubApp(bundleId);
|
|
169
173
|
}
|
|
170
174
|
}
|
|
171
175
|
catch (err) {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
176
|
+
this.log.debug(err.stack);
|
|
177
|
+
this.log.warn(err.message);
|
|
178
|
+
this.log.warn(`Reset: could not scrub ${isSafari ? 'Safari browser' : 'application with id "' + this.opts.bundleId + '"'}. ` + `Leaving as is.`);
|
|
175
179
|
}
|
|
176
180
|
}
|
|
177
181
|
if (enforceSimulatorShutdown && (await device.isRunning())) {
|
|
178
|
-
await shutdownSimulator(device);
|
|
182
|
+
await shutdownSimulator.bind(this)(device);
|
|
179
183
|
}
|
|
180
184
|
}
|
|
181
185
|
}
|
|
@@ -187,38 +191,43 @@ exports.runSimulatorReset = runSimulatorReset;
|
|
|
187
191
|
* @property {boolean} [newSimulator=false] Whether the simulator is brand new
|
|
188
192
|
*/
|
|
189
193
|
/**
|
|
190
|
-
* @
|
|
194
|
+
* @this {import('./driver').XCUITestDriver}
|
|
191
195
|
* @param {string} app The app to the path
|
|
192
196
|
* @param {string} [bundleId] The bundle id to ensure it is already installed and uninstall it
|
|
193
|
-
* @param {InstallOptions} opts
|
|
197
|
+
* @param {InstallOptions} [opts={}]
|
|
194
198
|
*/
|
|
195
|
-
async function installToSimulator(
|
|
199
|
+
async function installToSimulator(app, bundleId, opts = {}) {
|
|
196
200
|
if (!app) {
|
|
197
|
-
|
|
201
|
+
this.log.debug('No app path is given. Nothing to install.');
|
|
198
202
|
return;
|
|
199
203
|
}
|
|
200
204
|
const { skipUninstall, newSimulator = false } = opts;
|
|
205
|
+
const device = /** @type {import('./driver').Simulator} */ (this.device);
|
|
201
206
|
if (!skipUninstall && !newSimulator && bundleId && (await device.isAppInstalled(bundleId))) {
|
|
202
|
-
|
|
207
|
+
this.log.debug(`Reset requested. Removing app with id '${bundleId}' from the device`);
|
|
203
208
|
await device.removeApp(bundleId);
|
|
204
209
|
}
|
|
205
|
-
|
|
210
|
+
this.log.debug(`Installing '${app}' on Simulator with UUID '${device.udid}'...`);
|
|
206
211
|
const timer = new support_1.timing.Timer().start();
|
|
207
212
|
await device.installApp(app);
|
|
208
|
-
|
|
213
|
+
this.log.info(`The app has been successfully installed in ${timer.getDuration().asMilliSeconds.toFixed(0)}ms`);
|
|
209
214
|
}
|
|
210
215
|
exports.installToSimulator = installToSimulator;
|
|
211
|
-
|
|
216
|
+
/**
|
|
217
|
+
* @this {import('./driver').XCUITestDriver}
|
|
218
|
+
*/
|
|
219
|
+
async function shutdownOtherSimulators() {
|
|
220
|
+
const device = /** @type {import('./driver').Simulator} */ (this.device);
|
|
212
221
|
const simctl = new node_simctl_1.default({
|
|
213
|
-
devicesSetPath:
|
|
222
|
+
devicesSetPath: device.devicesSetPath,
|
|
214
223
|
});
|
|
215
224
|
const allDevices = lodash_1.default.flatMap(lodash_1.default.values(await simctl.getDevices()));
|
|
216
|
-
const otherBootedDevices = allDevices.filter((device) => device.udid !==
|
|
225
|
+
const otherBootedDevices = allDevices.filter((device) => device.udid !== device.udid && device.state === 'Booted');
|
|
217
226
|
if (lodash_1.default.isEmpty(otherBootedDevices)) {
|
|
218
|
-
|
|
227
|
+
this.log.info('No other running simulators have been detected');
|
|
219
228
|
return;
|
|
220
229
|
}
|
|
221
|
-
|
|
230
|
+
this.log.info(`Detected ${otherBootedDevices.length} other running ${support_1.util.pluralize('Simulator', otherBootedDevices.length)}.` + `Shutting them down...`);
|
|
222
231
|
for (const { udid } of otherBootedDevices) {
|
|
223
232
|
// It is necessary to stop the corresponding xcodebuild process before killing
|
|
224
233
|
// the simulator, otherwise it will be automatically restarted
|
|
@@ -231,37 +240,36 @@ exports.shutdownOtherSimulators = shutdownOtherSimulators;
|
|
|
231
240
|
/**
|
|
232
241
|
* Configures Safari options based on the given session capabilities
|
|
233
242
|
*
|
|
234
|
-
* @
|
|
235
|
-
* @param {object} opts Session capabilities
|
|
243
|
+
* @this {import('./driver').XCUITestDriver}
|
|
236
244
|
* @return {Promise<boolean>} true if any preferences have been updated
|
|
237
245
|
*/
|
|
238
|
-
async function setSafariPrefs(
|
|
239
|
-
const safariSettings = lodash_1.default.cloneDeep(opts.safariGlobalPreferences ?? {});
|
|
246
|
+
async function setSafariPrefs() {
|
|
247
|
+
const safariSettings = lodash_1.default.cloneDeep(this.opts.safariGlobalPreferences ?? {});
|
|
240
248
|
for (const [name, [aliases, valueConverter]] of lodash_1.default.toPairs(SAFARI_OPTS_ALIASES_MAP)) {
|
|
241
|
-
if (!lodash_1.default.has(opts, name)) {
|
|
249
|
+
if (!lodash_1.default.has(this.opts, name)) {
|
|
242
250
|
continue;
|
|
243
251
|
}
|
|
244
252
|
for (const alias of aliases) {
|
|
245
|
-
safariSettings[alias] = valueConverter(opts[name]);
|
|
253
|
+
safariSettings[alias] = valueConverter(this.opts[name]);
|
|
246
254
|
}
|
|
247
255
|
}
|
|
248
256
|
if (lodash_1.default.isEmpty(safariSettings)) {
|
|
249
257
|
return false;
|
|
250
258
|
}
|
|
251
|
-
|
|
252
|
-
await
|
|
259
|
+
this.log.debug(`About to update Safari preferences: ${JSON.stringify(safariSettings)}`);
|
|
260
|
+
await /** @type {import('./driver').Simulator} */ (this.device).updateSafariSettings(safariSettings);
|
|
253
261
|
return true;
|
|
254
262
|
}
|
|
255
263
|
exports.setSafariPrefs = setSafariPrefs;
|
|
256
264
|
/**
|
|
257
265
|
* Changes Simulator localization preferences
|
|
258
266
|
*
|
|
259
|
-
* @
|
|
260
|
-
* @param {object} opts Session capabilities
|
|
267
|
+
* @this {import('./driver').XCUITestDriver}
|
|
261
268
|
* @returns {Promise<boolean>} True if preferences were changed
|
|
262
269
|
*/
|
|
263
|
-
async function setLocalizationPrefs(
|
|
264
|
-
const { language, locale, calendarFormat, skipSyncUiDialogTranslation } = opts;
|
|
270
|
+
async function setLocalizationPrefs() {
|
|
271
|
+
const { language, locale, calendarFormat, skipSyncUiDialogTranslation } = this.opts;
|
|
272
|
+
/** @type {import('appium-ios-simulator').LocalizationOptions} */
|
|
265
273
|
const l10nConfig = {};
|
|
266
274
|
if (language) {
|
|
267
275
|
l10nConfig.language = { name: language, skipSyncUiDialogTranslation };
|
|
@@ -275,8 +283,8 @@ async function setLocalizationPrefs(sim, opts = {}) {
|
|
|
275
283
|
if (lodash_1.default.isEmpty(l10nConfig)) {
|
|
276
284
|
return false;
|
|
277
285
|
}
|
|
278
|
-
|
|
279
|
-
await
|
|
286
|
+
this.log.debug(`About to update localization preferences: ${JSON.stringify(l10nConfig)}`);
|
|
287
|
+
await /** @type {import('./driver').Simulator} */ (this.device).configureLocalization(l10nConfig);
|
|
280
288
|
return true;
|
|
281
289
|
}
|
|
282
290
|
exports.setLocalizationPrefs = setLocalizationPrefs;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simulator-management.js","sourceRoot":"","sources":["../../lib/simulator-management.js"],"names":[],"mappings":";;;;;;AAAA,+DAAkD;AAClD,8DAAiC;AACjC,iEAAyD;AACzD,oDAAuB;AACvB,
|
|
1
|
+
{"version":3,"file":"simulator-management.js","sourceRoot":"","sources":["../../lib/simulator-management.js"],"names":[],"mappings":";;;;;;AAAA,+DAAkD;AAClD,8DAAiC;AACjC,iEAAyD;AACzD,oDAAuB;AACvB,4CAA4C;AAC5C,mCAAyD;AAEzD,MAAM,iBAAiB,GAAG,YAAY,CAAC;AACvC,MAAM,uBAAuB,GAAG,oBAAoB,CAAC,CAAC;IACpD,iBAAiB,EAAE;QACjB,CAAC,6CAA6C,EAAE,uCAAuC,CAAC;QACxF,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;KAC1B;IACD,wBAAwB,EAAE,CAAC,CAAC,6BAA6B,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9E,2BAA2B,EAAE,CAAC,CAAC,uBAAuB,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;CACpF,CAAC,CAAC;AAEH;;;;;GAKG;AACI,KAAK,UAAU,SAAS;IAC7B,MAAM,EAAC,uBAAuB,EAAE,cAAc,EAAE,UAAU,EAAE,eAAe,EAAC,GAAG,IAAI,CAAC,IAAI,CAAC;IACzF,MAAM,QAAQ,GAAG,IAAA,6BAAqB,EAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IAC/D,MAAM,MAAM,GAAG,IAAI,qBAAM,CAAC,EAAC,cAAc,EAAC,CAAC,CAAC;IAC5C,IAAI,CAAC,UAAU,EAAE,CAAC;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CAmBC;AAED;;;;;GAKG;AACI,KAAK,UAAU,oBAAoB;IACxC,MAAM,EAAC,QAAQ,EAAE,MAAM,EAAE,cAAc,EAAE,2BAA2B,EAAC,GAAG,IAAI,CAAC,IAAI,CAAC;IAClF,iEAAiE;IACjE,MAAM,UAAU,GAAG,EAAE,CAAC;IACtB,IAAI,QAAQ,EAAE,CAAC;QACb,UAAU,CAAC,QAAQ,GAAG,EAAC,IAAI,EAAE,QAAQ,EAAE,2BAA2B,EAAE,CAAC;IACvE,CAAC;IACD,IAAI,MAAM,EAAE,CAAC;QACX,UAAU,CAAC,MAAM,GAAG,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;QACnC,IAAI,cAAc,EAAE,CAAC;YACnB,UAAU,CAAC,MAAM,CAAC,QAAQ,GAAG,cAAc,CAAC;QAC9C,CAAC;IACH,CAAC;IACD,IAAI,gBAAC,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;QAC1B,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,6CAA6C,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;IAC1F,MAAM,2CAA2C,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC;IAClG,OAAO,IAAI,CAAC;AACd,CAAC;AApBD,oDAoBC"}
|
|
@@ -23,8 +23,7 @@ export default {
|
|
|
23
23
|
const srcAppPath = await this.helpers.configureApp(app, '.app');
|
|
24
24
|
this.log.info(
|
|
25
25
|
`Installing '${srcAppPath}' to the ${this.isRealDevice() ? 'real device' : 'Simulator'} ` +
|
|
26
|
-
|
|
27
|
-
`with UDID '${this.opts.device.udid}'`,
|
|
26
|
+
`with UDID '${this.device.udid}'`,
|
|
28
27
|
);
|
|
29
28
|
if (!(await fs.exists(srcAppPath))) {
|
|
30
29
|
throw this.log.errorWithException(
|
|
@@ -36,7 +35,7 @@ export default {
|
|
|
36
35
|
const bundleId = await extractBundleId(srcAppPath);
|
|
37
36
|
const {install} = await this.checkAutInstallationState(
|
|
38
37
|
// @ts-expect-error - do not assign arbitrary properties to `this.opts`
|
|
39
|
-
{enforceAppInstall: false, fullReset: false, noReset: false, bundleId, device: this.
|
|
38
|
+
{enforceAppInstall: false, fullReset: false, noReset: false, bundleId, device: this.device, app: srcAppPath}
|
|
40
39
|
);
|
|
41
40
|
|
|
42
41
|
if (!install) {
|
|
@@ -45,8 +44,7 @@ export default {
|
|
|
45
44
|
}
|
|
46
45
|
}
|
|
47
46
|
|
|
48
|
-
|
|
49
|
-
await this.opts.device.installApp(
|
|
47
|
+
await this.device.installApp(
|
|
50
48
|
srcAppPath,
|
|
51
49
|
timeoutMs ?? this.opts.appPushTimeout,
|
|
52
50
|
strategy ?? this.opts.appInstallStrategy,
|
|
@@ -62,8 +60,7 @@ export default {
|
|
|
62
60
|
* @this {XCUITestDriver}
|
|
63
61
|
*/
|
|
64
62
|
async mobileIsAppInstalled(bundleId) {
|
|
65
|
-
|
|
66
|
-
const installed = await this.opts.device.isAppInstalled(bundleId);
|
|
63
|
+
const installed = await this.device.isAppInstalled(bundleId);
|
|
67
64
|
this.log.info(`App '${bundleId}' is${installed ? '' : ' not'} installed`);
|
|
68
65
|
return installed;
|
|
69
66
|
},
|
|
@@ -78,14 +75,10 @@ export default {
|
|
|
78
75
|
async mobileRemoveApp(bundleId) {
|
|
79
76
|
this.log.info(
|
|
80
77
|
`Uninstalling the application with bundle identifier '${bundleId}' ` +
|
|
81
|
-
|
|
82
|
-
// @ts-expect-error - do not assign arbitrary properties to `this.opts`
|
|
83
|
-
this.opts.device.udid
|
|
84
|
-
}'`,
|
|
78
|
+
`from the ${this.isRealDevice() ? 'real device' : 'Simulator'} with UDID '${this.device.udid}'`,
|
|
85
79
|
);
|
|
86
80
|
try {
|
|
87
|
-
|
|
88
|
-
await this.opts.device.removeApp(bundleId);
|
|
81
|
+
await this.device.removeApp(bundleId);
|
|
89
82
|
this.log.info(`Removal of '${bundleId}' succeeded`);
|
|
90
83
|
return true;
|
|
91
84
|
} catch (err) {
|
|
@@ -158,8 +151,9 @@ export default {
|
|
|
158
151
|
throw new errors.UnsupportedOperationError('A real device is required');
|
|
159
152
|
}
|
|
160
153
|
|
|
161
|
-
|
|
162
|
-
|
|
154
|
+
return await /** @type {import('../real-device').RealDevice} */ (this.device).terminateApp(
|
|
155
|
+
bundleId, String(this.opts.platformVersion)
|
|
156
|
+
);
|
|
163
157
|
},
|
|
164
158
|
|
|
165
159
|
/**
|
|
@@ -232,7 +226,7 @@ export default {
|
|
|
232
226
|
throw new errors.NotImplementedError(`This extension is only supported on real devices`);
|
|
233
227
|
}
|
|
234
228
|
|
|
235
|
-
const service = await services.startInstallationProxyService(this.
|
|
229
|
+
const service = await services.startInstallationProxyService(this.device.udid);
|
|
236
230
|
try {
|
|
237
231
|
return await service.listApplications({applicationType});
|
|
238
232
|
} finally {
|
|
@@ -258,8 +252,7 @@ export default {
|
|
|
258
252
|
);
|
|
259
253
|
}
|
|
260
254
|
|
|
261
|
-
|
|
262
|
-
const simctl = this.opts.device.simctl;
|
|
255
|
+
const simctl = /** @type {import('../driver').Simulator} */ (this.device).simctl;
|
|
263
256
|
const dataRoot = await simctl.getAppContainer(bundleId, 'data');
|
|
264
257
|
this.log.debug(`Got the data container root of ${bundleId} at '${dataRoot}'`);
|
|
265
258
|
if (!await fs.exists(dataRoot)) {
|
|
@@ -21,8 +21,7 @@ export default {
|
|
|
21
21
|
|
|
22
22
|
if (this.isSimulator()) {
|
|
23
23
|
try {
|
|
24
|
-
|
|
25
|
-
return void (await this.opts.device.setAppearance(style));
|
|
24
|
+
return void (await /** @type {import('../driver').Simulator} */ (this.device).setAppearance(style));
|
|
26
25
|
} catch (e) {
|
|
27
26
|
this.log.debug(e.stack);
|
|
28
27
|
}
|
|
@@ -53,8 +52,9 @@ export default {
|
|
|
53
52
|
let style;
|
|
54
53
|
if (this.isSimulator()) {
|
|
55
54
|
try {
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
style = /** @type {Style} */ (
|
|
56
|
+
await /** @type {import('../driver').Simulator} */ (this.device).getAppearance()
|
|
57
|
+
);
|
|
58
58
|
} catch (ign) {}
|
|
59
59
|
}
|
|
60
60
|
if (!style) {
|
|
@@ -15,8 +15,7 @@ export default {
|
|
|
15
15
|
async mobileEnrollBiometric(isEnabled = true) {
|
|
16
16
|
assertSimulator(this);
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
await this.opts.device.enrollBiometric(isEnabled);
|
|
18
|
+
await /** @type {import('../driver').Simulator} */ (this.device).enrollBiometric(isEnabled);
|
|
20
19
|
},
|
|
21
20
|
|
|
22
21
|
/**
|
|
@@ -33,8 +32,7 @@ export default {
|
|
|
33
32
|
async mobileSendBiometricMatch(type = 'touchId', match = true) {
|
|
34
33
|
assertSimulator(this);
|
|
35
34
|
|
|
36
|
-
|
|
37
|
-
await this.opts.device.sendBiometricMatch(match, type);
|
|
35
|
+
await /** @type {import('../driver').Simulator} */ (this.device).sendBiometricMatch(match, type);
|
|
38
36
|
},
|
|
39
37
|
|
|
40
38
|
/**
|
|
@@ -48,8 +46,7 @@ export default {
|
|
|
48
46
|
async mobileIsBiometricEnrolled() {
|
|
49
47
|
assertSimulator(this);
|
|
50
48
|
|
|
51
|
-
|
|
52
|
-
return await this.opts.device.isBiometricEnrolled();
|
|
49
|
+
return await /** @type {import('../driver').Simulator} */ (this.device).isBiometricEnrolled();
|
|
53
50
|
},
|
|
54
51
|
};
|
|
55
52
|
|
|
@@ -295,7 +295,7 @@ export default {
|
|
|
295
295
|
* @param {string} [commonName] - Common name of the certificate. If this is not set, the command will try to parse it from the provided `content`.
|
|
296
296
|
* @param {boolean} isRoot - Defines where the certificate should be installed; either the Trusted Root Store (`true`) or the Keychain (`false`). On environments other than Xcode 11.4+ Simulator, this option is ignored.
|
|
297
297
|
* @returns {Promise<string|void>} The content of the generated `.mobileconfig` file as
|
|
298
|
-
a base64-encoded string. This config might be useful for debugging purposes. If the certificate has been successfully set via CLI, then nothing is returned.
|
|
298
|
+
* a base64-encoded string. This config might be useful for debugging purposes. If the certificate has been successfully set via CLI, then nothing is returned.
|
|
299
299
|
* @this {XCUITestDriver}
|
|
300
300
|
*/
|
|
301
301
|
async mobileInstallCertificate(content, commonName, isRoot = true) {
|
|
@@ -306,8 +306,7 @@ export default {
|
|
|
306
306
|
if (this.isSimulator()) {
|
|
307
307
|
try {
|
|
308
308
|
const methodName = isRoot ? 'addRootCertificate' : 'addCertificate';
|
|
309
|
-
|
|
310
|
-
await this.opts.device.simctl[methodName](Buffer.from(content, 'base64').toString(), {
|
|
309
|
+
await /** @type {import('../driver').Simulator} */ (this.device).simctl[methodName](Buffer.from(content, 'base64').toString(), {
|
|
311
310
|
raw: true,
|
|
312
311
|
});
|
|
313
312
|
return;
|
|
@@ -387,8 +386,7 @@ export default {
|
|
|
387
386
|
}
|
|
388
387
|
}
|
|
389
388
|
} else {
|
|
390
|
-
|
|
391
|
-
await this.opts.device.openUrl(certUrl);
|
|
389
|
+
await /** @type {import('../driver').Simulator} */ (this.device).openUrl(certUrl);
|
|
392
390
|
}
|
|
393
391
|
|
|
394
392
|
let isCertAlreadyInstalled = false;
|
|
@@ -63,8 +63,7 @@ export default {
|
|
|
63
63
|
*/
|
|
64
64
|
async listConditionInducers() {
|
|
65
65
|
requireConditionInducerCompatibleDevice(this);
|
|
66
|
-
|
|
67
|
-
const conditionInducerService = await services.startInstrumentService(this.opts.device.udid);
|
|
66
|
+
const conditionInducerService = await services.startInstrumentService(this.device.udid);
|
|
68
67
|
try {
|
|
69
68
|
const ret = await conditionInducerService.callChannel(
|
|
70
69
|
INSTRUMENT_CHANNEL.CONDITION_INDUCER,
|
|
@@ -100,8 +99,7 @@ export default {
|
|
|
100
99
|
if (this._conditionInducerService && !this._conditionInducerService._socketClient.destroyed) {
|
|
101
100
|
this.log.errorAndThrow(`Condition inducer has been started. A condition is already active.`);
|
|
102
101
|
}
|
|
103
|
-
|
|
104
|
-
this._conditionInducerService = await services.startInstrumentService(this.opts.device.udid);
|
|
102
|
+
this._conditionInducerService = await services.startInstrumentService(this.device.udid);
|
|
105
103
|
const ret = await this._conditionInducerService.callChannel(
|
|
106
104
|
INSTRUMENT_CHANNEL.CONDITION_INDUCER,
|
|
107
105
|
'enableConditionWithIdentifier:profileIdentifier:',
|
package/lib/commands/context.js
CHANGED
|
@@ -439,8 +439,7 @@ const helpers = {
|
|
|
439
439
|
async getNewRemoteDebugger() {
|
|
440
440
|
let socketPath;
|
|
441
441
|
if (!this.isRealDevice()) {
|
|
442
|
-
|
|
443
|
-
socketPath = await this.opts.device.getWebInspectorSocket();
|
|
442
|
+
socketPath = await /** @type {import('../driver').Simulator} */ (this.device).getWebInspectorSocket();
|
|
444
443
|
}
|
|
445
444
|
return createRemoteDebugger(
|
|
446
445
|
{
|
|
@@ -14,8 +14,7 @@ export default {
|
|
|
14
14
|
);
|
|
15
15
|
|
|
16
16
|
if (this.isRealDevice()) {
|
|
17
|
-
|
|
18
|
-
const lockdownInfo = await utilities.getDeviceInfo(this.opts.device.udid);
|
|
17
|
+
const lockdownInfo = await utilities.getDeviceInfo(this.device.udid);
|
|
19
18
|
return {...infoByWda, ...{lockdownInfo}};
|
|
20
19
|
}
|
|
21
20
|
|