|
| 1 | +// Refer to the online docs for more details: https://nightwatchjs.org/gettingstarted/configuration/ |
| 2 | +const Services = {}; loadServices() |
| 3 | + |
| 4 | +module.exports = { |
| 5 | + // An array of folders (excluding subfolders) where your tests are located; |
| 6 | + // if this is not specified, the test source must be passed as the second argument to the test runner. |
| 7 | + src_folders: ['test/e2e/specs'], |
| 8 | + |
| 9 | + exclude: [], |
| 10 | + |
| 11 | + // See https://nightwatchjs.org/guide/working-with-page-objects/ |
| 12 | + page_objects_path: 'test/e2e/pageObjects', |
| 13 | + |
| 14 | + // See https://nightwatchjs.org/guide/extending-nightwatch/#writing-custom-commands |
| 15 | + custom_commands_path: '', |
| 16 | + |
| 17 | + // See https://nightwatchjs.org/guide/extending-nightwatch/#writing-custom-assertions |
| 18 | + custom_assertions_path: '', |
| 19 | + |
| 20 | + // See https://nightwatchjs.org/guide/#external-globals |
| 21 | + globals_path: 'nightwatch_globals.js', |
| 22 | + |
| 23 | + webdriver: {}, |
| 24 | + |
| 25 | + test_settings: { |
| 26 | + default: { |
| 27 | + disable_error_log: false, |
| 28 | + launch_url: 'https://nightwatchjs.org', |
| 29 | + |
| 30 | + screenshots: { |
| 31 | + enabled: false, |
| 32 | + path: 'screens', |
| 33 | + on_failure: true |
| 34 | + }, |
| 35 | + |
| 36 | + desiredCapabilities: { |
| 37 | + browserName: 'chrome' |
| 38 | + }, |
| 39 | + |
| 40 | + webdriver: { |
| 41 | + start_process: true, |
| 42 | + server_path: 'node_modules/.bin/chromedriver', |
| 43 | + port: 9515 |
| 44 | + } |
| 45 | + }, |
| 46 | + |
| 47 | + safari: { |
| 48 | + desiredCapabilities: { |
| 49 | + browserName: 'safari', |
| 50 | + alwaysMatch: { |
| 51 | + acceptInsecureCerts: false |
| 52 | + } |
| 53 | + }, |
| 54 | + webdriver: { |
| 55 | + port: 4445, |
| 56 | + start_process: true, |
| 57 | + server_path: '/usr/bin/safaridriver' |
| 58 | + } |
| 59 | + }, |
| 60 | + |
| 61 | + firefox: { |
| 62 | + desiredCapabilities: { |
| 63 | + browserName: 'firefox', |
| 64 | + alwaysMatch: { |
| 65 | + // Enable this if you encounter unexpected SSL certificate errors in Firefox |
| 66 | + // acceptInsecureCerts: true, |
| 67 | + 'moz:firefoxOptions': { |
| 68 | + args: [ |
| 69 | + // '-headless', |
| 70 | + // '-verbose' |
| 71 | + ] |
| 72 | + } |
| 73 | + } |
| 74 | + }, |
| 75 | + webdriver: { |
| 76 | + start_process: true, |
| 77 | + // default_path_prefix: '/wd/hub', |
| 78 | + use_legacy_jsonwire: true, |
| 79 | + port: 4444, |
| 80 | + server_path: (Services.geckodriver ? Services.geckodriver.path : ''), |
| 81 | + cli_args: [ |
| 82 | + // very verbose geckodriver logs |
| 83 | + // '-vv' |
| 84 | + ] |
| 85 | + } |
| 86 | + }, |
| 87 | + |
| 88 | + chrome: { |
| 89 | + desiredCapabilities: { |
| 90 | + browserName: 'chrome', |
| 91 | + chromeOptions: { |
| 92 | + // This tells Chromedriver to run using the legacy JSONWire protocol (not required in Chrome 78) |
| 93 | + // w3c: false, |
| 94 | + // More info on Chromedriver: https://sites.google.com/a/chromium.org/chromedriver/ |
| 95 | + args: [ |
| 96 | + // '--no-sandbox', |
| 97 | + // '--ignore-certificate-errors', |
| 98 | + // '--allow-insecure-localhost', |
| 99 | + // '--headless' |
| 100 | + ] |
| 101 | + } |
| 102 | + }, |
| 103 | + |
| 104 | + webdriver: { |
| 105 | + start_process: true, |
| 106 | + port: 9515, |
| 107 | + server_path: (Services.chromedriver ? Services.chromedriver.path : ''), |
| 108 | + cli_args: [ |
| 109 | + // --verbose |
| 110 | + ] |
| 111 | + } |
| 112 | + }, |
| 113 | + |
| 114 | + // //////////////////////////////////////////////////////////////////////////////// |
| 115 | + // Configuration for when using the browserstack.com cloud service | |
| 116 | + // | |
| 117 | + // Please set the username and access key by setting the environment variables: | |
| 118 | + // - BROWSERSTACK_USER | |
| 119 | + // - BROWSERSTACK_KEY | |
| 120 | + // .env files are supported | |
| 121 | + // //////////////////////////////////////////////////////////////////////////////// |
| 122 | + browserstack: { |
| 123 | + selenium: { |
| 124 | + host: 'hub-cloud.browserstack.com', |
| 125 | + port: 443 |
| 126 | + }, |
| 127 | + // More info on configuring capabilities can be found on: |
| 128 | + // https://www.browserstack.com/automate/capabilities?tag=selenium-4 |
| 129 | + desiredCapabilities: { |
| 130 | + 'bstack:options': { |
| 131 | + local: 'false', |
| 132 | + userName: '{BROWSERSTACK_USER}', |
| 133 | + accessKey: '{BROWSERSTACK_KEY}' |
| 134 | + } |
| 135 | + }, |
| 136 | + |
| 137 | + disable_error_log: true, |
| 138 | + webdriver: { |
| 139 | + keep_alive: true, |
| 140 | + start_process: false |
| 141 | + } |
| 142 | + }, |
| 143 | + |
| 144 | + 'browserstack.chrome': { |
| 145 | + extends: 'browserstack', |
| 146 | + desiredCapabilities: { |
| 147 | + browserName: 'chrome', |
| 148 | + chromeOptions: { |
| 149 | + // This tells Chromedriver to run using the legacy JSONWire protocol |
| 150 | + // More info on Chromedriver: https://sites.google.com/a/chromium.org/chromedriver/ |
| 151 | + w3c: false |
| 152 | + } |
| 153 | + } |
| 154 | + }, |
| 155 | + |
| 156 | + 'browserstack.firefox': { |
| 157 | + extends: 'browserstack', |
| 158 | + desiredCapabilities: { |
| 159 | + browserName: 'firefox' |
| 160 | + } |
| 161 | + }, |
| 162 | + |
| 163 | + 'browserstack.ie': { |
| 164 | + extends: 'browserstack', |
| 165 | + desiredCapabilities: { |
| 166 | + browserName: 'IE', |
| 167 | + browserVersion: '11.0', |
| 168 | + 'bstack:options': { |
| 169 | + os: 'Windows', |
| 170 | + osVersion: '10', |
| 171 | + local: 'false', |
| 172 | + seleniumVersion: '3.5.2', |
| 173 | + resolution: '1366x768' |
| 174 | + } |
| 175 | + } |
| 176 | + }, |
| 177 | + |
| 178 | + // //////////////////////////////////////////////////////////////////////////////// |
| 179 | + // Configuration for when using the Selenium service, either locally or remote, | |
| 180 | + // like Selenium Grid | |
| 181 | + // //////////////////////////////////////////////////////////////////////////////// |
| 182 | + selenium: { |
| 183 | + // Selenium Server is running locally and is managed by Nightwatch |
| 184 | + selenium: { |
| 185 | + start_process: true, |
| 186 | + port: 4444, |
| 187 | + server_path: (Services.seleniumServer ? Services.seleniumServer.path : ''), |
| 188 | + cli_args: { |
| 189 | + 'webdriver.gecko.driver': (Services.geckodriver ? Services.geckodriver.path : ''), |
| 190 | + 'webdriver.chrome.driver': (Services.chromedriver ? Services.chromedriver.path : '') |
| 191 | + } |
| 192 | + } |
| 193 | + }, |
| 194 | + |
| 195 | + 'selenium.chrome': { |
| 196 | + extends: 'selenium', |
| 197 | + desiredCapabilities: { |
| 198 | + browserName: 'chrome', |
| 199 | + chromeOptions: { |
| 200 | + w3c: false |
| 201 | + } |
| 202 | + } |
| 203 | + }, |
| 204 | + |
| 205 | + 'selenium.firefox': { |
| 206 | + extends: 'selenium', |
| 207 | + desiredCapabilities: { |
| 208 | + browserName: 'firefox', |
| 209 | + 'moz:firefoxOptions': { |
| 210 | + args: [ |
| 211 | + // '-headless', |
| 212 | + // '-verbose' |
| 213 | + ] |
| 214 | + } |
| 215 | + } |
| 216 | + } |
| 217 | + } |
| 218 | +} |
| 219 | + |
| 220 | +function loadServices () { |
| 221 | + try { |
| 222 | + Services.seleniumServer = require('selenium-server') |
| 223 | + } catch (err) {} |
| 224 | + |
| 225 | + try { |
| 226 | + Services.chromedriver = require('chromedriver') |
| 227 | + } catch (err) {} |
| 228 | + |
| 229 | + try { |
| 230 | + Services.geckodriver = require('geckodriver') |
| 231 | + } catch (err) {} |
| 232 | +} |
0 commit comments