Angular-cli: ng e2e breaks moving from ChromeDriver 2.38 to 2.39

Created on 5 Jun 2018  路  10Comments  路  Source: angular/angular-cli

ng e2e command fails on a Bitbucket Pipelines build when moving from ChromeDriver 2.38 to 2.39:

Output:

webpack: Compiled successfully.
[14:52:57] I/file_manager - creating folder /opt/atlassian/pipelines/agent/build/node_modules/protractor/node_modules/webdriver-manager/selenium
[14:52:57] I/update - chromedriver: unzipping chromedriver_2.39.zip
[14:52:57] I/update - chromedriver: setting permissions to 0755 for /opt/atlassian/pipelines/agent/build/node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver_2.39
[14:52:57] I/launcher - Running 1 instances of WebDriver
[14:52:57] I/direct - Using ChromeDriver directly...
[14:53:58] E/launcher - unknown error: Devtools port number file contents <36661> were in an unexpected format
  (Driver info: chromedriver=2.39.562737 (dba483cee6a5f15e2e2d73df16968ab10b38a2bf),platform=Linux 4.14.42-coreos x86_64)
[14:53:58] E/launcher - WebDriverError: unknown error: Devtools port number file contents <36661> were in an unexpected format
  (Driver info: chromedriver=2.39.562737 (dba483cee6a5f15e2e2d73df16968ab10b38a2bf),platform=Linux 4.14.42-coreos x86_64)
    at Object.checkLegacyResponse (/opt/atlassian/pipelines/agent/build/node_modules/selenium-webdriver/lib/error.js:505:15)
    at parseHttpResponse (/opt/atlassian/pipelines/agent/build/node_modules/selenium-webdriver/lib/http.js:509:13)
    at doSend.then.response (/opt/atlassian/pipelines/agent/build/node_modules/selenium-webdriver/lib/http.js:440:13)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
From: Task: WebDriver.createSession()
    at Function.createSession (/opt/atlassian/pipelines/agent/build/node_modules/selenium-webdriver/lib/webdriver.js:777:24)
    at Function.createSession (/opt/atlassian/pipelines/agent/build/node_modules/selenium-webdriver/chrome.js:709:29)
    at Direct.getNewDriver (/opt/atlassian/pipelines/agent/build/node_modules/protractor/lib/driverProviders/direct.ts:90:25)
    at Runner.createBrowser (/opt/atlassian/pipelines/agent/build/node_modules/protractor/lib/runner.ts:225:39)
    at q.then.then (/opt/atlassian/pipelines/agent/build/node_modules/protractor/lib/runner.ts:391:27)
    at _fulfilled (/opt/atlassian/pipelines/agent/build/node_modules/protractor/node_modules/q/q.js:834:54)
    at self.promiseDispatch.done (/opt/atlassian/pipelines/agent/build/node_modules/protractor/node_modules/q/q.js:863:30)
    at Promise.promise.promiseDispatch (/opt/atlassian/pipelines/agent/build/node_modules/protractor/node_modules/q/q.js:796:13)
    at /opt/atlassian/pipelines/agent/build/node_modules/protractor/node_modules/q/q.js:556:49
    at runSingle (/opt/atlassian/pipelines/agent/build/node_modules/protractor/node_modules/q/q.js:137:13)
    at flush (/opt/atlassian/pipelines/agent/build/node_modules/protractor/node_modules/q/q.js:125:13)
    at _combinedTickCallback (internal/process/next_tick.js:131:7)
    at process._tickCallback (internal/process/next_tick.js:180:9)
[14:53:58] E/launcher - Process exited with error code 199

Pipelines Configuration:

# This is a sample build configuration for JavaScript.
# Check our guides at https://confluence.atlassian.com/x/14UWN for more examples.
# Only use spaces to indent your .yml configuration.
# -----
# You can specify a custom docker image from Docker Hub as your build environment.
image: node:8.11.1

pipelines:
  default:
    - step:
        #caches:
          #- node
        script: # Modify the commands below to build your repository.
          - apt-get update && apt-get install -y chromium
          - export CHROME_BIN=/usr/bin/chromium
          - npm install
          - npm install -g @angular/cli
          - npm test --watch=false
          - ng e2e

Protractor Configuration:

// Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/lib/config.ts

const { SpecReporter } = require('jasmine-spec-reporter');

exports.config = {
  allScriptsTimeout: 11000,
  specs: [
    './e2e/**/*.e2e-spec.ts'
  ],
  capabilities: {
    'browserName': 'chrome',
    chromeOptions: {
      args: [ "--headless", "--disable-gpu" ]
    }
  },
  directConnect: true,
  baseUrl: 'http://localhost:4200/',
  framework: 'jasmine',
  jasmineNodeOpts: {
    showColors: true,
    defaultTimeoutInterval: 30000,
    print: function() {}
  },
  onPrepare() {
    require('ts-node').register({
      project: 'e2e/tsconfig.e2e.json'
    });
    jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
  }
};
docs

Most helpful comment

In CI environments it's a good idea to to use a specific version of chrome driver instead of allowing ng e2e to use the latest one. CI environments often use older versions of chrome, which are unsupported by newer versions of chrome driver.

An easy way to do this is to define a NPM script:

"webdriver-update-ci": "webdriver-manager update --standalone false --gecko false --versions.chrome 2.37",

And then on CI environments you call that script followed by the e2e command without updating webdriver:

npm run webdriver-update-ci
ng e2e --webdriver-update=false

This way you will always use a specific version of chrome driver between runs.

We should add this to our CI docs.

All 10 comments

I'm getting this issue too.

Adding "test:e2e": "webdriver-manager update --versions.chrome 2.37; protractor protractor.conf.js" to worked for me

Same issue

@smasala What file and file location did you add that configuration?

@ErikAugust package json. Simply run the node webdriver-manager command before you run protractor

In CI environments it's a good idea to to use a specific version of chrome driver instead of allowing ng e2e to use the latest one. CI environments often use older versions of chrome, which are unsupported by newer versions of chrome driver.

An easy way to do this is to define a NPM script:

"webdriver-update-ci": "webdriver-manager update --standalone false --gecko false --versions.chrome 2.37",

And then on CI environments you call that script followed by the e2e command without updating webdriver:

npm run webdriver-update-ci
ng e2e --webdriver-update=false

This way you will always use a specific version of chrome driver between runs.

We should add this to our CI docs.

Thank you @filipesilva! This information helped me out a lot. Was running a CI build in a docker container with an older version (of Chromium technically).

This could become a blocker for developers who have auto update enabled for chrome. For the time being driver version 2.38 works fine up to chrome version v67. But once chrome 2.38 is out e2e will start failing. thoughts?

This works for me. Thanks!

npx webdriver-manager clean 
npx webdriver-manager update --versions.chrome=2.42 
ng e2e --webdriver-update=false

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

JanStureNielsen picture JanStureNielsen  路  3Comments

ericel picture ericel  路  3Comments

donaldallen picture donaldallen  路  3Comments

IngvarKofoed picture IngvarKofoed  路  3Comments

sysmat picture sysmat  路  3Comments