return highland.wrapCallback(function(cb) {
   selenium.start({stdio: 'pipe'}, function(err, seleniumInstance) {
     seleniumServer = seleniumInstance;
     process.env.SELENIUM_PORT = 4444;
     return cb(null, pathway);
   });
 })();
Beispiel #2
0
gulp.task('selenium', ['selenium:fetch'], function(cb) {
  var selenium = require('selenium-standalone');
  var port = process.env.SELENIUM_SERVER_PORT || 4444;
  selenium.start(
    {
      version: process.env.SELENIUM_VERSION || SELENIUM_VERSION,
      dirvers: SELENIUM_DRIVERS,
      seleniumArgs: ['--port', port],
      spawnOptions: {stdio: 'pipe'}
    },
    function(err, child) {
      if (err) throw err;
      child.on('exit', function() {
        if (seleniumProcess) {
          gutil.log(gutil.colors.yellow('Selenium process died unexpectedly. Probably port',
            port, 'is already in use.'));
        }
      });
      ['exit', 'uncaughtException', 'SIGTERM', 'SIGINT'].forEach(function(event) {
        process.on(event, shutdownSelenium);
      });
      seleniumProcess = child;
      cb();
    }
  );
});
gulp.task('selenium-start', function (done) {
    'use strict';
    selenium.start(function (err, child) {
        selenium.child = child;
        done(err);
    });
});
Beispiel #4
0
}, function() {

  selenium.start(function(err, cp) {
    if (err) throw err;


    profile(function (profile) {
      var opts = {
        desiredCapabilities: {
          //loggingPrefs: {"driver": "ALL", "server": "ALL", "browser": "ALL", "client": "ALL"},
          browserName: 'firefox',
          // set a custom profile
          firefox_profile: profile
        }
      };

      // support $FIREFOX_BIN
      if (process.env.FIREFOX_BIN) {
        opts.desiredCapabilities.firefox_binary = process.env.FIREFOX_BIN;
      }

      setTimeout(function () {
          webdriverio
            .remote(opts)
            .init()
            .url('about:accounts')
      }, 3000);
    });

    tailLogs();

  });

});
Beispiel #5
0
selenium.install(function() {
	console.log('Selenium is installed.');
	selenium.start(function() {
		console.log('Selenium is running.');
		server.listen(port, callbackAfterServerListening);
	});
});
 }, function() {
     grunt.log.writeln('Running server');
     selenium.start({
         spawnOptions: {
             stdio: 'inherit'
         },
         drivers: {
             chrome: {
                 // check for more recent versions of chrome driver here:
                 // http://chromedriver.storage.googleapis.com/index.html
                 version: '2.21',
                 arch: process.arch,
                 baseURL: 'http://chromedriver.storage.googleapis.com'
             }
         }
     },
     function(err, child) {
         if (err) {
             grunt.log.writeln('error:' + err);
             return done(err);
         }
         grunt.log.writeln('Server should hopefully be running unless there is an error');
         global['seleniumChildProcesses'] = child;
         grunt.log.writeln(stringify(child));
         done();
     });
 });
Beispiel #7
0
 var start = function(err) {
     gutil.log('Starting Selenium server...');
     selenium.start(function(err, child) {
         gutil.log('Selenium server started');
         selenium.child = child;
         done(err);
     });
 };
Beispiel #8
0
 return Q.promise(function (resolve) {
   var newOptions = xtend({ spawnCb: resolve }, options);
   startSeleniumCb(newOptions, function (err) {
     if (err) {
       reject(err);
     }
   });
 });
Beispiel #9
0
    },function(err){
        seleniumServer.start({},function(err,child){
            self._selenium = child;
            defer.resolve();
        })


    })
Beispiel #10
0
 function startSelenium(cb) {
     grunt.log.writeln('Starting selenium..');
     selenium.start(seleniumConfig, function(error, child) {
         if (error) return cb(error);
         seleniumChildProcess = child;
         cb();
     });
 }
 selenium.install({logger: console.log}, () => {
     selenium.start((err, child) => {
         if (err) {
             return done(err);
         }
         selenium.child = child;
         done();
     });
 });
 selenium.install({ logger: function(msg) { console.log(msg); }}, function(instErr) {
   selenium.start({ spawnOptions: {}, seleniumArgs: arg._ }, function(startErr) {
     if (startErr) {
       console.log(startErr);
     } else {
       run();
     }
   });
 });
Beispiel #13
0
    }, function (err) {
        if (err) return done(err);

        selenium.start(function (err, child) {
            if (err) return done(err);
            selenium.child = child;
            done();
        });
    });
Beispiel #14
0
 selenium.install((err) => {
   if (err) { return done(err); }
   selenium.start((err, child) => {
     if (err) { return done(err); }
     setTimeout(() => {
       selenium.child = child;
       done();
     }, 1000);
   });
 });
Beispiel #15
0
 selenium.install(function(){
     selenium.start(function(err, _server){
         server = _server;
         var Site = require('../helpers/setup-site');
         new Site(function(_site){
             site = _site;
             done();
         });
     });
 });
Beispiel #16
0
 selenium.install(opts, function (err) {
   if (err) {
     console.error('Failed to install selenium');
     process.exit(1);
   }
   selenium.start(opts, function () {
     sauceClient = wd.promiseChainRemote();
     callback();
   });
 });
 function start() {
   selenium.start(config, function(error) {
     if (error) {
       log.forEach(function(line) { wct.emit('log:info', line) });
       return done(error);
     }
     wct.emit('log:info', 'Selenium server running on port', chalk.yellow(port));
     done(null, port);
   });
 }
Beispiel #18
0
 selenium.install({logger: console.log}, function(){
   selenium.start(function(error, child){
     if (error){
       return done(error)
     } else {
       seleniumServer = child;
       done();
     }
   });
 });
		function () {
			selenium.start(function (err, child) {
				if (err) {
					console.log(err);
					process.exit(err);
				}
				seleniumServer = child;
				runMocha();
			});
		});
Beispiel #20
0
 }, function(err) {
     if (err) {
         done(err);
         return;
     }
     gutil.log('Starting Selenium server...');
     selenium.start(function(err, child) {
         gutil.log('Selenium server started');
         selenium.child = child;
         done(err);
     });
 });
Beispiel #21
0
 grunt.registerTask('selenium-start', function() {
     var done = this.async();
     selenium.start(
         settings,
         function(err, chld) {
             process.on('exit', function() {
                 chld.kill();
             });
             done(err);
         }
     );
 });
        return new Promise((resolve, reject) => Selenium.start(this.opts, (err, process) => {
            if (err) {
                return reject(err)
            }

            this.process = process
            if (typeof this.seleniumLogs === 'string') {
                this._redirectLogStream()
            }

            resolve()
        }))
Beispiel #23
0
    }, function (err) {
        if (err) return cb(err);

        selenium.start({
            version: seleniumVersion
        }, function (err, child) {
            if (err) return cb(err);

            seleniumProcess = child;
            cb();
        })
    })
Beispiel #24
0
  self.install(function (error) {
    if (error) {
      log.error('[selenium]', error);
      callback(error);
      return;
    }

    if (!self.seleniumStandaloneOptions.seleniumArgs) {
      self.seleniumStandaloneOptions.seleniumArgs = [];
    }
    self.seleniumStandaloneOptions.seleniumArgs.push('-port', port);

    if (process.env['chimp.log'] === 'verbose' || process.env['chimp.log'] === 'debug') {
      self.options.seleniumDebug = true;
    }

    if (self.options.seleniumDebug) {
      self.seleniumStandaloneOptions.seleniumArgs.push('-debug');
    }

    log.debug('\n[chimp][selenium] hub can be seen at http://localhost:' + port + '/wd/hub');

    selenium.start(self.seleniumStandaloneOptions, function (error, seleniumChild) {

      self.child = seleniumChild;

      if (error) {
        callback(error);
        return;
      }

      if (self.options.seleniumDebug) {
        processHelper.logOutputs('selenium', self.child);
      }

      process.on('exit', function () {
        log.debug('[chimp][selenium] process exit event detected. Stopping process');
        self.stop(function () {
          log.debug('[chimp][selenium] process exit event stop complete');
        });
      });

      self.sessionManager = new SessionManager({
        host: process.env['chimp.host'],
        port: process.env['chimp.port'],
        browser: process.env['chimp.browser'],
        deviceName: process.env['chimp.deviceName']
      });

      callback(null);
    });
  });
 }, function (err) {
     // return if there's an error in selenium
     if (err) return done(err);
     // start seleinium
     selenium.start({spawnOptions: {
       stdio: 'ignore'
     }}, function (err, child) {
         // return if there's an error start selenium
        if (err) return done(err);
        selenium.child = child;
        done();
      });
 });
	var startServer = function (callback) {

		if (tunnel) {

			if (isSauceTunnelRunning) {
				gutil.log('sauce tunnel is already running');
				return callback(null, isSauceTunnelRunning);
			}

			gutil.log('start sauce tunnel');

			/**
			 * start sauce tunnel
			 */
			tunnel.start(function (hasTunnelStarted) {
				// output here means if tunnel was created successfully
				if (hasTunnelStarted === false) {
					callback(new Error('Sauce-Tunnel couldn\'t created successfully'));
				}

				gutil.log('tunnel created successfully');
				isSauceTunnelRunning = true;
				return callback(null, isSauceTunnelRunning);
			});

		} else if (!server && !isSeleniumServerRunning && !options.nospawn) {

			gutil.log('start selenium standalone server');

			/**
			 * starts selenium standalone server if its not running
			 */

			server = selenium.start({seleniumArgs :seleniumOptions}, function (err, child) {
				if (err) {
					return callback(err);
				}

				gutil.log('selenium successfully started');
				seleniumServer = child;
				isSeleniumServerRunning = true;
				return callback(null, true);
			});

		} else {
			gutil.log('standalone server or sauce tunnel is running');
			return callback(null, true);
		}

	};
module.exports = function (options) {

	selenium.start({ stdio: 'pipe' }, function (err, child) {
		if (err) {
			throw new Error(err);
		}
		// Purely selenium server debugging output.
		//child.stderr.on('data', function (data){
		//	console.log(data.toString());
		//});
	});

	return cucumber(options);
};
Beispiel #28
0
	}, function(err) {
		if(!err) {
			selenium.start(function(err, child) {
				if(!err) {
					selenium.app = require('./app');
					selenium.server = child;
					callback();
				} else {
					callback(err);
				}
			});
		} else {
			callback(err);
		}
	});	
Beispiel #29
0
 const result = new Promise((resolve, reject) => {
   const options = {
     ...seleniumInstall.options,
     seleniumArgs: ['-port', port],
   };
   Selenium.start(options, (err, process) => {
     if (err) {
       reject(err);
     } else {
       process.port = port;
       process.url = `http://localhost:${port}/wd/hub`;
       process.capabilities = {};
       resolve(process);
     }
   });
 });
		selenium.install(seleniumOptions, function(err) {
			console.log('Selenium is installed.');
			if(err) {
				console.error(err);
			}
			selenium.start(seleniumOptions, function(err, child) {
				console.log('Selenium is running.');
				if(err) {
					console.error(err);
				}
				//child.kill();
				child.stderr.on('data', function(data){
					console.log(data.toString());
				});
				server.listen(port, callbackAfterServerListening);
			});
		});