Skip to content

Commit

Permalink
fix(gecko): Update geckodriver to 0.11.0 and fix suffixes. (#128)
Browse files Browse the repository at this point in the history
Fixes #111
  • Loading branch information
heathkit authored Nov 4, 2016
1 parent 707e015 commit 88d6105
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 17 deletions.
2 changes: 1 addition & 1 deletion config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"webdriverVersions": {
"selenium": "2.53.1",
"chromedriver": "2.25",
"geckodriver": "v0.9.0",
"geckodriver": "v0.11.1",
"iedriver": "2.53.1",
"androidsdk": "24.4.1",
"appium": "1.6.0"
Expand Down
41 changes: 34 additions & 7 deletions lib/binaries/gecko_driver.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
import * as path from 'path';
import * as semver from 'semver';

import {Config} from '../config';

import {Binary, OS} from './binary';

type StringMap = {
[key: string]: string
};
type SuffixMap = {
[key: string]: StringMap
};

/**
* The gecko driver binary.
*/
Expand All @@ -14,10 +22,13 @@ export class GeckoDriver extends Binary {
static isDefault = true;
static shortName = ['gecko'];

static suffixes: {[key: string]: string} = {
'Darwin': '-mac.tar.gz',
'Linux': '-linux64.tar.gz',
'Windows_NT': '-win64.zip'
private static suffixes: SuffixMap = {
'Darwin': {'x64': '-macos.tar.gz'},
'Linux': {'x64': '-linux64.tar.gz', 'ia32': '-linux32.tar.gz'},
'Windows_NT': {
'x64': '-win64.zip',
'ia32': '-win32.zip',
}
};

constructor(alternateCDN?: string) {
Expand All @@ -37,15 +48,31 @@ export class GeckoDriver extends Binary {
}

suffix(ostype: string, arch: string): string {
if (!GeckoDriver.supports(ostype, arch)) {
if (!GeckoDriver.suffixes[ostype][arch]) {
throw new Error('GeckoDriver doesn\'t support ${ostype} ${arch}!');
}

return GeckoDriver.suffixes[ostype];
let version: string = this.version();

// No 32-bit builds before 0.10.0
if (semver.lte(version, '0.10.0')) {
if (arch === 'x64') {
throw new Error('GeckoDriver doesn\'t support ${ostype} ${arch}!');
}
}

// Special case old versions on Mac for the name change.
if (semver.lte(version, '0.9.0')) {
if (ostype === 'Darwin') {
return '-mac.tar.gz';
}
}

return GeckoDriver.suffixes[ostype][arch];
}

static supports(ostype: string, arch: string): boolean {
return arch == 'x64' && (ostype in GeckoDriver.suffixes);
return !!GeckoDriver.suffixes[ostype][arch];
}

url(ostype: string, arch: string): string {
Expand Down
13 changes: 4 additions & 9 deletions lib/cmds/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,13 @@ let prog = new Program()
.addOption(Opts[Opt.ALTERNATE_CDN])
.addOption(Opts[Opt.STANDALONE])
.addOption(Opts[Opt.CHROME])
.addOption(Opts[Opt.GECKO])
.addOption(Opts[Opt.ANDROID])
.addOption(Opts[Opt.ANDROID_API_LEVELS])
.addOption(Opts[Opt.ANDROID_ARCHITECTURES])
.addOption(Opts[Opt.ANDROID_PLATFORMS])
.addOption(Opts[Opt.ANDROID_ACCEPT_LICENSES]);

if (GeckoDriver.supports(os.type(), os.arch())) {
prog.addOption(Opts[Opt.VERSIONS_GECKO]).addOption(Opts[Opt.GECKO]);
}

if (os.type() === 'Darwin') {
prog.addOption(Opts[Opt.IOS]);
}
Expand All @@ -47,7 +44,8 @@ if (os.type() === 'Windows_NT') {
prog.addOption(Opts[Opt.VERSIONS_STANDALONE])
.addOption(Opts[Opt.VERSIONS_CHROME])
.addOption(Opts[Opt.VERSIONS_APPIUM])
.addOption(Opts[Opt.VERSIONS_ANDROID]);
.addOption(Opts[Opt.VERSIONS_ANDROID])
.addOption(Opts[Opt.VERSIONS_GECKO]);

if (os.type() === 'Windows_NT') {
prog.addOption(Opts[Opt.VERSIONS_IE]);
Expand All @@ -70,10 +68,7 @@ if (argv._[0] === 'update-run') {
function update(options: Options): void {
let standalone = options[Opt.STANDALONE].getBoolean();
let chrome = options[Opt.CHROME].getBoolean();
let gecko = false;
if (GeckoDriver.supports(os.type(), os.arch())) {
gecko = options[Opt.GECKO].getBoolean();
}
let gecko = options[Opt.GECKO].getBoolean();
let ie: boolean = false;
let ie32: boolean = false;
if (options[Opt.IE]) {
Expand Down

0 comments on commit 88d6105

Please sign in to comment.