feat: add console error monitoring for Playwright tests; enhance page fixture with error assertions

This commit is contained in:
2026-03-08 15:36:50 +00:00
parent a9a13a6b5b
commit 0be4852f74
4 changed files with 129 additions and 0 deletions

View File

@@ -1,5 +1,6 @@
import type { Page } from "@playwright/test"
import { test as base, expect as pwExpect } from "@playwright/test"
import { attachConsoleMonitor } from "../fixtures/console-monitor"
export { expect, type Page, API_BASE, clickSpaLink } from "../e2e/fixtures"
import { expect } from "../e2e/fixtures"
@@ -11,6 +12,8 @@ export const test = base.extend<MobileFixtures>({
* Override page fixture: BrowserSync domcontentloaded workaround.
*/
page: async ({ page }, use) => {
const monitor = attachConsoleMonitor(page)
const origGoto = page.goto.bind(page)
const origReload = page.reload.bind(page)
@@ -19,6 +22,7 @@ export const test = base.extend<MobileFixtures>({
page.reload = ((opts?: any) => origReload({ waitUntil: "domcontentloaded", ...opts })) as typeof page.reload
await use(page)
monitor.assertNoErrors()
},
})