Skip to content
This repository has been archived by the owner on Jul 29, 2024. It is now read-only.

Add option to automatically redirect browser logs #1234

Closed
gunta opened this issue Aug 26, 2014 · 4 comments
Closed

Add option to automatically redirect browser logs #1234

gunta opened this issue Aug 26, 2014 · 4 comments

Comments

@gunta
Copy link

gunta commented Aug 26, 2014

This is a feature request about usability.

Currently, to see the browser console errors/logs, one has to write the following in every test suite, which is far from being user-friendly:

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

Please add an option like browserLogs: true to be able to accomplish this in any project/suite without having to resort to the above code.

Also, currently even by executing this, one gets a quite ugly (non formatted and uncolored) log like the following:

log: [ { level: { value: 1000, name: 'SEVERE' },
    message: 'http://localhost:7120/api/v1/auth/mock 0:0 Failed to load resource: the server responded with a status of 400 (Bad Request)',
    timestamp: 1409043866570,
    type: '' },
  { level: { value: 1000, name: 'SEVERE' },
    message: 'http://localhost:7120/api/v1/auth/mock 0:0 Failed to load resource: the server responded with a status of 400 (Bad Request)',
    timestamp: 1409043867771,
    type: '' },
  { level: { value: 1000, name: 'SEVERE' },
    message: 'http://localhost:7120/api/v1/auth/mock 0:0 Failed to load resource: the server responded with a status of 400 (Bad Request)',
    timestamp: 1409043900321,
    type: '' } ]

The above could be improved easily by human-readable formatting and some nice coloring.

Given that currently a lot of errors will go unnoticed, and the whole purpose of testing is to be aware of bugs early and often, it seems important that this option is set to true by default.

@juliemr
Copy link
Member

juliemr commented Aug 27, 2014

I think this is a good idea - there's a lot here that we could do to improve the experience.

@juliemr juliemr added this to the 1.X milestone Sep 4, 2014
@hilnius
Copy link

hilnius commented Oct 10, 2014

Going a little further, I didn't find any issue related to the log_level, but it would also be cool to be able to change the log level that we obtain.

@juliemr
Copy link
Member

juliemr commented Oct 10, 2014

@hilnius unfortunately WebDriver doesn't allow changing the log level below warning :(

@juliemr
Copy link
Member

juliemr commented Mar 17, 2015

Done with #1916

@juliemr juliemr closed this as completed Mar 17, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants