Skip to content

Commit

Permalink
fix(chromedriver): get most recent version on x64 windows if multiple…
Browse files Browse the repository at this point in the history
… major versions exist (#473)

* Update spec/binaries/chrome_xml_spec.ts
* Update chrome_xml_spec.ts

Co-authored-by: Bobby Earl <bobby.earl@blackbaud.com>
Co-authored-by: Kurt Legerlotz <legerlotz@gmail.com>
Co-authored-by: Craig Nishina <cnishina@users.noreply.github.com>
  • Loading branch information
4 people authored Jan 9, 2021
1 parent 17db8a2 commit 4f5f736
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/binaries/chrome_xml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,11 @@ export class ChromeXml extends XmlConfigSource {
// If the semantic version is the same, check os arch.
// For 64-bit systems, prefer the 64-bit version.
else if (this.osarch === 'x64') {
if (item.includes(this.getOsTypeName() + '64')) {
// No win64 version exists, so even on x64 we need to look for win32
const osTypeNameAndArch =
this.getOsTypeName() + (this.getOsTypeName() === 'win' ? '32' : '64');

if (item.includes(osTypeNameAndArch)) {
itemFound = item;
}
}
Expand Down
13 changes: 13 additions & 0 deletions spec/binaries/chrome_xml_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,19 @@ describe('chrome xml reader', () => {
});
});

// This test case covers a bug when all the following conditions were true.
// arch was 64 with multiple major versions available.
it('should not get the 85.0.4183.38, 32-bit version (arch = x64)', (done) => {
let chromeXml = new ChromeXml();
chromeXml.out_dir = out_dir;
chromeXml.ostype = 'Windows_NT';
chromeXml.osarch = 'x64';
chromeXml.getUrl('85.0.4183.87').then((binaryUrl) => {
expect(binaryUrl.url).toContain('85.0.4183.87/chromedriver_win32.zip');
done();
});
});

it('should get the 87.0.4280.88, 64-bit, m1 version (arch = arm64)', (done) => {
let chromeXml = new ChromeXml();
chromeXml.out_dir = out_dir;
Expand Down

0 comments on commit 4f5f736

Please sign in to comment.