appium-ios-simulator 8.0.11 → 8.0.13

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.
Files changed (68) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/build/lib/defaults-utils.d.ts +1 -0
  3. package/build/lib/defaults-utils.d.ts.map +1 -1
  4. package/build/lib/defaults-utils.js +15 -7
  5. package/build/lib/defaults-utils.js.map +1 -1
  6. package/build/lib/extensions/applications.d.ts.map +1 -1
  7. package/build/lib/extensions/applications.js +2 -2
  8. package/build/lib/extensions/applications.js.map +1 -1
  9. package/build/lib/extensions/biometric.d.ts.map +1 -1
  10. package/build/lib/extensions/biometric.js +9 -13
  11. package/build/lib/extensions/biometric.js.map +1 -1
  12. package/build/lib/extensions/geolocation.d.ts.map +1 -1
  13. package/build/lib/extensions/geolocation.js.map +1 -1
  14. package/build/lib/extensions/keychain.d.ts.map +1 -1
  15. package/build/lib/extensions/keychain.js +14 -11
  16. package/build/lib/extensions/keychain.js.map +1 -1
  17. package/build/lib/extensions/misc.d.ts.map +1 -1
  18. package/build/lib/extensions/misc.js +2 -5
  19. package/build/lib/extensions/misc.js.map +1 -1
  20. package/build/lib/extensions/permissions.d.ts.map +1 -1
  21. package/build/lib/extensions/permissions.js +19 -11
  22. package/build/lib/extensions/permissions.js.map +1 -1
  23. package/build/lib/extensions/safari.d.ts.map +1 -1
  24. package/build/lib/extensions/safari.js +1 -1
  25. package/build/lib/extensions/safari.js.map +1 -1
  26. package/build/lib/extensions/settings.d.ts +2 -2
  27. package/build/lib/extensions/settings.d.ts.map +1 -1
  28. package/build/lib/extensions/settings.js +31 -30
  29. package/build/lib/extensions/settings.js.map +1 -1
  30. package/build/lib/index.d.ts +5 -0
  31. package/build/lib/index.d.ts.map +1 -0
  32. package/build/{index.js → lib/index.js} +2 -3
  33. package/build/lib/index.js.map +1 -0
  34. package/build/lib/logger.js.map +1 -1
  35. package/build/lib/simulator-xcode-14.d.ts.map +1 -1
  36. package/build/lib/simulator-xcode-14.js +7 -8
  37. package/build/lib/simulator-xcode-14.js.map +1 -1
  38. package/build/lib/simulator-xcode-15.d.ts.map +1 -1
  39. package/build/lib/simulator-xcode-15.js +4 -2
  40. package/build/lib/simulator-xcode-15.js.map +1 -1
  41. package/build/lib/simulator.d.ts.map +1 -1
  42. package/build/lib/simulator.js +3 -3
  43. package/build/lib/simulator.js.map +1 -1
  44. package/build/lib/types.d.ts.map +1 -1
  45. package/build/lib/utils.d.ts.map +1 -1
  46. package/build/lib/utils.js +3 -3
  47. package/build/lib/utils.js.map +1 -1
  48. package/lib/defaults-utils.ts +32 -15
  49. package/lib/extensions/applications.ts +30 -24
  50. package/lib/extensions/biometric.ts +27 -21
  51. package/lib/extensions/geolocation.ts +6 -3
  52. package/lib/extensions/keychain.ts +22 -18
  53. package/lib/extensions/misc.ts +9 -12
  54. package/lib/extensions/permissions.ts +93 -52
  55. package/lib/extensions/safari.ts +61 -32
  56. package/lib/extensions/settings.ts +153 -81
  57. package/lib/index.ts +6 -0
  58. package/lib/logger.ts +1 -1
  59. package/lib/simulator-xcode-14.ts +65 -45
  60. package/lib/simulator-xcode-15.ts +7 -6
  61. package/lib/simulator.ts +13 -17
  62. package/lib/types.ts +14 -14
  63. package/lib/utils.ts +25 -18
  64. package/package.json +6 -6
  65. package/build/index.d.ts +0 -5
  66. package/build/index.d.ts.map +0 -1
  67. package/build/index.js.map +0 -1
  68. package/index.ts +0 -8
@@ -1,11 +1,11 @@
1
1
  import _ from 'lodash';
2
- import { fs, timing, util } from '@appium/support';
3
- import { exec } from 'teen_process';
2
+ import {fs, timing, util} from '@appium/support';
3
+ import {exec} from 'teen_process';
4
4
  import path from 'node:path';
5
5
  import B from 'bluebird';
6
- import { waitForCondition } from 'asyncbox';
7
- import type { CoreSimulator, SupportsAppPermissions } from '../types';
8
- import type { StringRecord } from '@appium/types';
6
+ import {waitForCondition} from 'asyncbox';
7
+ import type {CoreSimulator, SupportsAppPermissions} from '../types';
8
+ import type {StringRecord} from '@appium/types';
9
9
 
10
10
  type CoreSimulatorWithAppPermissions = CoreSimulator & SupportsAppPermissions;
11
11
 
@@ -25,10 +25,7 @@ const SYSTEM_SERVICE_RESTART_TIMEOUT_MS = 15000;
25
25
  // permissions properly but it kills the app process while WIX/applesimutils does not.
26
26
  // In the backward compatibility perspective,
27
27
  // we'd like to keep the app process as possible.
28
- const PERMISSIONS_APPLIED_VIA_SIMCTL = [
29
- 'location',
30
- 'location-always'
31
- ];
28
+ const PERMISSIONS_APPLIED_VIA_SIMCTL = ['location', 'location-always'];
32
29
  const SERVICES = Object.freeze({
33
30
  calendar: 'kTCCServiceCalendar',
34
31
  camera: 'kTCCServiceCamera',
@@ -57,7 +54,7 @@ export async function setPermission(
57
54
  this: CoreSimulatorWithAppPermissions,
58
55
  bundleId: string,
59
56
  permission: string,
60
- value: string
57
+ value: string,
61
58
  ): Promise<void> {
62
59
  await this.setPermissions(bundleId, {[permission]: value});
63
60
  }
@@ -75,9 +72,11 @@ export async function setPermission(
75
72
  export async function setPermissions(
76
73
  this: CoreSimulatorWithAppPermissions,
77
74
  bundleId: string,
78
- permissionsMapping: StringRecord
75
+ permissionsMapping: StringRecord,
79
76
  ): Promise<void> {
80
- this.log.debug(`Setting access for '${bundleId}': ${JSON.stringify(permissionsMapping, null, 2)}`);
77
+ this.log.debug(
78
+ `Setting access for '${bundleId}': ${JSON.stringify(permissionsMapping, null, 2)}`,
79
+ );
81
80
  await setAccess.bind(this)(bundleId, permissionsMapping);
82
81
  }
83
82
 
@@ -92,7 +91,7 @@ export async function setPermissions(
92
91
  export async function getPermission(
93
92
  this: CoreSimulatorWithAppPermissions,
94
93
  bundleId: string,
95
- serviceName: string
94
+ serviceName: string,
96
95
  ): Promise<string> {
97
96
  const result = await getAccess.bind(this)(bundleId, serviceName);
98
97
  this.log.debug(`Got ${serviceName} access status for '${bundleId}': ${result}`);
@@ -105,12 +104,12 @@ function toInternalServiceName(serviceName: string): string {
105
104
  return SERVICES[lowerName as keyof typeof SERVICES] as string;
106
105
  }
107
106
  throw new Error(
108
- `'${serviceName}' is unknown. Only the following service names are supported: ${JSON.stringify(_.keys(SERVICES))}`
107
+ `'${serviceName}' is unknown. Only the following service names are supported: ${JSON.stringify(_.keys(SERVICES))}`,
109
108
  );
110
109
  }
111
110
 
112
111
  function formatStatus(status: string): string {
113
- return (status === STATUS.UNSET || status === STATUS.NO) ? _.toUpper(status) : status;
112
+ return status === STATUS.UNSET || status === STATUS.NO ? _.toUpper(status) : status;
114
113
  }
115
114
 
116
115
  /**
@@ -120,13 +119,17 @@ function formatStatus(status: string): string {
120
119
  * @param query The actual query string
121
120
  * @returns Promise that resolves to sqlite command stdout
122
121
  */
123
- async function execSQLiteQuery(this: CoreSimulatorWithAppPermissions, db: string, query: string): Promise<string> {
122
+ async function execSQLiteQuery(
123
+ this: CoreSimulatorWithAppPermissions,
124
+ db: string,
125
+ query: string,
126
+ ): Promise<string> {
124
127
  this.log.debug(`Executing SQL query "${query}" on '${db}'`);
125
128
  try {
126
129
  return (await exec('sqlite3', ['-line', db, query])).stdout;
127
130
  } catch (err: any) {
128
131
  throw new Error(
129
- `Cannot execute SQLite query "${query}" to '${db}'. Original error: ${err.stderr}`
132
+ `Cannot execute SQLite query "${query}" to '${db}'. Original error: ${err.stderr}`,
130
133
  );
131
134
  }
132
135
  }
@@ -141,8 +144,8 @@ async function execWix(this: CoreSimulatorWithAppPermissions, args: string[]): P
141
144
  } catch {
142
145
  throw new Error(
143
146
  `${WIX_SIM_UTILS} binary has not been found in your PATH. ` +
144
- `Please install it ('brew tap wix/brew && brew install wix/brew/applesimutils') to ` +
145
- `be able to change application permissions`
147
+ `Please install it ('brew tap wix/brew && brew install wix/brew/applesimutils') to ` +
148
+ `be able to change application permissions`,
146
149
  );
147
150
  }
148
151
 
@@ -152,7 +155,9 @@ async function execWix(this: CoreSimulatorWithAppPermissions, args: string[]): P
152
155
  this.log.debug(`Command output: ${stdout}`);
153
156
  return stdout;
154
157
  } catch (e: any) {
155
- throw new Error(`Cannot execute "${WIX_SIM_UTILS} ${util.quote(args)}". Original error: ${e.stderr || e.message}`);
158
+ throw new Error(
159
+ `Cannot execute "${WIX_SIM_UTILS} ${util.quote(args)}". Original error: ${e.stderr || e.message}`,
160
+ );
156
161
  }
157
162
  }
158
163
 
@@ -171,7 +176,7 @@ async function execWix(this: CoreSimulatorWithAppPermissions, args: string[]): P
171
176
  async function setAccess(
172
177
  this: CoreSimulatorWithAppPermissions,
173
178
  bundleId: string,
174
- permissionsMapping: StringRecord
179
+ permissionsMapping: StringRecord,
175
180
  ): Promise<boolean> {
176
181
  const wixPermissions: Record<string, string> = {};
177
182
 
@@ -197,7 +202,7 @@ async function setAccess(
197
202
  break;
198
203
  default:
199
204
  throw this.log.errorWithException(
200
- `${serviceName} does not support ${permissionsMapping[serviceName]}. Please specify 'yes', 'no' or 'unset'.`
205
+ `${serviceName} does not support ${permissionsMapping[serviceName]}. Please specify 'yes', 'no' or 'unset'.`,
201
206
  );
202
207
  }
203
208
  }
@@ -206,21 +211,27 @@ async function setAccess(
206
211
  const permissionPromises: Promise<any>[] = [];
207
212
 
208
213
  if (!_.isEmpty(grantPermissions)) {
209
- this.log.debug(`Granting ${util.pluralize('permission', grantPermissions.length, false)} for ${bundleId}: ${grantPermissions}`);
214
+ this.log.debug(
215
+ `Granting ${util.pluralize('permission', grantPermissions.length, false)} for ${bundleId}: ${grantPermissions}`,
216
+ );
210
217
  for (const action of grantPermissions) {
211
218
  permissionPromises.push(this.simctl.grantPermission(bundleId, action));
212
219
  }
213
220
  }
214
221
 
215
222
  if (!_.isEmpty(revokePermissions)) {
216
- this.log.debug(`Revoking ${util.pluralize('permission', revokePermissions.length, false)} for ${bundleId}: ${revokePermissions}`);
223
+ this.log.debug(
224
+ `Revoking ${util.pluralize('permission', revokePermissions.length, false)} for ${bundleId}: ${revokePermissions}`,
225
+ );
217
226
  for (const action of revokePermissions) {
218
227
  permissionPromises.push(this.simctl.revokePermission(bundleId, action));
219
228
  }
220
229
  }
221
230
 
222
231
  if (!_.isEmpty(resetPermissions)) {
223
- this.log.debug(`Resetting ${util.pluralize('permission', resetPermissions.length, false)} for ${bundleId}: ${resetPermissions}`);
232
+ this.log.debug(
233
+ `Resetting ${util.pluralize('permission', resetPermissions.length, false)} for ${bundleId}: ${resetPermissions}`,
234
+ );
224
235
  for (const action of resetPermissions) {
225
236
  permissionPromises.push(this.simctl.resetPermission(bundleId, action));
226
237
  }
@@ -231,26 +242,33 @@ async function setAccess(
231
242
  }
232
243
 
233
244
  if (!_.isEmpty(wixPermissions)) {
234
- this.log.debug(`Setting permissions for ${bundleId} wit ${WIX_SIM_UTILS} as ${JSON.stringify(wixPermissions)}`);
245
+ this.log.debug(
246
+ `Setting permissions for ${bundleId} wit ${WIX_SIM_UTILS} as ${JSON.stringify(wixPermissions)}`,
247
+ );
235
248
  const permissionsArg = _.toPairs(wixPermissions)
236
249
  .map((x) => `${x[0]}=${formatStatus(x[1])}`)
237
250
  .join(',');
238
- const execWixFn = async () => await execWix.bind(this)([
239
- '--byId', this.udid,
240
- '--bundle', bundleId,
241
- '--setPermissions', permissionsArg,
242
- ]);
251
+ const execWixFn = async () =>
252
+ await execWix.bind(this)([
253
+ '--byId',
254
+ this.udid,
255
+ '--bundle',
256
+ bundleId,
257
+ '--setPermissions',
258
+ permissionsArg,
259
+ ]);
243
260
  const shouldWaitForSystemReadiness = !_.isEmpty(
244
- _.intersection(SERVICES_NEED_SPRINGBOARD_RESTART, _.keys(wixPermissions))
261
+ _.intersection(SERVICES_NEED_SPRINGBOARD_RESTART, _.keys(wixPermissions)),
245
262
  );
246
263
  if (shouldWaitForSystemReadiness) {
247
264
  const [didTimeout] = await runAndWaitForSystemReadiness.bind(this)(
248
- execWixFn, SYSTEM_SERVICE_RESTART_TIMEOUT_MS
265
+ execWixFn,
266
+ SYSTEM_SERVICE_RESTART_TIMEOUT_MS,
249
267
  );
250
268
  if (didTimeout) {
251
269
  this.log.warn(
252
270
  `The required system services did not restart after ` +
253
- `${SYSTEM_SERVICE_RESTART_TIMEOUT_MS}ms timeout. This might lead to unexpected consequences later.`
271
+ `${SYSTEM_SERVICE_RESTART_TIMEOUT_MS}ms timeout. This might lead to unexpected consequences later.`,
254
272
  );
255
273
  }
256
274
  } else {
@@ -270,16 +288,27 @@ async function setAccess(
270
288
  * @param timeoutMs Timeout in milliseconds
271
289
  * @returns Promise that resolves to a tuple of [didTimeout, result]
272
290
  */
273
- async function runAndWaitForSystemReadiness<T>(this: CoreSimulator, fn: () => Promise<T>, timeoutMs: number): Promise<[boolean, T]> {
274
- const waitForNewPid = async (initialPid: number | undefined, bundleId: string, timeoutMs: number) => {
275
- await waitForCondition(async () => {
276
- try {
277
- const pid = (await this.ps()).find(({name}) => bundleId === name)?.pid;
278
- return _.isInteger(pid) && initialPid !== pid;
279
- } catch {
280
- return false;
281
- }
282
- }, {waitMs: timeoutMs, intervalMs: 500});
291
+ async function runAndWaitForSystemReadiness<T>(
292
+ this: CoreSimulator,
293
+ fn: () => Promise<T>,
294
+ timeoutMs: number,
295
+ ): Promise<[boolean, T]> {
296
+ const waitForNewPid = async (
297
+ initialPid: number | undefined,
298
+ bundleId: string,
299
+ timeoutMs: number,
300
+ ) => {
301
+ await waitForCondition(
302
+ async () => {
303
+ try {
304
+ const pid = (await this.ps()).find(({name}) => bundleId === name)?.pid;
305
+ return _.isInteger(pid) && initialPid !== pid;
306
+ } catch {
307
+ return false;
308
+ }
309
+ },
310
+ {waitMs: timeoutMs, intervalMs: 500},
311
+ );
283
312
  };
284
313
 
285
314
  let initialProcesses: any[] = [];
@@ -288,7 +317,8 @@ async function runAndWaitForSystemReadiness<T>(this: CoreSimulator, fn: () => Pr
288
317
  } catch {}
289
318
 
290
319
  const [initialSpringboardPid, initialSpotlightPid] = [
291
- SPRINGBOARD_BUNDLE_ID, SPOTLIGHT_BUNDLE_ID
320
+ SPRINGBOARD_BUNDLE_ID,
321
+ SPOTLIGHT_BUNDLE_ID,
292
322
  ].map((bundleId) => initialProcesses.find(({name}) => bundleId === name)?.pid);
293
323
 
294
324
  const result = await fn();
@@ -325,12 +355,17 @@ async function runAndWaitForSystemReadiness<T>(this: CoreSimulator, fn: () => Pr
325
355
  * @returns The current status: yes/no/unset/limited
326
356
  * @throws {Error} If there was an error while retrieving permissions.
327
357
  */
328
- async function getAccess(this: CoreSimulatorWithAppPermissions, bundleId: string, serviceName: string): Promise<string> {
358
+ async function getAccess(
359
+ this: CoreSimulatorWithAppPermissions,
360
+ bundleId: string,
361
+ serviceName: string,
362
+ ): Promise<string> {
329
363
  const internalServiceName = toInternalServiceName(serviceName);
330
364
  const dbPath = path.resolve(this.getDir(), 'Library', 'TCC', 'TCC.db');
331
365
  const getAccessStatus = async (statusPairs: [string, string][], statusKey: string) => {
332
366
  for (const [statusValue, status] of statusPairs) {
333
- const sql = `SELECT count(*) FROM 'access' ` +
367
+ const sql =
368
+ `SELECT count(*) FROM 'access' ` +
334
369
  `WHERE client='${bundleId}' AND ${statusKey}=${statusValue} AND service='${internalServiceName}'`;
335
370
  const count = await execSQLiteQuery.bind(this)(dbPath, sql);
336
371
  if (parseInt(count.split('=')[1], 10) > 0) {
@@ -345,14 +380,20 @@ async function getAccess(this: CoreSimulatorWithAppPermissions, bundleId: string
345
380
  try {
346
381
  // iOS 14+
347
382
  return await getAccessStatus(
348
- [['0', STATUS.NO], ['2', STATUS.YES], ['3', STATUS.LIMITED]],
349
- 'auth_value'
383
+ [
384
+ ['0', STATUS.NO],
385
+ ['2', STATUS.YES],
386
+ ['3', STATUS.LIMITED],
387
+ ],
388
+ 'auth_value',
350
389
  );
351
390
  } catch {
352
391
  return await getAccessStatus(
353
- [['0', STATUS.NO], ['1', STATUS.YES]],
354
- 'allowed'
392
+ [
393
+ ['0', STATUS.NO],
394
+ ['1', STATUS.YES],
395
+ ],
396
+ 'allowed',
355
397
  );
356
398
  }
357
399
  }
358
-
@@ -1,14 +1,22 @@
1
1
  import _ from 'lodash';
2
2
  import path from 'node:path';
3
- import { fs, timing } from '@appium/support';
3
+ import {fs, timing} from '@appium/support';
4
4
  import B from 'bluebird';
5
- import { MOBILE_SAFARI_BUNDLE_ID, SAFARI_STARTUP_TIMEOUT_MS } from '../utils';
6
- import { waitForCondition } from 'asyncbox';
7
- import { exec } from 'teen_process';
8
- import type { CoreSimulator, InteractsWithSafariBrowser, InteractsWithApps, HasSettings } from '../types';
9
- import type { StringRecord } from '@appium/types';
5
+ import {MOBILE_SAFARI_BUNDLE_ID, SAFARI_STARTUP_TIMEOUT_MS} from '../utils';
6
+ import {waitForCondition} from 'asyncbox';
7
+ import {exec} from 'teen_process';
8
+ import type {
9
+ CoreSimulator,
10
+ InteractsWithSafariBrowser,
11
+ InteractsWithApps,
12
+ HasSettings,
13
+ } from '../types';
14
+ import type {StringRecord} from '@appium/types';
10
15
 
11
- type CoreSimulatorWithSafariBrowser = CoreSimulator & InteractsWithSafariBrowser & InteractsWithApps & HasSettings;
16
+ type CoreSimulatorWithSafariBrowser = CoreSimulator &
17
+ InteractsWithSafariBrowser &
18
+ InteractsWithApps &
19
+ HasSettings;
12
20
 
13
21
  // The root of all these files is located under Safari data container root
14
22
  // in 'Library' subfolder
@@ -30,39 +38,48 @@ const DATA_FILES: string[][] = [
30
38
  * @param url URL to open
31
39
  */
32
40
  export async function openUrl(this: CoreSimulatorWithSafariBrowser, url: string): Promise<void> {
33
- if (!await this.isRunning()) {
41
+ if (!(await this.isRunning())) {
34
42
  throw new Error(`Tried to open '${url}', but Simulator is not in Booted state`);
35
43
  }
36
44
  const timer = new timing.Timer().start();
37
45
  await this.simctl.openUrl(url);
38
46
  let psError: Error | undefined | null;
39
47
  try {
40
- await waitForCondition(async () => {
41
- let procList: any[] = [];
42
- try {
43
- procList = await this.ps();
44
- psError = null;
45
- } catch (e: any) {
46
- this.log.debug(e.message);
47
- psError = e;
48
- }
49
- return procList.some(({name}) => name === MOBILE_SAFARI_BUNDLE_ID);
50
- }, {
51
- waitMs: SAFARI_STARTUP_TIMEOUT_MS,
52
- intervalMs: 500,
53
- });
48
+ await waitForCondition(
49
+ async () => {
50
+ let procList: any[] = [];
51
+ try {
52
+ procList = await this.ps();
53
+ psError = null;
54
+ } catch (e: any) {
55
+ this.log.debug(e.message);
56
+ psError = e;
57
+ }
58
+ return procList.some(({name}) => name === MOBILE_SAFARI_BUNDLE_ID);
59
+ },
60
+ {
61
+ waitMs: SAFARI_STARTUP_TIMEOUT_MS,
62
+ intervalMs: 500,
63
+ },
64
+ );
54
65
  } catch {
55
66
  const secondsElapsed = timer.getDuration().asSeconds;
56
67
  if (psError) {
57
- this.log.warn(`Mobile Safari process existence cannot be verified after ${secondsElapsed.toFixed(3)}s. ` +
58
- `Original error: ${psError.message}`);
68
+ this.log.warn(
69
+ `Mobile Safari process existence cannot be verified after ${secondsElapsed.toFixed(3)}s. ` +
70
+ `Original error: ${psError.message}`,
71
+ );
59
72
  this.log.warn('Continuing anyway');
60
73
  } else {
61
- throw new Error(`Mobile Safari cannot open '${url}' after ${secondsElapsed.toFixed(3)}s. ` +
62
- `Its process ${MOBILE_SAFARI_BUNDLE_ID} does not exist in the list of Simulator processes`);
74
+ throw new Error(
75
+ `Mobile Safari cannot open '${url}' after ${secondsElapsed.toFixed(3)}s. ` +
76
+ `Its process ${MOBILE_SAFARI_BUNDLE_ID} does not exist in the list of Simulator processes`,
77
+ );
63
78
  }
64
79
  }
65
- this.log.debug(`Safari successfully opened '${url}' in ${timer.getDuration().asSeconds.toFixed(3)}s`);
80
+ this.log.debug(
81
+ `Safari successfully opened '${url}' in ${timer.getDuration().asSeconds.toFixed(3)}s`,
82
+ );
66
83
  }
67
84
 
68
85
  /**
@@ -71,7 +88,10 @@ export async function openUrl(this: CoreSimulatorWithSafariBrowser, url: string)
71
88
  *
72
89
  * @param keepPrefs Whether to keep Safari preferences from being deleted.
73
90
  */
74
- export async function scrubSafari(this: CoreSimulatorWithSafariBrowser, keepPrefs: boolean = true): Promise<void> {
91
+ export async function scrubSafari(
92
+ this: CoreSimulatorWithSafariBrowser,
93
+ keepPrefs: boolean = true,
94
+ ): Promise<void> {
75
95
  try {
76
96
  await this.terminateApp(MOBILE_SAFARI_BUNDLE_ID);
77
97
  } catch {}
@@ -102,20 +122,30 @@ export async function scrubSafari(this: CoreSimulatorWithSafariBrowser, keepPref
102
122
  * to print the plist content to the Terminal.
103
123
  * @returns Promise that resolves to true if settings were updated
104
124
  */
105
- export async function updateSafariSettings(this: CoreSimulatorWithSafariBrowser, updates: StringRecord): Promise<boolean> {
125
+ export async function updateSafariSettings(
126
+ this: CoreSimulatorWithSafariBrowser,
127
+ updates: StringRecord,
128
+ ): Promise<boolean> {
106
129
  if (_.isEmpty(updates)) {
107
130
  return false;
108
131
  }
109
132
 
110
133
  const containerRoot = await this.simctl.getAppContainer(MOBILE_SAFARI_BUNDLE_ID, 'data');
111
- const plistPath = path.join(containerRoot, 'Library', 'Preferences', 'com.apple.mobilesafari.plist');
134
+ const plistPath = path.join(
135
+ containerRoot,
136
+ 'Library',
137
+ 'Preferences',
138
+ 'com.apple.mobilesafari.plist',
139
+ );
112
140
  return await this.updateSettings(plistPath, updates);
113
141
  }
114
142
 
115
143
  /**
116
144
  * @returns Promise that resolves to the Web Inspector socket path or null
117
145
  */
118
- export async function getWebInspectorSocket(this: CoreSimulatorWithSafariBrowser): Promise<string | null> {
146
+ export async function getWebInspectorSocket(
147
+ this: CoreSimulatorWithSafariBrowser,
148
+ ): Promise<string | null> {
119
149
  if (this._webInspectorSocket) {
120
150
  return this._webInspectorSocket;
121
151
  }
@@ -144,4 +174,3 @@ export async function getWebInspectorSocket(this: CoreSimulatorWithSafariBrowser
144
174
  this._webInspectorSocket = socketPath;
145
175
  return socketPath;
146
176
  }
147
-