How to use the appium-ios-simulator.installSSLCert function in appium-ios-simulator

To help you get started, we’ve selected a few appium-ios-simulator examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github appium / appium-xcuitest-driver / lib / driver.js View on Github external
// 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);
          await installSSLCert(this.opts.customSSLCert, this.opts.udid);
          log.info(`Restarting Simulator so that SSL certificate installation takes effect`);
          await this.startSim();
          this.logEvent('customCertInstalled');
        }
      }
      if (this.opts.launchWithIDB && this.isSimulator()) {
        try {
          const idb = new IDB({udid});
          await idb.connect();
          this.opts.device.idb = idb;
        } catch (e) {
          log.info(`idb will not be used for Simulator interaction. Original error: ${e.message}`);
        }
      }

      this.logEvent('simStarted');
github appium / appium-ios-driver / lib / driver.js View on Github external
await this.createInstruments();

    {
      // previously setDeviceInfo()
      this.shouldPrelaunchSimulator = utils.shouldPrelaunchSimulator(this.opts, this.iosSdkVersion);
      let dString = await getAdjustedDeviceName(this.opts);
      if (this.caps.app) {
        await utils.setDeviceTypeInInfoPlist(this.opts.app, dString);
      }
    }

    await runSimulatorReset(this.sim, this.opts, this.keepAppToRetainPrefs);

    if (this.caps.customSSLCert && !this.isRealDevice()) {
      await installSSLCert(this.caps.customSSLCert, this.sim.udid);
    }

    if (this.opts.enableAsyncExecuteFromHttps && !this.isRealDevice()) {
      // await this.sim.shutdown();
      await this.startHttpsAsyncServer();
    }

    await isolateSimulatorDevice(this.sim, this.opts);
    this.localConfig = await setLocaleAndPreferences(this.sim, this.opts, this.isSafari(), endSimulator);
    await this.setUpLogCapture();
    await this.prelaunchSimulator();
    await this.startInstruments();
    await this.onInstrumentsLaunch();
    await this.configureBootstrap();
    await this.setBundleId();
    await this.setInitialOrientation();
github appium / appium-ios-driver / lib / commands / execute.js View on Github external
let address = this.opts.callbackAddress || this.opts.address;
  let port = this.opts.callbackPort || this.opts.port;
  let {sslServer, pemCertificate, httpsPort} = await startHttpsServer(port, address);
  this.opts.sslServer = sslServer;
  this.opts.httpsServerCertificate = pemCertificate;
  this.opts.httpsCallbackPort = httpsPort;
  this.opts.httpsCallbackAddress = 'localhost';
  let udid;
  if (this.sim) {
    // ios driver
    udid = this.sim.udid;
  } else {
    // xcuitest driver
    udid = this.opts.udid;
  }
  await installSSLCert(this.opts.httpsServerCertificate, udid);
};