Commit f15a8bd7 authored by BryceLTaylor's avatar BryceLTaylor

Make selenium-helpers.js build driver in headless mode

parent 55f72e74
var webdriver = require('selenium-webdriver'); var webdriver = require('selenium-webdriver');
const driver = new webdriver.Builder() const headless = process.env.SMOKE_HEADLESS || false;
.forBrowser('chrome')
.build(); const getDriver = function () {
const chromeCapabilities = webdriver.Capabilities.chrome();
let args = [];
if (headless) {
args.push('--headless');
args.push('window-size=1024,1680');
args.push('--no-sandbox');
}
chromeCapabilities.set('chromeOptions', {args});
const newDriver = new webdriver.Builder()
.forBrowser('chrome')
.withCapabilities(chromeCapabilities)
.build();
return newDriver;
};
const driver = getDriver();
const {By, until} = webdriver; const {By, until} = webdriver;
...@@ -70,5 +86,6 @@ module.exports = { ...@@ -70,5 +86,6 @@ module.exports = {
clickButton, clickButton,
findByCss, findByCss,
clickCss, clickCss,
getLogs getLogs,
getDriver
}; };
...@@ -12,9 +12,9 @@ var seleniumWebdriver = require('selenium-webdriver'); ...@@ -12,9 +12,9 @@ var seleniumWebdriver = require('selenium-webdriver');
// Selenium's promise driver will be deprecated, so we should not rely on it // Selenium's promise driver will be deprecated, so we should not rely on it
seleniumWebdriver.SELENIUM_PROMISE_MANAGER = 0; seleniumWebdriver.SELENIUM_PROMISE_MANAGER = 0;
// chrome driver const {
var driver = new seleniumWebdriver.Builder().withCapabilities(seleniumWebdriver.Capabilities.chrome()) driver
.build(); } = require('../selenium-helpers.js');
var rootUrl = process.env.ROOT_URL || 'https://scratch.ly'; var rootUrl = process.env.ROOT_URL || 'https://scratch.ly';
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment