From d65bdfc5ddaf5badd38ddf724ba84617692cf97e Mon Sep 17 00:00:00 2001 From: mgiambalvo Date: Wed, 18 Jan 2017 14:29:20 -0800 Subject: [PATCH] fix(firefox): Fix directConnect for Firefox 51+ (#3953) --- circle.yml | 11 +++++++++-- lib/driverProviders/direct.ts | 24 ++++++++++++++++++------ spec/ciFullConf.js | 1 - spec/ciSmokeConf.js | 12 +++--------- spec/directConnectConf.js | 1 - 5 files changed, 30 insertions(+), 19 deletions(-) diff --git a/circle.yml b/circle.yml index ac8837645..49977f994 100644 --- a/circle.yml +++ b/circle.yml @@ -14,11 +14,18 @@ dependencies: post: - ./node_modules/.bin/gulp lint - ./node_modules/.bin/webdriver-manager update - - ./node_modules/.bin/webdriver-manager start: - background: true + - wget http://selenium-release.storage.googleapis.com/3.0-beta4/selenium-server-standalone-3.0.0-beta4.jar -P ./node_modules/webdriver-manager/selenium + - ./node_modules/.bin/webdriver-manager start --versions.standalone 3.0.0-beta4: + background: true - cd testapp && npm update - npm start: background: true + # Install the latest Firefox beta + - pip install mozdownload mozinstall + - mozdownload --version latest-beta --destination firefox.tar.bz2 + - mozinstall firefox.tar.bz2 + - sudo cp -R firefox/* /opt/firefox/ + # Extra tcp logging for BlockingProxy - sudo tcpdump -i lo 'tcp && dst localhost' -w $CIRCLE_ARTIFACTS/localdump.pcap: background: true diff --git a/lib/driverProviders/direct.ts b/lib/driverProviders/direct.ts index eb7bf075a..ad8bf4254 100644 --- a/lib/driverProviders/direct.ts +++ b/lib/driverProviders/direct.ts @@ -90,14 +90,26 @@ export class Direct extends DriverProvider { .Driver.createSession(new Capabilities(this.config_.capabilities), chromeService); break; case 'firefox': - if (this.config_.firefoxPath) { - this.config_.capabilities['firefox_binary'] = this.config_.firefoxPath; + let geckoDriverFile: string; + try { + let updateJson = path.resolve(SeleniumConfig.getSeleniumDir(), 'update-config.json'); + let updateConfig = JSON.parse(fs.readFileSync(updateJson).toString()); + geckoDriverFile = updateConfig.gecko.last; + } catch (e) { + throw new BrowserError( + logger, + 'Could not find update-config.json. ' + + 'Run \'webdriver-manager update\' to download binaries.'); } - // TODO(cnishina): Add in a service builder with marionette. Direct connect - // currently supports FF legacy version 47. - driver = require('selenium-webdriver/firefox') - .Driver.createSession(new Capabilities(this.config_.capabilities)); + // TODO (mgiambalvo): Turn this into an import when the selenium typings are updated. + const FirefoxServiceBuilder = require('selenium-webdriver/firefox').ServiceBuilder; + + let firefoxService = new FirefoxServiceBuilder(geckoDriverFile).build(); + // TODO(mgiambalvo): Fix typings. + driver = + require('selenium-webdriver/firefox') + .Driver.createSession(new Capabilities(this.config_.capabilities), firefoxService); break; default: throw new BrowserError( diff --git a/spec/ciFullConf.js b/spec/ciFullConf.js index 58e7b433d..38ec8a2d6 100644 --- a/spec/ciFullConf.js +++ b/spec/ciFullConf.js @@ -32,7 +32,6 @@ exports.config = { 'build': process.env.TRAVIS_BUILD_NUMBER, 'name': 'Protractor suite tests', 'version': '47', - 'selenium-version': '2.53.1' }], baseUrl: env.baseUrl + '/ng1/', diff --git a/spec/ciSmokeConf.js b/spec/ciSmokeConf.js index bdabdd295..b49ff61eb 100644 --- a/spec/ciSmokeConf.js +++ b/spec/ciSmokeConf.js @@ -23,17 +23,15 @@ exports.config = { 'tunnel-identifier': process.env.TRAVIS_JOB_NUMBER, 'build': process.env.TRAVIS_BUILD_NUMBER, 'name': 'Protractor smoke tests', - 'version': '54', - 'selenium-version': '2.53.1', - 'chromedriver-version': '2.26', + 'version': '55', + 'chromedriver-version': '2.27', 'platform': 'OS X 10.11' }, { 'browserName': 'firefox', 'tunnel-identifier': process.env.TRAVIS_JOB_NUMBER, 'build': process.env.TRAVIS_BUILD_NUMBER, 'name': 'Protractor smoke tests', - 'version': '47', - 'selenium-version': '2.53.1' + 'version': 'beta' }, { // TODO: Add Safari 10 once Saucelabs gets Selenium 3 'browserName': 'safari', @@ -41,15 +39,12 @@ exports.config = { 'build': process.env.TRAVIS_BUILD_NUMBER, 'name': 'Protractor smoke tests', 'version': '9', - 'selenium-version': '2.44.0' // Use an old version because Safari has - // issues loading pages after 2.44. }, { 'browserName': 'MicrosoftEdge', 'tunnel-identifier': process.env.TRAVIS_JOB_NUMBER, 'build': process.env.TRAVIS_BUILD_NUMBER, 'name': 'Protractor smoke tests', 'version': '14.14393', - 'selenium-version': '2.53.1', 'platform': 'Windows 10' }, { 'browserName': 'Internet Explorer', @@ -57,7 +52,6 @@ exports.config = { 'build': process.env.TRAVIS_BUILD_NUMBER, 'name': 'Protractor smoke tests', 'version': '11', - 'selenium-version': '2.53.1', 'platform': 'Windows 8.1' }], diff --git a/spec/directConnectConf.js b/spec/directConnectConf.js index a63205475..a667f4167 100644 --- a/spec/directConnectConf.js +++ b/spec/directConnectConf.js @@ -9,7 +9,6 @@ exports.config = { 'browserName': 'chrome' }, { 'browserName': 'firefox', - 'marionette': false }], baseUrl: env.baseUrl + '/ng1/',