angular/jasminewd

RFE: a way to test whether a promise has been rejected

Opened this issue · 1 comments

I'm testing an Angular based front end using Protractor. To test whether a particular operation has been successful, I need to query the back end through its REST API and thus asynchronously using promises. For negative cases, I need to test whether a promise has been rejected. Thus I'd appreciate if you could provide such functionality.

We should definitely do something around rejected promises. Looks like right now if you do

  expect(require('q').reject('Error')).toBe('Error');

you get

[launcher] Process exited with error code 1

/usr/local/google/home/sjelin/protractor/node_modules/selenium-webdriver/lib/goog/async/nexttick.js:41
  goog.global.setTimeout(function() { throw exception; }, 0);
                                      ^
Error