7

After upgrading to Protractor 4.0.0 and adjusting the config because of the breaking changes, we finally have our tests launching.

Now, the problem is that after a test run it fails with:

[09:52:22] E/launcher - "process.on('uncaughtException'" error, see launcher
[09:52:22] E/launcher - Process exited with error code 199

How to debug this problem and understand what is causing it?


Tried to run Protractor in "troubleshoot" mode:

$ protractor config/local.conf.js --troubleshoot

but got exactly the same output with no details about the error.

alecxe
  • 462,703
  • 120
  • 1,088
  • 1,195
  • I'm getting this exact same error, but only with firefox for what it's worth. After upgrading to 4.0.0, I ran protractor/bin/webdriver-manager update and got the latest chrome-driver and the launcher is working fine with chrome. I am running on a mac. – sporkthrower Jul 15 '16 at 22:12
  • try using elementor npm library. It is really helpful for creating protractor tests. – Dejan Toteff Jul 16 '16 at 12:47
  • Even I am getting this error after i upgraded to 4.0.0. – Ram Pasala Jul 16 '16 at 16:35
  • @alecxe did you raise this in protractor github forum? this seems to be an issue, I am getting this with both chrome & firefox. I did some research, it is a node event uncaught exception error. my understanding of nodejs is limited that is why I am unable to handle it. I found this http://stackoverflow.com/questions/4213351/make-node-js-not-exit-on-error but not sure how to approach this problem! – Ram Pasala Jul 17 '16 at 08:21
  • @igniteram1 not yet, trying to gather more information and gain understanding of the problem. I've reinstalled everything from scratch, removed the `protractor-jasmine2-screenshot-reporter` (though I doubt it is relevant). Executed `node_modules/.bin/webdriver-manager update`. And, it started to work after it. Weird. – alecxe Jul 17 '16 at 12:19

5 Answers5

11

This is currently being fixed and there should be a hot fix out soon. The quick fix (before the hot fix is released) is to change the code in your node_modules or revert to 3.3.0.

Edit node_modules/protractor/built/launcher.js replace the uncaughtException at line 168 with:

    process.on('uncaughtException', function (e) {
    var errorCode = exitCodes_1.ErrorHandler.parseError(e);
    if (errorCode) {
        var protractorError = e;
        exitCodes_1.ProtractorError.log(logger, errorCode, protractorError.message, protractorError.stack);
        process.exit(errorCode);
    }
    else {
        logger.error(e.message);
        logger.error(e.stack);
        process.exit(exitCodes_1.ProtractorError.CODE);
    }
});
alecxe
  • 462,703
  • 120
  • 1,088
  • 1,195
cnishina
  • 5,016
  • 1
  • 23
  • 40
3

Upgrading to protractor 4.0.10 seems to solve it.

There were several fixes from 4.0.0 to 4.0.10 in the launcher. See changelog: https://github.com/angular/protractor/blob/master/CHANGELOG.md

Elad Tabak
  • 2,317
  • 4
  • 23
  • 33
0

Still not sure what was happening and what is the best way to debug problems like this, but here is what I've done to fix it:

  • removed node_modules completely
  • executed npm install (protractor is listed as ^4.0.0 in package.json)
  • executed node_modules/.bin/webdriver-manager update

And now it works, it does not throw the uncaughtException anymore.


I've also removed the protractor-jasmine2-screenshot-reporter, but I don't think it is relevant.

Also, we've been using grunt-protractor-runner to run Protractor tests from a grunt task and I had to fork it and update protractor dependency to 4.0.0.

alecxe
  • 462,703
  • 120
  • 1,088
  • 1,195
0

Solution for modify node_modules/protractor/built/launcher.js works.

There might be a error saying "E/launcher - unknown error: Chrome version must be >= 53.0.2785.0" which just need to update your chrome version

renzherl
  • 161
  • 1
  • 3
0

I've been using grunt-protractor-runner 4.0.0. I was testing specific test files and received this error after I noticed that I accidentally commented out all the files in the specs array in my protractor.conf.js file.

specs:
[
  //'test1-spec.js',
  //'test2-spec.js'
]

Hopefully this silly mistake helps someone.

Ben
  • 2,441
  • 1
  • 12
  • 16