Skip to content

Commit 56013df

Browse files
Temporarily hardcode chromedriver to 112.0.0 to enable all ftr tests (#3976)
The latest version of chromedriver is 112.0.1 which does not support node 14. This PR hardcodes chromedriver to 112.0.0 temporarily. Pls revert it once we bump to node 18. Issue Resolved #3975 Signed-off-by: ananzh <ananzh@amazon.com> (cherry picked from commit 5ea0cbe) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> # Conflicts: # CHANGELOG.md
1 parent 62e7ea6 commit 56013df

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

scripts/upgrade_chromedriver.js

+21-6
Original file line numberDiff line numberDiff line change
@@ -71,16 +71,31 @@ versionCheckCommands.some((cmd) => {
7171
const majorVersion = versionCheckOutput?.match?.(/(?:^|\s)(9\d|\d{3})\./)?.[1];
7272

7373
if (majorVersion) {
74+
let targetVersion = `^${majorVersion}`;
75+
76+
// TODO: Temporary fix to install chromedriver 112.0.0 if major version is 112.
77+
// Exit if major version is greater than 112.
78+
// Revert this once node is bumped to 16+.
79+
// https://github.com/opensearch-project/OpenSearch-Dashboards/issues/3975
80+
if (parseInt(majorVersion) === 112) {
81+
targetVersion = '112.0.0';
82+
} else if (parseInt(majorVersion) > 112) {
83+
console.error(
84+
`::error::Chrome version (${majorVersion}) is not supported by this script. The largest chrome version we support is 112.`
85+
);
86+
process.exit(1);
87+
}
88+
7489
if (process.argv.includes('--install')) {
75-
console.log(`Installing chromedriver@^${majorVersion}`);
90+
console.log(`Installing chromedriver@${targetVersion}`);
7691

77-
spawnSync(`yarn add --dev chromedriver@^${majorVersion}`, {
92+
spawnSync(`yarn add --dev chromedriver@${targetVersion}`, {
7893
stdio: 'inherit',
7994
cwd: process.cwd(),
8095
shell: true,
8196
});
8297
} else {
83-
console.log(`Upgrading to chromedriver@^${majorVersion}`);
98+
console.log(`Upgrading to chromedriver@${targetVersion}`);
8499

85100
let upgraded = false;
86101
const writeStream = createWriteStream('package.json.upgrading-chromedriver', { flags: 'w' });
@@ -92,7 +107,7 @@ if (majorVersion) {
92107
if (line.includes('"chromedriver": "')) {
93108
line = line.replace(
94109
/"chromedriver":\s*"[~^]?\d[\d.]*\d"/,
95-
`"chromedriver": "^${majorVersion}"`
110+
`"chromedriver": "${targetVersion}"`
96111
);
97112
upgraded = true;
98113
}
@@ -107,11 +122,11 @@ if (majorVersion) {
107122
renameSync('package.json', 'package.json.bak');
108123
renameSync('package.json.upgrading-chromedriver', 'package.json');
109124

110-
console.log(`Backed up package.json and updated chromedriver to ${majorVersion}`);
125+
console.log(`Backed up package.json and updated chromedriver to ${targetVersion}`);
111126
} else {
112127
unlinkSync('package.json.upgrading-chromedriver');
113128
console.error(
114-
`Failed to update chromedriver to ${majorVersion}. Try adding the \`--install\` switch.`
129+
`Failed to update chromedriver to ${targetVersion}. Try adding the \`--install\` switch.`
115130
);
116131
}
117132
});

0 commit comments

Comments
 (0)