Skip to content

Commit 7ad43fb

Browse files
committed
Temporarily hardcode chromedriver to 112.0.0 to enable all ftr tests
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>
1 parent f5a978d commit 7ad43fb

File tree

2 files changed

+22
-6
lines changed

2 files changed

+22
-6
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
211211
- Prevent primitive linting limitations from being applied to unit tests found under `src/setup_node_env` ([#3403](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3403))
212212
- [Tests] Fix unit tests for `get_keystore` ([#3854](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3854))
213213
- [Tests] Use `scripts/use_node` instead of `node` in functional test plugins ([#3783](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3783))
214+
- Temporarily hardcode the largest support `chromedriver` version to `112.0.0` to enable all ftr tests ([#3976](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3976))
214215

215216
## [2.x]
216217

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)