1

I have been trying to testing my angular app using protractor and cucumber, but when i use mocha for create a expectation when the expectation it's false the error spec doesn't show in the console.

The relevant HTML for the route http://localhost:9000/#/form29/form29'

...

<h4 class="title">
  The title
</h4>

...

And my step file it is:

//form29_steps.js

var chai = require('chai'),
        chaiAsPromised = require('chai-as-promised'),
        assert;

chai.use(chaiAsPromised);
expect = chai.expect;

module.exports = function () {

    this.Given(/^I am in the form 29 page$/, function (done) {
      browser.get('http://localhost:9000/#/form29/form29');
      done();
    });

    this.Then(/^should be the title "(.*)"/,function(title, done){
        var el = element(by.css('.title'));

        el.getText().then(function(text){
            //a false expect
            expect(title).to.eq('Aaaaa');
            done();
        });

    });

}; 

when the expect its valid its ok, but when the expect failed there aren't a expect failed error and show the following:

[16:14:08] E/launcher - "process.on('uncaughtException'" error, see launcher
[16:14:08] E/launcher - Process exited with error code 199

When i try the same but not using promised this works well

this.Then(/^should be the title "(.*)"/,function(title, done){
    var el = element(by.css('.title'));

    expect(title).to.eq('A');
    done(); 
});

I get the error that i wish:

Message:
     AssertionError: expected 'Formulario 29' to equal 'A'
         at World.<anonymous> (/protractor/test/e2e/features/step_definitions/form29_steps.js:18:20)
         at _combinedTickCallback (internal/process/next_tick.js:67:7)
         at process._tickCallback (internal/process/next_tick.js:98:9)

Why happen this?

  • The uncaught exception can mean different things, but [I had it recently](http://stackoverflow.com/questions/38397965/uncaughtexception-after-a-protractor-run). – alecxe Jul 18 '16 at 16:51

1 Answers1

2
[16:14:08] E/launcher - "process.on('uncaughtException'" error, see launcher
[16:14:08] E/launcher - Process exited with error code 199

The above error can be caused due to various reasons mostly related to promises. But it should throw the correct message. There is already a work around provided here https://github.com/angular/protractor/issues/3384 to catch the exact error message.

You could change the launcher.ts file in your protractor dependency as mentioned in above forum to catch the error in order to debug your issue.

Ram Pasala
  • 4,931
  • 3
  • 16
  • 26