-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
patch webdriver (see angular/webdriver-manager#517)
- Loading branch information
Showing
3 changed files
with
291 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,73 @@ | ||
diff --git a/node_modules/protractor/node_modules/webdriver-manager/built/lib/binaries/.chrome_xml.js.swp b/node_modules/protractor/node_modules/webdriver-manager/built/lib/binaries/.chrome_xml.js.swp | ||
new file mode 100644 | ||
index 0000000..9d62614 | ||
Binary files /dev/null and b/node_modules/protractor/node_modules/webdriver-manager/built/lib/binaries/.chrome_xml.js.swp differ | ||
diff --git a/node_modules/protractor/node_modules/webdriver-manager/built/lib/binaries/chrome_xml.js b/node_modules/protractor/node_modules/webdriver-manager/built/lib/binaries/chrome_xml.js | ||
index 5fb5eaa..ea6a36d 100644 | ||
--- a/node_modules/protractor/node_modules/webdriver-manager/built/lib/binaries/chrome_xml.js | ||
+++ b/node_modules/protractor/node_modules/webdriver-manager/built/lib/binaries/chrome_xml.js | ||
@@ -55,12 +55,41 @@ class ChromeXml extends config_source_1.XmlConfigSource { | ||
/** | ||
* Gets the latest item from the XML. | ||
*/ | ||
- getLatestChromeDriverVersion() { | ||
- const latestReleaseUrl = 'https://chromedriver.storage.googleapis.com/LATEST_RELEASE'; | ||
- return http_utils_1.requestBody(latestReleaseUrl).then(latestVersion => { | ||
- return this.getSpecificChromeDriverVersion(latestVersion); | ||
- }); | ||
- } | ||
+ getLatestChromeDriverVersion() { | ||
+ const path = require('path') | ||
+ const fs = require('fs') | ||
+ | ||
+ const lastKnownGoodVersionsWithDownloads_Url = 'https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions-with-downloads.json'; | ||
+ return http_utils_1.requestBody(lastKnownGoodVersionsWithDownloads_Url).then(body => { | ||
+ const latestVersion_Body = JSON.parse(body)['channels']['Stable'] | ||
+ | ||
+ const latestVersion = latestVersion_Body['version'] | ||
+ const latestVersion_Url = latestVersion_Body['downloads']['chromedriver'].find(obj => obj['platform'] == 'linux64')['url'] | ||
+ | ||
+ const latestMajorVersion = latestVersion.split('.')[0] | ||
+ | ||
+ const localVersion_FileName = fs.readdirSync(path.resolve(__dirname, '..', '..', '..', 'selenium')) | ||
+ .find(f => f.startsWith(`chromedriver_${latestMajorVersion}`)) || '' | ||
+ | ||
+ const localVersion = localVersion_FileName.slice(13, -4) | ||
+ const localVersion_Url = latestVersion_Url.replace(latestVersion, localVersion) | ||
+ | ||
+ const localMajorVersion = localVersion.split('.')[0] | ||
+ | ||
+ if (latestMajorVersion == localMajorVersion) { | ||
+ return Promise.resolve({ | ||
+ url: localVersion_Url, | ||
+ version: localVersion, | ||
+ }) | ||
+ } else { | ||
+ return Promise.resolve({ | ||
+ url: latestVersion_Url, | ||
+ version: latestVersion, | ||
+ }) | ||
+ } | ||
+ }); | ||
+ } | ||
+ | ||
/** | ||
* Gets a specific item from the XML. | ||
*/ | ||
diff --git a/node_modules/protractor/node_modules/webdriver-manager/built/lib/cmds/update.js b/node_modules/protractor/node_modules/webdriver-manager/built/lib/cmds/update.js | ||
index b98cdce..4c5b27b 100644 | ||
--- a/node_modules/protractor/node_modules/webdriver-manager/built/lib/cmds/update.js | ||
+++ b/node_modules/protractor/node_modules/webdriver-manager/built/lib/cmds/update.js | ||
@@ -237,7 +237,11 @@ function unzip(binary, outputDir, fileName) { | ||
child_process.spawnSync('tar', ['zxvf', path.resolve(outputDir, fileName), '-C', outputDir]); | ||
} | ||
// rename | ||
- fs.renameSync(path.resolve(outputDir, binary.zipContentName()), mv); | ||
+ if (fileName.indexOf('chromedriver_') != -1) { | ||
+ fs.renameSync(path.resolve(outputDir, 'chromedriver-linux64', binary.zipContentName()), mv) | ||
+ } else { | ||
+ fs.renameSync(path.resolve(outputDir, binary.zipContentName()), mv); | ||
+ } | ||
// set permissions | ||
if (osType !== 'Windows_NT') { | ||
logger.info(binary.name + ': setting permissions to 0755 for ' + mv); |