Skip to content

Commit 9903d6c

Browse files
committed
fix(ie): Use 32-bit version by default for IEDriver
closes angular#180
1 parent 0dae035 commit 9903d6c

File tree

9 files changed

+32
-22
lines changed

9 files changed

+32
-22
lines changed

lib/binaries/binary.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ export interface BinaryMap<T extends Binary> { [id: string]: T; }
2121
export class Binary {
2222
static os: OS[]; // the operating systems, the binary can run on
2323
static id: string; // the binaries key identifier
24-
static isDefault: boolean; // to download by default
2524
static versionDefault: string; // a static default version variable
2625
static shortName: string[]; // the names used for a binary download
2726
name: string; // used for logging to console

lib/binaries/ie_driver.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ export class IEDriver extends Binary {
1010
static os = [OS.Windows_NT];
1111
static id = 'ie';
1212
static versionDefault = Config.binaryVersions().ie;
13-
static isDefault = false;
13+
static isDefault32 = false;
14+
static isDefault64 = false;
1415
static shortName = ['ie', 'ie32'];
1516

1617
constructor(alternateCDN?: string) {

lib/cmds/initialize.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,9 @@ export function android(
245245
'android-sdk: Downloading more additional SDK updates ' +
246246
'(this may take a while)');
247247
return downloadAndroidUpdates(
248-
sdkPath, ['build-tools-24.0.0'].concat(
249-
getAndroidSDKTargets(apiLevels, architectures, platforms, oldAVDs)),
248+
sdkPath,
249+
['build-tools-24.0.0'].concat(
250+
getAndroidSDKTargets(apiLevels, architectures, platforms, oldAVDs)),
250251
true, acceptLicenses, verbose);
251252
})
252253
.then(() => {

lib/cmds/opts.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export const STANDALONE = 'standalone';
1313
export const CHROME = 'chrome';
1414
export const IE = 'ie';
1515
export const IE32 = 'ie32';
16+
export const IE64 = 'ie64';
1617
export const EDGE = 'edge';
1718
export const GECKO = 'gecko';
1819
export const ANDROID = 'android';
@@ -58,8 +59,12 @@ opts[STANDALONE] = new Option(
5859
opts[CHROME] =
5960
new Option(CHROME, 'Install or update chromedriver', 'boolean', ChromeDriver.isDefault);
6061
opts[GECKO] = new Option(GECKO, 'Install or update geckodriver', 'boolean', GeckoDriver.isDefault);
61-
opts[IE] = new Option(IE, 'Install or update ie driver', 'boolean', IEDriver.isDefault);
62-
opts[IE32] = new Option(IE32, 'Install or update 32-bit ie driver', 'boolean', IEDriver.isDefault);
62+
opts[IE] = new Option(IE, 'Install or update 32-bit ie driver', 'boolean', IEDriver.isDefault32);
63+
opts[IE32] =
64+
new Option(IE32, 'Install or update 32-bit ie driver', 'boolean', IEDriver.isDefault32);
65+
opts[IE64] = new Option(
66+
IE64, 'Update: install or update 64-bit IE driver. Start: use installed x64 IE driver.',
67+
'boolean', IEDriver.isDefault64);
6368
opts[EDGE] = new Option(
6469
EDGE, 'Use installed Microsoft Edge driver', 'string',
6570
'C:\\Program Files (x86)\\Microsoft Web Driver\\MicrosoftWebDriver.exe');
@@ -105,7 +110,8 @@ opts[STARTED_SIGNIFIER] = new Option(
105110
'A string to be outputted once the selenium server is up and running. Useful if you are writing a script which uses webdriver-manager.',
106111
'string');
107112
opts[SIGNAL_VIA_IPC] = new Option(
108-
SIGNAL_VIA_IPC, 'If you are using --' + STARTED_SIGNIFIER +
113+
SIGNAL_VIA_IPC,
114+
'If you are using --' + STARTED_SIGNIFIER +
109115
', this flag will emit the signal string using process.send(), rather than writing it to stdout',
110116
'boolean', false);
111117
opts[DETACH] = new Option(

lib/cmds/start.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,7 @@ if (Config.osType() === 'Darwin') {
4343
}
4444

4545
if (Config.osType() === 'Windows_NT') {
46-
prog.addOption(Opts[Opt.VERSIONS_IE])
47-
.addOption(Opts[Opt.IE32])
48-
.addOption(Opts[Opt.IE])
49-
.addOption(Opts[Opt.EDGE]);
46+
prog.addOption(Opts[Opt.VERSIONS_IE]).addOption(Opts[Opt.IE64]).addOption(Opts[Opt.EDGE]);
5047
}
5148

5249
export var program = prog;
@@ -153,8 +150,9 @@ function start(options: Options) {
153150
path.resolve(outputDir, binaries[GeckoDriver.id].executableFilename(osType)));
154151
}
155152
if (downloadedBinaries[IEDriver.id] != null) {
156-
if (options[Opt.IE32].getBoolean()) {
157-
binaries[IEDriver.id].arch = 'Win32';
153+
binaries[IEDriver.id].arch = 'Win32'; // use Win 32 by default
154+
if (options[Opt.IE64].getBoolean()) {
155+
binaries[IEDriver.id].arch = Config.osArch(); // use the system architecture
158156
}
159157
args.push(
160158
'-Dwebdriver.ie.driver=' +

lib/cmds/status.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ function status(options: Options) {
5959
updateConfig = {};
6060
}
6161

62-
6362
let downloadedBinaries = FileManager.downloadedBinaries(outputDir);
63+
6464
// Log which binaries have been downloaded.
6565
for (let bin in downloadedBinaries) {
6666
let downloaded = downloadedBinaries[bin];

lib/cmds/update.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ if (Config.osType() === 'Darwin') {
3939
}
4040

4141
if (Config.osType() === 'Windows_NT') {
42-
prog.addOption(Opts[Opt.IE]).addOption(Opts[Opt.IE32]);
42+
prog.addOption(Opts[Opt.IE]).addOption(Opts[Opt.IE32]).addOption(Opts[Opt.IE64]);
4343
}
4444

4545
prog.addOption(Opts[Opt.VERSIONS_STANDALONE])
@@ -72,13 +72,16 @@ function update(options: Options): Promise<void> {
7272
let standalone = options[Opt.STANDALONE].getBoolean();
7373
let chrome = options[Opt.CHROME].getBoolean();
7474
let gecko = options[Opt.GECKO].getBoolean();
75-
let ie: boolean = false;
7675
let ie32: boolean = false;
76+
let ie64: boolean = false;
7777
if (options[Opt.IE]) {
78-
ie = options[Opt.IE].getBoolean();
78+
ie32 = ie32 || options[Opt.IE].getBoolean();
7979
}
8080
if (options[Opt.IE32]) {
81-
ie32 = options[Opt.IE32].getBoolean();
81+
ie32 = ie32 || options[Opt.IE32].getBoolean();
82+
}
83+
if (options[Opt.IE64]) {
84+
ie64 = options[Opt.IE64].getBoolean();
8285
}
8386
let android: boolean = options[Opt.ANDROID].getBoolean();
8487
let ios: boolean = false;
@@ -150,7 +153,7 @@ function update(options: Options): Promise<void> {
150153
updateBrowserFile(binary, outputDir);
151154
promises.push(updateBinary(binary, outputDir, proxy, ignoreSSL));
152155
}
153-
if (ie) {
156+
if (ie64) {
154157
let binary = binaries[IEDriver.id];
155158
binary.arch = Config.osArch(); // Win32 or x64
156159
updateBrowserFile(binary, outputDir);

lib/files/file_manager.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,11 @@ export class FileManager {
122122
}
123123
// if the suffix does not match the executable,
124124
// the binary is something like: .exe and .zip
125-
else if (existFile.indexOf(binary.suffix(osType, arch)) === -1) {
125+
// TODO(cnishina): fix implementation. Suffix method is dependent on the version number
126+
// example: chromedriver < 2.23 has a different suffix than 2.23+ (mac32.zip vs mac64.zip).
127+
else if (
128+
!existFile.endsWith('.zip') && !existFile.endsWith('.tar.gz') &&
129+
existFile.indexOf(binary.suffix(osType, arch)) === -1) {
126130
editExistFile = editExistFile.replace(binary.executableSuffix(osType), '');
127131
editExistFile = editExistFile.indexOf('_') === 0 ?
128132
editExistFile.substring(1, editExistFile.length) :

spec/cmds/status_spec.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ describe('status', () => {
1818
// geckodriver {{config version}} [last] [default]
1919
// standalone 2.24 [last], {{config version}} [default]
2020
beforeAll((done) => {
21-
Config.osType_ = 'Linux';
22-
Config.osArch_ = 'x64';
2321
argv = {
2422
'_': ['update'],
2523
'versions': {'chrome': '2.24', 'standalone': '2.44.0'},

0 commit comments

Comments
 (0)