mirror of
https://github.com/go-vikunja/vikunja.git
synced 2026-04-30 08:25:58 -05:00
fix(e2e): drain event handlers and stop browser between tests
Async event handlers (via Watermill) from the previous test can hold SQLite connections, starving the next test's fixture setup PATCH request. Three changes fix this: 1. Track in-flight event handler goroutines with a WaitGroup. 2. Call WaitForPendingHandlers() in the test endpoint before truncating/inserting data. 3. Navigate the browser to about:blank in fixture teardown to stop notification polling and other frontend requests between tests.
This commit is contained in:
@@ -32,6 +32,11 @@ export const test = base.extend<{
|
||||
authenticatedPage: async ({page, apiContext, currentUser}, use) => {
|
||||
const {token} = await login(page, apiContext, currentUser)
|
||||
await use(page)
|
||||
// Navigate away to stop all frontend requests (notification polling, token
|
||||
// refresh, etc.) before the next test's fixture setup seeds the database.
|
||||
// Without this, the previous test's page can hold DB connections via API
|
||||
// requests, starving the next test's Factory.seed() PATCH call.
|
||||
await page.goto('about:blank').catch(() => {})
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user