jeudi 25 juin 2015

How to check browser console errors to exist or not

I have a project that is producing errors, and I want to create E2E tests to check a browsers console log for those errors for the sole purpose when those errors are fixed, these E2E can confirm that the errors no longer exist.

I've seen two pieces of code, but the lack of information on them is a problem:

browser.manage().logs().get('browser').then(function(browserLog) {
  console.log('log: ' + require('util').inspect(browserLog));
});

afterEach(function() {
    browser.manage().logs().get('browser').then(function(browserLog) {
        expect(browserLog.length).toEqual(0);
    });
});

Aucun commentaire:

Enregistrer un commentaire