Skip to content
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

fix(nightwatch): should not install corresponding webdriver if the browser is unselected #5528

Merged
merged 2 commits into from Jun 18, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
31 changes: 17 additions & 14 deletions packages/@vue/cli-plugin-e2e-nightwatch/generator/index.js
@@ -1,30 +1,33 @@
const { installedBrowsers } = require('@vue/cli-shared-utils')

module.exports = api => {
module.exports = (api, { webdrivers }) => {
api.render('./template', {
hasTS: api.hasPlugin('typescript'),
hasESLint: api.hasPlugin('eslint')
})

const devDependencies = {}

// Use devDependencies to store latest version number so as to automate update
const devDeps = require('../package.json').devDependencies
const geckodriver = devDeps.geckodriver
const pluginDeps = require('../package.json').devDependencies

// chromedriver major version bumps every 6 weeks following Chrome
// so there may be a mismatch between
// user's installed browser version and the default provided version
// fallback to the devDependencies version in case detection fails
const chromedriver = installedBrowsers.chrome
? installedBrowsers.chrome.match(/^(\d+)\./)[1]
: devDeps.chromedriver
if (webdrivers && webdrivers.includes('firefox')) {
devDependencies.geckodriver = pluginDeps.geckodriver
}
if (webdrivers && webdrivers.includes('chrome')) {
// chromedriver major version bumps every 6 weeks following Chrome
// so there may be a mismatch between
// user's installed browser version and the default provided version
// fallback to the devDependencies version in case detection fails
devDependencies.chromedriver = installedBrowsers.chrome
? installedBrowsers.chrome.match(/^(\d+)\./)[1]
: pluginDeps.chromedriver
}

api.extendPackage({
scripts: {
'test:e2e': 'vue-cli-service test:e2e'
},
devDependencies: {
chromedriver,
geckodriver
}
devDependencies
})
}