Skip to content

Commit

Permalink
Ensure there are in-browser errors
Browse files Browse the repository at this point in the history
Refs ad53282
  • Loading branch information
thewilkybarkid committed Aug 9, 2024
1 parent d5f120a commit 65844e0
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion integration/base.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,28 @@
import { type Fixtures, type PlaywrightTestArgs, type PlaywrightTestOptions, test as baseTest } from '@playwright/test'
import {
type Fixtures,
type PlaywrightTestArgs,
type PlaywrightTestOptions,
test as baseTest,
expect,
} from '@playwright/test'

export { expect } from '@playwright/test'

const appFixtures: Fixtures<Record<never, never>, Record<never, never>, PlaywrightTestArgs & PlaywrightTestOptions> = {
baseURL: async ({}, use) => {
await use('http://localhost:3000')
},
context: async ({ context }, use) => {
const errors: Array<string> = []

context.on('weberror', error => {
errors.push(error.error().message)
})

await use(context)

expect(errors).toHaveLength(0)
},
}

export const test = baseTest.extend(appFixtures)

0 comments on commit 65844e0

Please sign in to comment.