-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
feat: Upgraded Nightwatch to 2.0, updated distribued config #6520
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
haoqunjiang
merged 12 commits into
vuejs:dev
from
vaibhavsingh97:feat/nightwatch-upgrade-v1.6.4
Feb 7, 2022
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
563b76d
feat: Upgraded Nightwatch to 1.6.4, updated distribued config
vaibhavsingh97 e789f18
fix(package.json): geckodriver version
vaibhavsingh97 19033b2
fix(nightwatch.conf.js): config issue
vaibhavsingh97 680d39f
fix: tests cases
vaibhavsingh97 d6f26de
fix: Nightwatch config, and remove yarn.lock
vaibhavsingh97 f113575
chore(package.json): Nightwatch 1.6.3 -> 1.7.3
vaibhavsingh97 1e31efe
chore: dev merge
vaibhavsingh97 95e369b
Merge remote-tracking branch 'origin' into feat/nightwatch-upgrade-v1…
37f791c
chore: nightwatch config
90a0517
fix: ci issues
26014a9
chore!: update nightwatch to v2
haoqunjiang 99a9f0e
style: revert the semicolon change
haoqunjiang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
360 changes: 360 additions & 0 deletions
360
packages/@vue/cli-plugin-e2e-nightwatch/nightwatch.conf.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,360 @@ | ||
// Autogenerated by Nightwatch | ||
// Refer to the online docs for more details: https://nightwatchjs.org/gettingstarted/configuration/ | ||
|
||
const path = require('path') | ||
const deepmerge = require('deepmerge') | ||
|
||
const Services = {} | ||
loadServices() | ||
const VUE_DEV_SERVER_URL = process.env.VUE_DEV_SERVER_URL | ||
const BROWSERSTACK_USER = process.env.BROWSERSTACK_USER | ||
const BROWSERSTACK_KEY = process.env.VUE_DEV_SERVER_URL | ||
const userOptions = JSON.parse(process.env.VUE_NIGHTWATCH_USER_OPTIONS || '{}') | ||
const concurrentMode = process.env.VUE_NIGHTWATCH_CONCURRENT === '1' | ||
const useSelenium = process.env.VUE_NIGHTWATCH_USE_SELENIUM === '1' | ||
const startHeadless = process.env.VUE_NIGHTWATCH_HEADLESS === '1' | ||
const chromeArgs = [] | ||
const geckoArgs = [] | ||
|
||
if (startHeadless) { | ||
chromeArgs.push('headless') | ||
geckoArgs.push('--headless') | ||
} | ||
|
||
// _ _ _ _ _ _ _ | ||
// | \ | |(_) | | | | | | | | | ||
// | \| | _ __ _ | |__ | |_ __ __ __ _ | |_ ___ | |__ | ||
// | . ` || | / _` || '_ \ | __|\ \ /\ / / / _` || __| / __|| '_ \ | ||
// | |\ || || (_| || | | || |_ \ V V / | (_| || |_ | (__ | | | | | ||
// \_| \_/|_| \__, ||_| |_| \__| \_/\_/ \__,_| \__| \___||_| |_| | ||
// __/ | | ||
// |___/ | ||
|
||
const defaultSettings = { | ||
// 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: ['tests/e2e/specs'], | ||
|
||
// See https://nightwatchjs.org/guide/working-with-page-objects/ | ||
page_objects_path: 'tests/e2e/page-objects', | ||
|
||
// See https://nightwatchjs.org/guide/extending-nightwatch/#writing-custom-commands | ||
custom_commands_path: 'tests/e2e/custom-commands', | ||
|
||
// See https://nightwatchjs.org/guide/extending-nightwatch/#writing-custom-assertions | ||
custom_assertions_path: 'tests/e2e/custom-assertions', | ||
|
||
// See https://nightwatchjs.org/guide/#external-globals | ||
globals_path: path.resolve('tests/e2e/globals.js'), | ||
|
||
output_folder: 'tests/e2e/reports', | ||
|
||
webdriver: {}, | ||
|
||
test_workers: { | ||
enabled: concurrentMode, | ||
workers: 'auto' | ||
}, | ||
|
||
test_settings: { | ||
default: { | ||
disable_error_log: false, | ||
launch_url: `${VUE_DEV_SERVER_URL}`, | ||
|
||
screenshots: { | ||
enabled: false, | ||
path: 'screens', | ||
on_failure: true | ||
}, | ||
|
||
desiredCapabilities: { | ||
browserName: 'firefox' | ||
}, | ||
|
||
webdriver: { | ||
start_process: true, | ||
server_path: Services.geckodriver ? Services.geckodriver.path : '' | ||
} | ||
}, | ||
|
||
safari: { | ||
desiredCapabilities: { | ||
browserName: 'safari', | ||
alwaysMatch: { | ||
acceptInsecureCerts: false | ||
} | ||
}, | ||
webdriver: { | ||
start_process: true, | ||
server_path: '/usr/bin/safaridriver' | ||
} | ||
}, | ||
|
||
firefox: { | ||
desiredCapabilities: { | ||
browserName: 'firefox', | ||
alwaysMatch: { | ||
// Enable this if you encounter unexpected SSL certificate errors in Firefox | ||
// acceptInsecureCerts: true, | ||
'moz:firefoxOptions': { | ||
args: geckoArgs | ||
} | ||
} | ||
}, | ||
webdriver: { | ||
start_process: true, | ||
server_path: Services.geckodriver ? Services.geckodriver.path : '', | ||
cli_args: [ | ||
// very verbose geckodriver logs | ||
// '-vv' | ||
] | ||
} | ||
}, | ||
|
||
chrome: { | ||
desiredCapabilities: { | ||
browserName: 'chrome', | ||
'goog:chromeOptions': { | ||
// More info on Chromedriver: https://sites.google.com/a/chromium.org/chromedriver/ | ||
// | ||
// w3c:false tells Chromedriver to run using the legacy JSONWire protocol (not required in Chrome 78) | ||
w3c: true, | ||
args: chromeArgs | ||
} | ||
}, | ||
|
||
webdriver: { | ||
start_process: true, | ||
server_path: Services.chromedriver ? Services.chromedriver.path : '', | ||
cli_args: [ | ||
// --verbose | ||
] | ||
} | ||
}, | ||
|
||
edge: { | ||
desiredCapabilities: { | ||
browserName: 'MicrosoftEdge', | ||
'ms:edgeOptions': { | ||
w3c: true, | ||
// More info on EdgeDriver: https://docs.microsoft.com/en-us/microsoft-edge/webdriver-chromium/capabilities-edge-options | ||
args: [ | ||
// '--headless' | ||
] | ||
} | ||
}, | ||
|
||
webdriver: { | ||
start_process: true, | ||
// Download msedgedriver from https://docs.microsoft.com/en-us/microsoft-edge/webdriver-chromium/ | ||
// and set the location below: | ||
server_path: '', | ||
cli_args: [ | ||
// --verbose | ||
] | ||
} | ||
}, | ||
|
||
/// /////////////////////////////////////////////////////////////////////////////// | ||
// Configuration for when using cucumber-js (https://cucumber.io) | | ||
// | | ||
// It uses the bundled examples inside the nightwatch examples folder; feel free | | ||
// to adapt this to your own project needs | | ||
/// /////////////////////////////////////////////////////////////////////////////// | ||
'cucumber-js': { | ||
src_folders: ['examples/cucumber-js/features/step_definitions'], | ||
|
||
test_runner: { | ||
// set cucumber as the runner | ||
type: 'cucumber', | ||
|
||
// define cucumber specific options | ||
options: { | ||
// set the feature path | ||
feature_path: 'node_modules/nightwatch/examples/cucumber-js/*/*.feature' | ||
|
||
// start the webdriver session automatically (enabled by default) | ||
// 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 | ||
} | ||
} | ||
}, | ||
|
||
/// /////////////////////////////////////////////////////////////////////////////// | ||
// 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 | | ||
// .env files are supported | | ||
/// /////////////////////////////////////////////////////////////////////////////// | ||
browserstack: { | ||
selenium: { | ||
host: 'hub-cloud.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}` | ||
} | ||
}, | ||
|
||
disable_error_log: true, | ||
webdriver: { | ||
timeout_options: { | ||
timeout: 15000, | ||
retry_attempts: 3 | ||
}, | ||
keep_alive: true, | ||
start_process: false | ||
} | ||
}, | ||
|
||
'browserstack.local': { | ||
extends: 'browserstack', | ||
desiredCapabilities: { | ||
'browserstack.local': true | ||
} | ||
}, | ||
|
||
'browserstack.chrome': { | ||
extends: 'browserstack', | ||
desiredCapabilities: { | ||
browserName: 'chrome', | ||
chromeOptions: { | ||
w3c: true | ||
} | ||
} | ||
}, | ||
|
||
'browserstack.firefox': { | ||
extends: 'browserstack', | ||
desiredCapabilities: { | ||
browserName: 'firefox' | ||
} | ||
}, | ||
|
||
'browserstack.ie': { | ||
extends: 'browserstack', | ||
desiredCapabilities: { | ||
browserName: 'internet explorer', | ||
browserVersion: '11.0' | ||
} | ||
}, | ||
|
||
'browserstack.safari': { | ||
extends: 'browserstack', | ||
desiredCapabilities: { | ||
browserName: 'safari' | ||
} | ||
}, | ||
|
||
'browserstack.local_chrome': { | ||
extends: 'browserstack.local', | ||
desiredCapabilities: { | ||
browserName: 'chrome' | ||
} | ||
}, | ||
|
||
'browserstack.local_firefox': { | ||
extends: 'browserstack.local', | ||
desiredCapabilities: { | ||
browserName: 'firefox' | ||
} | ||
}, | ||
/// /////////////////////////////////////////////////////////////////////////////// | ||
// 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 | ||
selenium: { | ||
start_process: true, | ||
port: 4444, | ||
server_path: (Services.seleniumServer ? Services.seleniumServer.path : ''), | ||
cli_args: { | ||
'webdriver.gecko.driver': (Services.geckodriver ? Services.geckodriver.path : ''), | ||
'webdriver.chrome.driver': (Services.chromedriver ? Services.chromedriver.path : '') | ||
} | ||
} | ||
}, | ||
|
||
'selenium.chrome': { | ||
extends: 'selenium_server', | ||
desiredCapabilities: { | ||
browserName: 'chrome', | ||
chromeOptions: { | ||
w3c: true | ||
} | ||
} | ||
}, | ||
|
||
'selenium.firefox': { | ||
extends: 'selenium_server', | ||
desiredCapabilities: { | ||
browserName: 'firefox', | ||
'moz:firefoxOptions': { | ||
args: geckoArgs | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
const baseSettings = deepmerge(defaultSettings, webdriverServerSettings()) | ||
|
||
module.exports = deepmerge(baseSettings, adaptUserSettings(userOptions)) | ||
|
||
function adaptUserSettings (settings) { | ||
// The path to nightwatch external globals file needs to be made absolute | ||
// if it is supplied in an additional config file, due to merging of config files | ||
if (settings.globals_path) { | ||
settings.globals_path = path.resolve(settings.globals_path) | ||
} | ||
|
||
return settings | ||
} | ||
|
||
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': Services.chromedriver.path, | ||
'webdriver.gecko.driver': Services.geckodriver.path | ||
} | ||
} | ||
} | ||
} | ||
|
||
return { | ||
webdriver: { | ||
start_process: true, | ||
port: 9515, | ||
server_path: Services.chromedriver.path | ||
} | ||
} | ||
} | ||
|
||
function loadServices () { | ||
try { | ||
Services.seleniumServer = require('selenium-server') | ||
} catch (err) {} | ||
|
||
try { | ||
Services.chromedriver = require('chromedriver') | ||
} catch (err) {} | ||
|
||
try { | ||
Services.geckodriver = require('geckodriver') | ||
} catch (err) {} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.