javascript - Protractor - properly handling the errors... -


i've tried put descriptive error message , exit test run via fail() function partial success - appears doing wrong... here code:

it('set internal budget', function(done) {     var acceptbudgetbutton = element(by.buttontext('accept budget'));     page.setinternalbudget();  //setting budget values      browser.wait(function() {       return browser.iselementpresent(acceptbudgetbutton);     }, 30000, 'error - accept budget button not visible.');     acceptbudgetbutton.click();     done();     done.fail('unable setup internal budget. terminating test run');   }); 

when "accept budget" button not available expected 3 things script:

1) see "accept budget button not visible" error, followed wait time out

2) see "unable setup internal budget. terminating test run" error

3) expect protractor exist test run, got failure.

in reality, first expectation met. script keeps on running , don't "unable setup internal budget" error... looks done.fail statement being ignored.

what should change make of dreams/expectations come true?

yes, nothing executed after done. define browser.wait()'s success , failure handlers. along these lines:

browser.wait(function() {   return browser.iselementpresent(acceptbudgetbutton); }, 30000).then(     function () {         acceptbudgetbutton.click();         done();     },     function () {         console.log('error - accept budget button not visible.');         done.fail('unable setup internal budget. terminating test run'); }); 

Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -