mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2025-03-25 20:29:45 -04:00
Make selenium-helpers.js build driver in headless mode
This commit is contained in:
parent
55f72e7487
commit
f15a8bd714
2 changed files with 24 additions and 7 deletions
test/integration
|
@ -1,8 +1,24 @@
|
|||
var webdriver = require('selenium-webdriver');
|
||||
|
||||
const driver = new webdriver.Builder()
|
||||
.forBrowser('chrome')
|
||||
.build();
|
||||
const headless = process.env.SMOKE_HEADLESS || false;
|
||||
|
||||
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;
|
||||
|
||||
|
@ -70,5 +86,6 @@ module.exports = {
|
|||
clickButton,
|
||||
findByCss,
|
||||
clickCss,
|
||||
getLogs
|
||||
getLogs,
|
||||
getDriver
|
||||
};
|
||||
|
|
|
@ -12,9 +12,9 @@ var seleniumWebdriver = require('selenium-webdriver');
|
|||
// Selenium's promise driver will be deprecated, so we should not rely on it
|
||||
seleniumWebdriver.SELENIUM_PROMISE_MANAGER = 0;
|
||||
|
||||
// chrome driver
|
||||
var driver = new seleniumWebdriver.Builder().withCapabilities(seleniumWebdriver.Capabilities.chrome())
|
||||
.build();
|
||||
const {
|
||||
driver
|
||||
} = require('../selenium-helpers.js');
|
||||
|
||||
var rootUrl = process.env.ROOT_URL || 'https://scratch.ly';
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue