Extended test fixture: drop-in replacement for @playwright/test's
test. Specs that import from this module get the timed control-rail hint
dismissed before navigation and auto console-error checking after each test.
The check subscribes to Playwright's own console and pageerror page
events for the duration of the test and filters what it caught through
unexpectedConsoleErrors. It does not read the viewer's in-page
interceptor buffer — see the module docblock for why that is the wider
source and not merely the cheaper one.
The listeners come off in a finally that runs AFTER the gate, so that both
opt-out paths (the annotation, and a test that already failed) detach them
too, and so an error emitted once the test body has ended is still counted.
That second guarantee is currently vacuous — nothing between use(page)
returning and the filter yields to the event loop — but it is what made the
old shape wrong (it detached BEFORE an await assertNoConsoleErrors) and
what keeps this one safe if an await is ever reintroduced here.
Extended
testfixture: drop-in replacement for@playwright/test'stest. Specs that import from this module get the timed control-rail hint dismissed before navigation and auto console-error checking after each test.The check subscribes to Playwright's own
consoleandpageerrorpage events for the duration of the test and filters what it caught through unexpectedConsoleErrors. It does not read the viewer's in-page interceptor buffer — see the module docblock for why that is the wider source and not merely the cheaper one.The listeners come off in a
finallythat runs AFTER the gate, so that both opt-out paths (the annotation, and a test that already failed) detach them too, and so an error emitted once the test body has ended is still counted. That second guarantee is currently vacuous — nothing betweenuse(page)returning and the filter yields to the event loop — but it is what made the old shape wrong (it detached BEFORE anawait assertNoConsoleErrors) and what keeps this one safe if anawaitis ever reintroduced here.