grafana / xk6-browser

The browser module adds support for browser automation and end-to-end web testing via the Chrome Devtools Protocol to k6.
https://grafana.com/docs/k6/latest/javascript-api/k6-browser/
GNU Affero General Public License v3.0
342 stars 42 forks source link

K6_BROWSER_LOG documentation / log levels not explained #1116

Open dirtydiesel46 opened 10 months ago

dirtydiesel46 commented 10 months ago

Brief summary

As per https://k6io.slack.com/archives/C02LAJA6EJ1/p1701200916841519?thread_ts=1701200673.843449&cid=C02LAJA6EJ1

Ideally, if we have the K6_BROWSER_LOG command - I would like to be able to silence browser warnings but only show INFO, ERROR or INFO

In the case I am experiencing , when I set the K6_BROWSER_LOG=INFO

e.g.,

“test”: “K6_BROWSER_HEADLESS=false K6_BROWSER_LOG=info k6 run file.js”

it will still show all the warning messages from the browser, whereas when I set it to error it would only show errors.

With info being "lower" than warn, it includes warn, when I want to exclude warn and only show info..

xk6-browser version

v0.47.0

OS

MacOS Sonoma 14.1.1 (23B81)

Chrome version

119.0.6045.159

Docker version and image (if applicable)

No response

Steps to reproduce the problem

Run any test script and add logging in the script but ensure theres browser warnings, or add logging in terms of warnings too

Set it to show only info for example

Expected behaviour

When set to show only info, it should show only console.log(...) messages and not warnings too

Actual behaviour

It's not possible to isolate to only info at the moment, so all warnings show when isolating to info too due to the hierarchy of log messages

inancgumus commented 10 months ago

Hi @dirtydiesel46. Thanks.

What you described in this issue description is by design. Still, we can consider changing this behavior.