Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const firefoxOptions = new firefox.Options();
// Firefox 65+ supports logging console output to stdout
firefoxOptions.set('moz:firefoxOptions', {
prefs: { 'devtools.console.stdout.content': true },
});
if (headlessBrowser === '1') {
// See: https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Headless_mode
firefoxOptions.headless();
}
// Windows issue with stout socket https://github.com/elastic/kibana/issues/52053
if (process.platform === 'win32') {
const session = await new Builder()
.forBrowser(browserType)
.setFirefoxOptions(firefoxOptions)
.setFirefoxService(new firefox.ServiceBuilder(geckoDriver.path))
.build();
return {
session,
consoleLog$: Rx.EMPTY,
};
}
const { input, chunk$, cleanup } = await createStdoutSocket();
lifecycle.on('cleanup', cleanup);
const session = await new Builder()
.forBrowser(browserType)
.setFirefoxOptions(firefoxOptions)
.setFirefoxService(
new firefox.ServiceBuilder(geckoDriver.path).setStdio(['ignore', input, 'ignore'])
)
module.exports = {
src_folders: ['test/e2e/specs'],
output_folder: 'test/e2e/reports',
custom_commands_path: ['node_modules/nightwatch-helpers/commands'],
custom_assertions_path: ['node_modules/nightwatch-helpers/assertions'],
// set to true when testing on multiple browsers (-e chrome,firefox) to display tests as they pass instead of waiting for everything to be finished
live_output: false,
selenium: {
start_process: true,
server_path: require('selenium-server').path,
host: '127.0.0.1',
port: 4444,
cli_args: {
'webdriver.chrome.driver': require('chromedriver').path,
'webdriver.gecko.driver': require('geckodriver').path
}
},
test_settings: {
default: {
selenium_port: 4444,
selenium_host: 'localhost',
silent: true,
screenshots: {
enabled: true,
on_failure: true,
on_error: false,
path: 'test/e2e/screenshots'
},
desiredCapabilities: {
browserName: 'chrome',
src_folders: [`${projectRoot}/test/e2e/`],
output_folder: `${projectRoot}/reports/e2e/${utils.reportsDir}/`,
custom_commands_path: '',
custom_assrtions_path: '',
page_objects_path: 'test/e2e/pages',
globals_path: 'config/nightwatch/globals.js',
selenium: {
start_process: false,
server_path: './node_modules/selenium-standalone/.selenium/selenium-server/2.53.1-server.jar',
log_path: `${projectRoot}/reports/e2e/`,
host: '127.0.0.1',
port: 4444,
silent: true,
cli_args: {
'webdriver.chrome.driver': require('chromedriver').path,
'webdriver.gecko.driver': require('geckodriver').path
}
},
// 'test_workers': {'enabled': true, 'workers': 'auto'},
test_settings: {
default: {
launch_url: 'http://localhost',
selenium_port: process.env.CIRCLE_ENV ? 80 : 4444,
selenium_host: process.env.CIRCLE_ENV ? 'ondemand.saucelabs.com' : 'localhost',
silent: true,
screenshots: {
enabled: true,
path: projectRoot + `/reports/e2e/${utils.reportsDir}/screenshots`,
on_failure: true,
on_error: true
},
globals: {
},
chrome: {
webdriver: {
server_path: chromedriver.path,
cli_args: ['--port=4444']
},
desiredCapabilities: {
browserName: 'chrome',
'goog:chromeOptions': {
w3c: false
}
}
},
firefox: {
webdriver: {
server_path: geckodriver.path,
cli_args: ['--port', '4444', '--log', 'debug']
},
desiredCapabilities: {
browserName: 'firefox',
marionette: true
}
}
}
};
server_path: require('chromedriver').path,
log_path: './e2e_tests/log'
}
},
firefox: {
desiredCapabilities : {
browserName : 'firefox',
acceptInsecureCerts: true,
acceptSslCerts : true,
ignoreProtectedModeSettings: true,
unexpectedAlertBehaviour: 'accept'
},
webdriver: {
start_process: true,
port: 4444,
server_path: require('geckodriver').path,
log_path: './e2e_tests/log'
}
}
}
};
webdriver: {
server_path: chromedriver.path,
cli_args: ['--port=4444']
},
desiredCapabilities: {
browserName: 'chrome',
javascriptEnabled: true,
acceptSslCerts: true,
chromeOptions: {
args: ['disable-gpu']
}
}
},
firefox: {
webdriver: {
server_path: geckodriver.path,
cli_args: ['--port', '4444', '--log', 'debug']
},
desiredCapabilities: {
browserName: 'firefox',
javascriptEnabled: true,
acceptSslCerts: true,
marionette: true
}
}
}
};
const chromeDriver = require('chromedriver');
const geckoDriver = require('geckodriver');
const ieDriver = require('iedriver');
const edgeDriver = require('edgedriver');
module.exports = {
custom_assertions_path: 'custom-assertions',
test_settings: {
default: {
selenium: {
start_process: true,
server_path: seleniumServer.path,
port: 4444,
cli_args: {
'webdriver.chrome.driver': chromeDriver.path,
'webdriver.gecko.driver': geckoDriver.path,
'webdriver.ie.driver': ieDriver.path,
'webdriver.edge.driver': edgeDriver.path
}
}
},
chromeHeadless: {
desiredCapabilities: {
browserName: 'chrome',
'goog:chromeOptions': {
w3c: false,
args: ['--headless']
}
}
},
chrome: {
desiredCapabilities: {
module.exports = {
test_settings: {
default: {
selenium: process.env.containerized
? {
port: 4444,
host: 'selenium-hub'
}
: {
port: 4444,
start_process: true,
server_path: seleniumServer.path,
cli_args: {
'webdriver.chrome.driver': chromeDriver.path,
'webdriver.gecko.driver': geckoDriver.path,
'webdriver.ie.driver': ieDriver.path,
'webdriver.edge.driver': edgeDriver.path
}
}
},
chromeHeadless: {
desiredCapabilities: {
browserName: 'chrome',
'goog:chromeOptions': {
w3c: false,
args: ['--headless']
}
}
},
chrome: {
desiredCapabilities: {
export const launchFirefox = async (connectionUrl, sessionId = 'default') => {
const driver = await new Builder()
.forBrowser('firefox')
.setFirefoxOptions(new firefox.Options()
.headless())
.setFirefoxService(new firefox.ServiceBuilder(geckodriver.path))
.build();
const command = new Command('install addon')
.setParameter('path', extension)
.setParameter('temporary', true);
await driver.execute(command);
const fileUrl = constructFileUrl(connectionUrl, sessionId);
await driver.get(fileUrl);
return driver;
};
const chromedriver = require('chromedriver');
const geckodriver = require('geckodriver');
const files = './e2e/features';
module.exports = {
output_folder: 'e2e/reports',
globals_path: 'e2e/globals.js',
custom_assertions_path: ['e2e/custom-assertions'],
src_folders: files,
selenium: {
start_process: true,
server_path: seleniumServer.path,
port: 4444,
check_process_delay: 5000,
cli_args: {
'webdriver.chrome.driver': chromedriver.path,
'webdriver.gecko.driver': geckodriver.path,
'webdriver.firefox.profile': 'nightwatch',
'webdriver.gecko.profile': 'nightwatch'
}
},
test_settings: {
default: {
launch_url: 'http://localhost',
selenium_port: 4444,
selenium_host: 'localhost',
marionette: true
},
chrome: {
desiredCapabilities: {
browserName: 'chrome',
'goog:chromeOptions': {
w3c: false,