Search code examples
angularseleniumselenium-webdriverprotractore2e-testing

Unable to start e2e tesing in angular project


Running e2e testing on my angular project throws.

My chrome version : Version 87.0.4280.141 (Official Build) (x86_64)

I have enabled auto-update in my chrome browser. Seems like the issue occurs after the browser update.

ng e2e

Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'myhost', ip: 'myip', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.13.6', java.version: '15.0.1'
Driver info: driver.version: unknown
[17:00:29] E/launcher - WebDriverError: Timed out waiting for driver server to start.
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'myhost', ip: 'myip', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.13.6', java.version: '15.0.1'
Driver info: driver.version: unknown
    at Object.checkLegacyResponse (my-project/node_modules/selenium-webdriver/lib/error.js:546:15)
    at parseHttpResponse (my-project/node_modules/selenium-webdriver/lib/http.js:509:13)
    at my-project/node_modules/selenium-webdriver/lib/http.js:441:30
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
From: Task: WebDriver.createSession()
    at Function.createSession (my-project/node_modules/selenium-webdriver/lib/webdriver.js:769:24)
    at Function.createSession (my-project/node_modules/selenium-webdriver/chrome.js:761:15)
    at createDriver (my-project/node_modules/selenium-webdriver/index.js:170:33)
    at Builder.build (my-project/node_modules/selenium-webdriver/index.js:626:16)
    at Local.getNewDriver (my-project/node_modules/protractor/built/driverProviders/driverProvider.js:53:33)
    at Runner.createBrowser (my-project/node_modules/protractor/built/runner.js:195:43)
    at my-project/node_modules/protractor/built/runner.js:339:29
    at _fulfilled (my-project/node_modules/q/q.js:834:54)
    at my-project/node_modules/q/q.js:863:30
    at Promise.promise.promiseDispatch (my-project/node_modules/q/q.js:796:13)
[17:00:29] E/launcher - Process exited with error code 199

my protractor config file.

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

exports.config = {
  allScriptsTimeout: 11000,
  specs: [
    './e2e/**/*.e2e-spec.ts'
  ],
  capabilities: {
    'browserName': 'chrome',
    'chromeOptions': {
      args: [ "--no-sandbox", "--headless", "--disable-gpu", "--window-size=1600,900" ]
    }
  },
  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 } }));
  }
};

Please help.


Solution

  • Finally, I fixed the issue by editing node_modules/webdriver-manager/built/lib/files/file_manager.js

    Update file_manager.js #line-no-166 fileUrl.url = fileUrl.url.replace(/_m1/, '');

    Github issue: https://github.com/angular/webdriver-manager/issues/476