Last active
December 11, 2018 11:46
-
-
Save Izhaki/19b87516636290cc747d43a9a1022d9e to your computer and use it in GitHub Desktop.
A small script to update webdriver if needed prior to running protractor.
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
const isWebdriverUpToDate = () => { | |
const fs = require('fs'); | |
const path = require('path'); | |
const SeleniumConfig = require('webdriver-manager/built/lib/config').Config; | |
const updateJson = path.resolve(SeleniumConfig.getSeleniumDir(), 'update-config.json'); | |
return fs.existsSync(updateJson); | |
}; | |
const updateWebdriver = () => { | |
const { spawnSync } = require('child_process'); | |
spawnSync('yarn', ['webdriver:update']); | |
}; | |
if (!isWebdriverUpToDate()) { | |
console.log('Webdriver updating...'); | |
updateWebdriver(); | |
console.log('Webdriver updated.'); | |
} else { | |
console.log('Webdriver up to date.'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In use: