Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// http://nightwatchjs.org/guide#settings-file
module.exports = {
src_folders: ['test/e2e/test'],
output_folder: 'test/e2e/report',
custom_commands_path: ['node_modules/nightwatch-helpers/commands'],
custom_assertions_path: ['node_modules/nightwatch-helpers/assertions'],
selenium: {
start_process: true,
server_path: 'node_modules/selenium-server/lib/runner/selenium-server-standalone-2.53.1.jar',
host: '127.0.0.1',
port: 4444,
cli_args: {
'webdriver.chrome.driver': require('chromedriver').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'
}
},
module.exports = {
"src_folders": ["test/e2e/specs"],
"output_folder": "test/e2e/reports",
"custom_assertions_path": [
"test/e2e/custom-assertions",
"node_modules/nightwatch-custom-commands-assertions/js/assertions"
],
"custom_commands_path" : "node_modules/nightwatch-custom-commands-assertions/js/commands",
"selenium": {
"start_process": true,
"server_path": "node_modules/selenium-server/lib/runner/selenium-server-standalone-2.53.1.jar",
"host": "127.0.0.1",
"port": 4444,
"cli_args": {
"webdriver.chrome.driver": require('chromedriver').path
}
},
"test_settings": {
"default": {
"selenium_port": 4444,
"selenium_host": "localhost",
"silent": true
},
"chrome": {
"desiredCapabilities": {
"browserName": "chrome",
"javascriptEnabled": true,
"acceptSslCerts": true
}
require('dotenv').config({path: '.env.local'});
module.exports = {
src_folders: ['e2e_tests/tests'],
selenium: {
launch_url: process.env.HOST_TEST,
start_process: true,
server_path: require('selenium-server').path,
cli_args: {
'webdriver.gecko.driver': require('geckodriver').path,
'webdriver.chrome.driver': require('chromedriver').path
},
log_path: './e2e_tests/log'
},
test_settings: {
default: {
launch_url: process.env.HOST_TEST,
screenshots : {
enabled : true,
on_failure : true,
on_error : false,
path : './e2e_tests/screenshots'
},
output_folder: './e2e_tests/output'
},
chrome: {
desiredCapabilities : {
var commonSpecRelPath = 'commons/';
var commonSpecPath = rootPath + '/' + commonSpecRelPath;
if(fs.existsSync(commonSpecPath) == false || fs.statSync(commonSpecPath).isDirectory() === false){
commonSpecRelPath = '';
commonSpecPath = rootPath;
}
var dirList = fs.readdirSync(commonSpecPath);
var specLists = [];
dirList.forEach(function(item){
if(/.*\.js$/.test(item)){
specLists.push(commonSpecRelPath + item);
}
});
var wdPort;
if(fs.existsSync(chromedriver.path)){
getFreePort().then(function(port){
wdPort = port;
chromedriver = chromedriver.start(['--url-base=wd/hub', '--port='+wdPort]);
chromedriver.stdout.unpipe(process.stdout)
chromedriver.stderr.unpipe(process.stderr)
});
}
else{
console.log('chromedriver bin file no existed, please reinstall uirecorder again.'.red);
process.exit(1);
}
var questions = [];
if(cmdFilename){
console.log('? '.green+__('input_spec_name').white.bold + ' ' + cmdFilename.cyan);
}
function webdriverServerSettings () {
if (useSelenium) {
return {
selenium: {
start_process: true,
host: '127.0.0.1',
port: 4444,
server_path: require('selenium-server').path,
cli_args: {
'webdriver.chrome.driver': chromedriver.path,
'webdriver.gecko.driver': geckodriver.path
}
}
}
}
return {
webdriver: {
start_process: true,
port: 9515,
server_path: chromedriver.path
}
}
}
path: path.join(__dirname, 'reports/screenshots'),
on_failure: true,
on_error: true,
},
desiredCapabilities: {
unexpectedAlertBehaviour: 'accept',
browserName: 'chrome',
javascriptEnabled: true,
acceptSslCerts: true,
chromeOptions: {
args: ['headless', 'verbose', 'window-size=1280,1480'],
},
},
selenium: {
cli_args: {
'webdriver.chrome.driver': chromedriver.path,
},
},
},
},
};
host: '127.0.0.1',
port: 4444,
server_path: require('selenium-server').path,
cli_args: {
'webdriver.chrome.driver': chromedriver.path,
'webdriver.gecko.driver': geckodriver.path
}
}
}
}
return {
webdriver: {
start_process: true,
port: 9515,
server_path: chromedriver.path
}
}
}
output_folder: 'reports',
featureFiles: './features',
stepDefinitions: './features/step_definitions',
closeSession: 'afterFeature',
custom_commands_path: '',
custom_assertions_path: '',
page_objects_path: './pages',
globals_path: './globals.js',
selenium: {
start_process: true,
server_path: seleniumServer.path,
log_path: './reports',
host: '127.0.0.1',
port: 4444,
cli_args: {
'webdriver.chromedriver': chromedriver.path
}
},
test_settings: {
default: {
launch_url: 'http://localhost',
selenium_port: 4444,
selenium_host: 'localhost',
silent: false,
desiredCapabilities: {
browserName: 'chrome',
javascriptEnabled: true,
acceptSslCerts: true
}
}
}
}
export const launchChrome = async (connectionUrl, sessionId = 'default') => {
const driver = await new Builder()
.forBrowser('chrome')
.setChromeOptions(new chrome.Options()
.addArguments([`--load-extension=${extension}`]))
.setChromeService(new chrome.ServiceBuilder(chromedriver.path))
.build();
const fileUrl = constructFileUrl(connectionUrl, sessionId);
await driver.get(fileUrl);
return driver;
};