Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'use strict';
var gulp = require('gulp');
var path = require('path');
var SeleniumConfig = require('webdriver-manager/built/lib/config').Config;
var SeleniumStandAlone = require('webdriver-manager/built/lib/binaries/stand_alone').StandAlone;
var $ = require('gulp-load-plugins')({
pattern: ['gulp-*', 'browser-sync', 'run-sequence']
});
gulp.task('scripts-tests', function () {
return gulp.src(['test/**/*.js'])
.pipe($.jshint())
.pipe($.jshint.reporter('jshint-stylish'))
.pipe($.jshint.reporter('fail'))
.pipe($.size());
});
// Downloads the selenium webdriver
gulp.task('webdriver-update', function (done) {
'use strict';
var path = require('path');
var SeleniumConfig = require('webdriver-manager/built/lib/config').Config;
var SeleniumChrome = require('webdriver-manager/built/lib/binaries/chrome_driver').ChromeDriver;
var seleniumChrome = new SeleniumChrome();
seleniumChrome.versionCustom = '2.30';
// An example configuration file.
exports.config = {
baseUrl: 'http://localhost:9000/',
chromeDriver: path.resolve(SeleniumConfig.getSeleniumDir(), seleniumChrome.executableFilename()),
// Capabilities to be passed to the webdriver instance.
capabilities: {
browserName: 'chrome',
chromeOptions: {
args: ['--headless', '--disable-gpu', '--window-size=1280,800']
}
},
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/*
* This is an implementation of the Direct Driver Provider.
* It is responsible for setting up the account object, tearing
* it down, and setting up the driver correctly.
*/
const fs = require("fs");
const path = require("path");
const q = require("q");
const selenium_webdriver_1 = require("selenium-webdriver");
const chrome_1 = require("selenium-webdriver/chrome");
const exitCodes_1 = require("../exitCodes");
const logger_1 = require("../logger");
const driverProvider_1 = require("./driverProvider");
const SeleniumConfig = require('webdriver-manager/built/lib/config').Config;
let logger = new logger_1.Logger('direct');
class Direct extends driverProvider_1.DriverProvider {
constructor(config) {
super(config);
}
/**
* Configure and launch (if applicable) the object's environment.
* @return {q.promise} A promise which will resolve when the environment is
* ready to test.
*/
setupDriverEnv() {
switch (this.config_.capabilities.browserName) {
case 'chrome':
logger.info('Using ChromeDriver directly...');
break;
case 'firefox':
Object.defineProperty(exports, "__esModule", { value: true });
/*
* This is an implementation of the Local Driver Provider.
* It is responsible for setting up the account object, tearing
* it down, and setting up the driver correctly.
*
* TODO - it would be nice to do this in the launcher phase,
* so that we only start the local selenium once per entire launch.
*/
const fs = require("fs");
const path = require("path");
const q = require("q");
const exitCodes_1 = require("../exitCodes");
const logger_1 = require("../logger");
const driverProvider_1 = require("./driverProvider");
const SeleniumConfig = require('webdriver-manager/built/lib/config').Config;
const remote = require('selenium-webdriver/remote');
let logger = new logger_1.Logger('local');
class Local extends driverProvider_1.DriverProvider {
constructor(config) {
super(config);
this.server_ = null;
}
/**
* Helper to locate the default jar path if none is provided by the user.
* @private
*/
addDefaultBinaryLocs_() {
if (!this.config_.seleniumServerJar) {
logger.debug('Attempting to find the SeleniumServerJar in the default ' +
'location used by webdriver-manager');
try {