Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"ecmaFeatures": {
"jsx": false
},
"project": "./tsconfig.json"
"project": "./tsconfig.nightwatch.json"
},
"env": {
"mocha": true,
Expand Down
124 changes: 89 additions & 35 deletions nightwatch.conf.js → nightwatch.conf.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Autogenerated by Nightwatch
// Refer to the online docs for more details: https://nightwatchjs.org/gettingstarted/configuration/
const Services = {}; loadServices();

//
// Refer to the online docs for more details:
// https://nightwatchjs.org/guide/configuration/nightwatch-configuration-file.html
//
// _ _ _ _ _ _ _
// | \ | |(_) | | | | | | | |
// | \| | _ __ _ | |__ | |_ __ __ __ _ | |_ ___ | |__
Expand All @@ -10,26 +10,35 @@ const Services = {}; loadServices();
// \_| \_/|_| \__, ||_| |_| \__| \_/\_/ \__,_| \__| \___||_| |_|
// __/ |
// |___/
//

module.exports = {
// An array of folders (excluding subfolders) where your tests are located;
// if this is not specified, the test source must be passed as the second argument to the test runner.
src_folders: ['dist/src'],
src_folders: ['src'],

// See https://nightwatchjs.org/guide/working-with-page-objects/
page_objects_path: ['dist/pages'],
// See https://nightwatchjs.org/guide/concepts/page-object-model.html
page_objects_path: ['pages'],

// See https://nightwatchjs.org/guide/extending-nightwatch/#writing-custom-commands
// See https://nightwatchjs.org/guide/extending-nightwatch/adding-custom-commands.html
custom_commands_path: [],

// See https://nightwatchjs.org/guide/extending-nightwatch/#writing-custom-assertions
// See https://nightwatchjs.org/guide/extending-nightwatch/adding-custom-assertions.html
custom_assertions_path: '',

// See https://nightwatchjs.org/guide/#external-globals
// See https://nightwatchjs.org/guide/extending-nightwatch/adding-plugins.html
plugins: [],

// See https://nightwatchjs.org/guide/concepts/test-globals.html#external-test-globals
globals_path: '',

webdriver: {},

test_workers: {
enabled: true,
workers: 'auto'
},

test_settings: {
default: {
disable_error_log: false,
Expand Down Expand Up @@ -158,7 +167,7 @@ module.exports = {
// auto_start_session: true

// use parallel execution in Cucumber
// parallel: 2 // set number of workers to use (can also be defined in the cli as --parallel 2
// workers: 2 // set number of workers to use (can also be defined in the cli as --workers=2
}
}
},
Expand All @@ -167,21 +176,21 @@ module.exports = {
// Configuration for when using the browserstack.com cloud service |
// |
// Please set the username and access key by setting the environment variables: |
// - BROWSERSTACK_USER |
// - BROWSERSTACK_KEY |
// - BROWSERSTACK_USERNAME |
// - BROWSERSTACK_ACCESS_KEY |
// .env files are supported |
//////////////////////////////////////////////////////////////////////////////////
browserstack: {
selenium: {
host: 'hub-cloud.browserstack.com',
host: 'hub.browserstack.com',
port: 443
},
// More info on configuring capabilities can be found on:
// https://www.browserstack.com/automate/capabilities?tag=selenium-4
desiredCapabilities: {
'bstack:options': {
userName: '${BROWSERSTACK_USER}',
accessKey: '${BROWSERSTACK_KEY}'
userName: '${BROWSERSTACK_USERNAME}',
accessKey: '${BROWSERSTACK_ACCESS_KEY}'
}
},

Expand All @@ -208,8 +217,7 @@ module.exports = {
desiredCapabilities: {
browserName: 'chrome',
chromeOptions: {
w3c: true,
'args': ['start-maximized']
w3c: true
}
}
},
Expand Down Expand Up @@ -250,19 +258,79 @@ module.exports = {
}
},
//////////////////////////////////////////////////////////////////////////////////
// Configuration for when using the SauceLabs cloud service |
// |
// Please set the username and access key by setting the environment variables: |
// - SAUCE_USERNAME |
// - SAUCE_ACCESS_KEY |
//////////////////////////////////////////////////////////////////////////////////
saucelabs: {
selenium: {
host: 'ondemand.saucelabs.com',
port: 443
},
// More info on configuring capabilities can be found on:
// https://docs.saucelabs.com/dev/test-configuration-options/
desiredCapabilities: {
'sauce:options': {
username: '${SAUCE_USERNAME}',
accessKey: '${SAUCE_ACCESS_KEY}',
screenResolution: '1280x1024'
// https://docs.saucelabs.com/dev/cli/sauce-connect-proxy/#--region
// region: 'us-west-1'
// https://docs.saucelabs.com/dev/test-configuration-options/#tunnelidentifier
// parentTunnel: '',
// tunnelIdentifier: '',
}
},
disable_error_log: false,
webdriver: {
start_process: false
}
},
'saucelabs.chrome': {
extends: 'saucelabs',
desiredCapabilities: {
browserName: 'chrome',
browserVersion: 'latest',
javascriptEnabled: true,
acceptSslCerts: true,
timeZone: 'London',
chromeOptions: {
w3c: true
}
}
},
'saucelabs.firefox': {
extends: 'saucelabs',
desiredCapabilities: {
browserName: 'firefox',
browserVersion: 'latest',
javascriptEnabled: true,
acceptSslCerts: true,
timeZone: 'London'
}
},
//////////////////////////////////////////////////////////////////////////////////
// Configuration for when using the Selenium service, either locally or remote, |
// like Selenium Grid |
//////////////////////////////////////////////////////////////////////////////////
selenium_server: {
// Selenium Server is running locally and is managed by Nightwatch
// Install the NPM package @nightwatch/selenium-server or download the selenium server jar file from https://github.com/SeleniumHQ/selenium/releases/, e.g.: selenium-server-4.1.1.jar
selenium: {
start_process: true,
port: 4444,
server_path: (Services.seleniumServer ? Services.seleniumServer.path : ''),
server_path: '', // Leave empty if @nightwatch/selenium-server is installed
command: 'standalone', // Selenium 4 only
cli_args: {
'webdriver.gecko.driver': (Services.geckodriver ? Services.geckodriver.path : ''),
'webdriver.chrome.driver': (Services.chromedriver ? Services.chromedriver.path : '')
//'webdriver.gecko.driver': '',
//'webdriver.chrome.driver': ''
}
},
webdriver: {
start_process: false,
default_path_prefix: '/wd/hub'
}
},

Expand Down Expand Up @@ -290,17 +358,3 @@ module.exports = {
}
}
};

function loadServices() {
try {
Services.seleniumServer = require('selenium-server');
} catch (err) {}

try {
Services.chromedriver = require('chromedriver');
} catch (err) {}

try {
Services.geckodriver = require('geckodriver');
} catch (err) {}
}
Loading