I've started to work with protractor + Jasmine for E2E testing.
The idea is to do an invalid operation and catch the exception:
expect(function () { return documentsPanel.clickUploadButtonError(); }).toThrow();
The documentsPanel is just a page object with multiple page actions. This is how I'm defining the method:
this.clickUploadButtonError = function () {
return uploadButton.click().thenCatch(function (err) {
throw('Cannot click upload button.');
});
};
The idea is for expect to pass by catching the error but my test still fails as uploadButton.click() throws a Selenium error:
Failed: unknown error: Element ... is not clickable at point (263, 131).
Any ideas on how can Jasmine catch the Selenium error?