Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (this.isSimulator()) {
if (this.opts.shutdownOtherSimulators) {
this.ensureFeatureEnabled(SHUTDOWN_OTHER_FEAT_NAME);
await shutdownOtherSimulators(this.opts.device);
}
// this should be done before the simulator is started
// if it is already running, this cap won't work, which is documented
if (this.isSafari() && this.opts.safariGlobalPreferences) {
if (await this.opts.device.updateSafariGlobalSettings(this.opts.safariGlobalPreferences)) {
log.debug(`Safari global preferences updated`);
}
}
this.localConfig = await iosSettings.setLocaleAndPreferences(this.opts.device, this.opts, this.isSafari(), async (sim) => {
await shutdownSimulator(sim);
// we don't know if there needs to be changes a priori, so change first.
// sometimes the shutdown process changes the settings, so reset them,
// knowing that the sim is already shut
await iosSettings.setLocaleAndPreferences(sim, this.opts, this.isSafari());
});
await this.startSim();
if (this.opts.customSSLCert) {
if (await hasSSLCert(this.opts.customSSLCert, this.opts.udid)) {
log.info(`SSL cert '${_.truncate(this.opts.customSSLCert, {length: 20})}' already installed`);
} else {
log.info(`Installing ssl cert '${_.truncate(this.opts.customSSLCert, {length: 20})}'`);
await shutdownSimulator(this.opts.device);
this.localConfig = await iosSettings.setLocaleAndPreferences(this.opts.device, this.opts, this.isSafari(), async (sim) => {
await shutdownSimulator(sim);
// we don't know if there needs to be changes a priori, so change first.
// sometimes the shutdown process changes the settings, so reset them,
// knowing that the sim is already shut
await iosSettings.setLocaleAndPreferences(sim, this.opts, this.isSafari());
});