-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updates selenium webdriver update script
OKTA-324375 <<<Jenkins Check-In of Tested SHA: 30f12eb for [email protected]>>> Artifact: okta-angular
- Loading branch information
1 parent
f3abc0b
commit bef8c5a
Showing
4 changed files
with
1,224 additions
and
1,121 deletions.
There are no files selected for viewing
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 @@ | ||
scripts/update-se-drivers.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
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,42 @@ | ||
const axios = require('axios'); | ||
const { execSync, execFileSync } = require('child_process'); | ||
|
||
function getOS() { | ||
let os = process.platform; | ||
if (os === 'darwin') { | ||
os = 'MacOS'; | ||
} else if (os === 'win32' || os === 'win64') { | ||
os = 'Windows'; | ||
} else if (os === 'linux') { | ||
os = 'Linux'; | ||
} | ||
return os; | ||
} | ||
|
||
const os = getOS(); | ||
console.log(`Operating System - ${os}`); | ||
|
||
let chromeVersion; | ||
if (os === 'MacOS') { | ||
const chromeVersionString = execSync('/Applications/Google\\ Chrome.app/Contents/MacOS/Google\\ Chrome --version').toString(); | ||
// Get the major and minor version of the chrome version using regex (1 or more digits followed by a dot followed by 1 or more digits) | ||
const matchIndex = 0; | ||
chromeVersion = chromeVersionString.match(/(\d+(\.\d+)?)/)[matchIndex]; | ||
} else { | ||
chromeVersion = execSync('google-chrome --product-version').toString(); | ||
} | ||
|
||
const chromeMajorVersion = chromeVersion.split('.')[0]; | ||
console.log(`Chrome Major Version - ${chromeMajorVersion}`); | ||
|
||
const chromeDriverUrl = `https://chromedriver.storage.googleapis.com/LATEST_RELEASE_${chromeMajorVersion}`; | ||
|
||
axios.get(chromeDriverUrl).then((response) => { | ||
const chromeDriverVersion = response.data; | ||
console.log(`Chrome Driver Version - ${chromeDriverVersion}`); | ||
|
||
execFileSync(`${__dirname}/../node_modules/protractor/bin/webdriver-manager`, ["update", "--versions.chrome", chromeDriverVersion, "--gecko", "false", "--versions.standalone", "latest"]); | ||
console.log('Webdriver was updated'); | ||
}).catch((err) => { | ||
console.log(err); | ||
}); |
Oops, something went wrong.