cli/e2e.js
function spawnSelenium(configPath) {

  const config = require(configPath).config;

  return new Promise((resolve, reject) => {
    logger.info('Spawning selenium...');

    // Assumes we're running selenium ourselves, so we should prep it
    if (config.seleniumAddress) {
      logger.info('Installing Selenium...');
      selenium.install({ logger: logger.info }, () => {
        logger.info('Selenium installed. Starting...');
        selenium.start((err, child) => {
          if (err) {
            reject(err);
            return;
          }

          seleniumServer = child;
          logger.info('Selenium server is ready.');
          resolve();
        });
      });

    // Otherwise we need to prep protractor's selenium
    } else {

      logger.info(`Getting webdriver version.`);

      getChromeDriverVersion().then(version => {
        logger.info(`Updating webdriver to version ${version}`);

        const webdriverManagerPath = path.resolve(
          'node_modules',
          '.bin',
          'webdriver-manager'
        );

        const results = spawn.sync(
          webdriverManagerPath,
          [
            'update',
            '--standalone',
            'false',
            '--gecko',
            'false',
            '--versions.chrome',
            version
          ],
          spawnOptions
        );

        if (results.error) {
          reject(results.error);
          return;
        }

        logger.info('Selenium server is ready.');
        resolve();
      });
    }
  });
}
function spawnSelenium(configPath) {

  const config = require(configPath).config;

  return new Promise((resolve, reject) => {
    logger.info('Spawning selenium...');

    // Assumes we're running selenium ourselves, so we should prep it
    if (config.seleniumAddress) {
      logger.info('Installing Selenium...');
      selenium.install({ logger: logger.info }, () => {
        logger.info('Selenium installed. Starting...');
        selenium.start((err, child) => {
          if (err) {
            reject(err);
            return;
          }

          seleniumServer = child;
          logger.info('Selenium server is ready.');
          resolve();
        });
      });

    // Otherwise we need to prep protractor's selenium
    } else {

      logger.info(`Getting webdriver version.`);

      getChromeDriverVersion().then(version => {
        logger.info(`Updating webdriver to version ${version}`);

        const webdriverManagerPath = path.resolve(
          'node_modules',
          '.bin',
          'webdriver-manager'
        );

        const results = spawn.sync(
          webdriverManagerPath,
          [
            'update',
            '--standalone',
            'false',
            '--gecko',
            'false',
            '--versions.chrome',
            version
          ],
          spawnOptions
        );

        if (results.error) {
          reject(results.error);
          return;
        }

        logger.info('Selenium server is ready.');
        resolve();
      });
    }
  });
}
function spawnSelenium ( configPath ) { const config = require ( configPath ) . config ; return new Promise ( ( resolve , reject ) => { logger . info ( 'Spawning selenium...' ) ; // Assumes we're running selenium ourselves, so we should prep it if ( config . seleniumAddress ) { logger . info ( 'Installing Selenium...' ) ; selenium . install ( { logger : logger . info } , ( ) => { logger . info ( 'Selenium installed. Starting...' ) ; selenium . start ( ( err , child ) => { if ( err ) { reject ( err ) ; return ; } seleniumServer = child ; logger . info ( 'Selenium server is ready.' ) ; resolve ( ) ; } ) ; } ) ; // Otherwise we need to prep protractor's selenium } else { logger . info ( ` ` ) ; getChromeDriverVersion ( ) . then ( version => { logger . info ( ` ${ version } ` ) ; const webdriverManagerPath = path . resolve ( 'node_modules' , '.bin' , 'webdriver-manager' ) ; const results = spawn . sync ( webdriverManagerPath , [ 'update' , '--standalone' , 'false' , '--gecko' , 'false' , '--versions.chrome' , version ] , spawnOptions ) ; if ( results . error ) { reject ( results . error ) ; return ; } logger . info ( 'Selenium server is ready.' ) ; resolve ( ) ; } ) ; } } ) ; }
Spawns the selenium server if directConnect is not enabled.
@name spawnSelenium
Spawns the selenium server if directConnect is not enabled .