test: improve e2e test stability
This commit is contained in:
parent
34f354b2a0
commit
24b35237a0
@ -28,10 +28,17 @@ export function setupPuppeteer() {
|
|||||||
let browser: puppeteer.Browser
|
let browser: puppeteer.Browser
|
||||||
let page: puppeteer.Page
|
let page: puppeteer.Page
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeAll(async () => {
|
||||||
browser = await puppeteer.launch(puppeteerOptions)
|
browser = await puppeteer.launch(puppeteerOptions)
|
||||||
|
})
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
page = await browser.newPage()
|
page = await browser.newPage()
|
||||||
|
|
||||||
|
await page.evaluateOnNewDocument(() => {
|
||||||
|
localStorage.clear()
|
||||||
|
})
|
||||||
|
|
||||||
page.on('console', e => {
|
page.on('console', e => {
|
||||||
if (e.type() === 'error') {
|
if (e.type() === 'error') {
|
||||||
const err = e.args()[0] as any
|
const err = e.args()[0] as any
|
||||||
@ -44,6 +51,10 @@ export function setupPuppeteer() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
|
await page.close()
|
||||||
|
})
|
||||||
|
|
||||||
|
afterAll(async () => {
|
||||||
await browser.close()
|
await browser.close()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user