Show service worker console logs in the webdriver CLI log
Background
For debugging tests, it's useful to see anything logged to the console. When running the tests directly in a browser, this isn't a problem, since it's easy to open the service worker's console. However, when running the tests through webdriver, it's difficult to see these logs.
This is especially annoying when debugging the service worker fuzz tests, since those have to be run through webdriver.
Use case
Easier debugging and testing.
What to change
- In our test extension (
background.js
), monkey patch theconsole
functions to stream logs to the mocha tests extension page. - In mocha tests, using the existing logging mechanism to stream any logs (including those from the background) to the webdriver CLI logs.
- Make sure that logs can be added to the tests and seen in the Gitlab CI logs.
Edited by Justin Wernick