Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Temporarily hardcode chromedriver to 112.0.0 to enable all ftr tests #3976

Merged
merged 1 commit into from
May 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- 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))
- [Tests] Fix unit tests for `get_keystore` ([#3854](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3854))
- [Tests] Use `scripts/use_node` instead of `node` in functional test plugins ([#3783](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3783))
- 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))

## [2.x]

Expand Down
27 changes: 21 additions & 6 deletions scripts/upgrade_chromedriver.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,31 @@ versionCheckCommands.some((cmd) => {
const majorVersion = versionCheckOutput?.match?.(/(?:^|\s)(9\d|\d{3})\./)?.[1];

if (majorVersion) {
let targetVersion = `^${majorVersion}`;

// TODO: Temporary fix to install chromedriver 112.0.0 if major version is 112.
// Exit if major version is greater than 112.
// Revert this once node is bumped to 16+.
// https://github.com/opensearch-project/OpenSearch-Dashboards/issues/3975
if (parseInt(majorVersion) === 112) {
targetVersion = '112.0.0';
} else if (parseInt(majorVersion) > 112) {
console.error(
`::error::Chrome version (${majorVersion}) is not supported by this script. The largest chrome version we support is 112.`
);
process.exit(1);
}

if (process.argv.includes('--install')) {
console.log(`Installing chromedriver@^${majorVersion}`);
console.log(`Installing chromedriver@${targetVersion}`);

spawnSync(`yarn add --dev chromedriver@^${majorVersion}`, {
spawnSync(`yarn add --dev chromedriver@${targetVersion}`, {
stdio: 'inherit',
cwd: process.cwd(),
shell: true,
});
} else {
console.log(`Upgrading to chromedriver@^${majorVersion}`);
console.log(`Upgrading to chromedriver@${targetVersion}`);

let upgraded = false;
const writeStream = createWriteStream('package.json.upgrading-chromedriver', { flags: 'w' });
Expand All @@ -92,7 +107,7 @@ if (majorVersion) {
if (line.includes('"chromedriver": "')) {
line = line.replace(
/"chromedriver":\s*"[~^]?\d[\d.]*\d"/,
`"chromedriver": "^${majorVersion}"`
`"chromedriver": "${targetVersion}"`
);
upgraded = true;
}
Expand All @@ -107,11 +122,11 @@ if (majorVersion) {
renameSync('package.json', 'package.json.bak');
renameSync('package.json.upgrading-chromedriver', 'package.json');

console.log(`Backed up package.json and updated chromedriver to ${majorVersion}`);
console.log(`Backed up package.json and updated chromedriver to ${targetVersion}`);
} else {
unlinkSync('package.json.upgrading-chromedriver');
console.error(
`Failed to update chromedriver to ${majorVersion}. Try adding the \`--install\` switch.`
`Failed to update chromedriver to ${targetVersion}. Try adding the \`--install\` switch.`
);
}
});
Expand Down