← Back to microsoft/playwright
microsoft / playwright · Issue No. 40880
This is pretty easy on userland, however, I think it is a nice feature for playwright.
Browser errors can be easily swollen, and the test might pass despite them. If you are trying to make high quality code, it is worth making the test fail if the browser throws an error (i.e. on('pageerror') or console.log.msg.type is 'error')
top level configuration:failOnBrowserErrors: true //option for array of strings that are allowed to pass.
then in a test, you can use a dedicated fixture for specific tests:
test('my example test', (({ allowBrowserErrors }) => {
allowBrowserErrors(); //potentially - specific errors.
// test will fail if the browser errs.
});
We had too many component tests that had some serious errors. Those errors were in the browser - far from sight, far from heart.
As initial step I just "redirected" them to the console, and people start fixing, but also it was very useful for the agent to see the error without the need to launch the browser and access the console, then review all the logs to find errors.
Then came the inevitable, where people did not want to go thru logs, so failing the test was the requested.
Relay reads this issue against the repository's contribution signals: the files it is likely to touch, how the maintainers triage work this size, and what the first contribution would exercise.
The full analysis for this issue is still being assembled. Until then, the description above and the thread on GitHub are the most reliable context.