✨ feat: add console error monitoring for Playwright tests; enhance page fixture with error assertions
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import type { Page, Locator } 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<VisualFixtures>({
|
||||
* 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<VisualFixtures>({
|
||||
page.reload = ((opts?: any) => origReload({ waitUntil: "domcontentloaded", ...opts })) as typeof page.reload
|
||||
|
||||
await use(page)
|
||||
monitor.assertNoErrors()
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user