-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(nightwatch): check user's installed browser versions on scaffold…
…ing / before running tests (#4563)
- Loading branch information
1 parent
dcd8d94
commit 0473432
Showing
8 changed files
with
168 additions
and
7 deletions.
There are no files selected for viewing
18 changes: 16 additions & 2 deletions
18
packages/@vue/cli-plugin-e2e-nightwatch/generator/index.js
This file contains 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 |
---|---|---|
@@ -1,15 +1,29 @@ | ||
const { installedBrowsers } = require('@vue/cli-shared-utils') | ||
|
||
module.exports = api => { | ||
api.render('./template', { | ||
hasTS: api.hasPlugin('typescript') | ||
}) | ||
|
||
// Use devDependencies to store latest version number so as to automate update | ||
const devDeps = require('../package.json').devDependencies | ||
const geckodriver = devDeps.geckodriver | ||
|
||
// 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 | ||
|
||
api.extendPackage({ | ||
scripts: { | ||
'test:e2e': 'vue-cli-service test:e2e' | ||
}, | ||
devDependencies: { | ||
chromedriver: '^76.0.1', | ||
geckodriver: '^1.16.2' | ||
chromedriver, | ||
geckodriver | ||
} | ||
}) | ||
} |
This file contains 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 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 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 |
---|---|---|
|
@@ -42,6 +42,9 @@ | |
"peerDependenciesMeta": { | ||
"selenium-server": { | ||
"optional": true | ||
}, | ||
"geckodriver": { | ||
"optional": true | ||
} | ||
} | ||
} |
This file contains 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,22 @@ | ||
const { installedBrowsers } = require('@vue/cli-shared-utils') | ||
|
||
module.exports = [ | ||
{ | ||
name: 'webdrivers', | ||
type: `checkbox`, | ||
message: `Pick browsers to run end-to-end test on`, | ||
choices: [ | ||
{ | ||
name: `Chrome`, | ||
value: 'chrome', | ||
checked: true | ||
}, | ||
{ | ||
name: 'Firefox', | ||
value: 'firefox', | ||
// check the "Firefox" option if user has installed it | ||
checked: !!installedBrowsers.firefox | ||
} | ||
] | ||
} | ||
] |
This file contains 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 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 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