From f3be1727cf95dea50b597d20c6510e62a605dee2 Mon Sep 17 00:00:00 2001 From: Julie Date: Fri, 22 Nov 2013 11:04:45 -0800 Subject: [PATCH] fix(runner): running with chromeOnly should try to find chromedriver with .exe extension Closes #283 --- example/chromeOnlyConf.js | 21 +++++++++++++++++++++ lib/runner.js | 7 +++++++ 2 files changed, 28 insertions(+) create mode 100644 example/chromeOnlyConf.js diff --git a/example/chromeOnlyConf.js b/example/chromeOnlyConf.js new file mode 100644 index 000000000..6b2bab582 --- /dev/null +++ b/example/chromeOnlyConf.js @@ -0,0 +1,21 @@ +// An example configuration file. +exports.config = { + // Do not start a Selenium Standalone sever - only run this using chrome. + chromeOnly: true, + chromeDriver: './selenium/chromedriver', + + // Capabilities to be passed to the webdriver instance. + capabilities: { + 'browserName': 'chrome' + }, + + // Spec patterns are relative to the current working directly when + // protractor is called. + specs: ['example_spec.js'], + + // Options to be passed to Jasmine-node. + jasmineNodeOpts: { + showColors: true, + defaultTimeoutInterval: 30000 + } +}; diff --git a/lib/runner.js b/lib/runner.js index ae820d36e..b9c187d8d 100644 --- a/lib/runner.js +++ b/lib/runner.js @@ -201,6 +201,13 @@ var runJasmineTests = function() { var runDeferred = webdriver.promise.defer(); if (config.chromeOnly) { + if (!fs.existsSync(config.chromeDriver)) { + if (fs.existsSync(config.chromeDriver + '.exe')) { + config.chromeDriver += '.exe'; + } else { + throw 'Could not find chromedriver at ' + config.chromeDriver; + } + } var service = new chrome.ServiceBuilder(config.chromeDriver).build(); driver = chrome.createDriver( new webdriver.Capabilities(config.capabilities), service);