mardi 1 mars 2016

How to handle timeout exception in protractor

I'm using protractor to automate my application.

My test result is displaying 0 failures after getting timeout error

My Code

var EC = protractor.ExpectedConditions;
        browser.wait(EC.presenceOf(element(by.id('xoxoxoxo'))), 5000).then(function () {
        element(amkailogo).getAttribute('src').then(function (val) {
        if (val.indexOf('Amkai-Company-Logo') > -1) {
        /.../
        } 
        else {
          /.../
         }
         });
        }, function (err) {
         console.log(err.stack);
        });

i gave some random text as a locator xoxoxoxo, and the error message is

**********Error: Waiting for header displayName
Wait timed out after 5000ms

But my test result is

Finished in 6.115 seconds
1 test, 0 assertions, 0 failures

how to make expected conditions to catch timeout error so that my console should display 1 failure instead of 0 failure enter image description here

Aucun commentaire:

Enregistrer un commentaire