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:
kolaente
2026-03-02 21:53:00 +01:00
parent 39acdac531
commit 51f789bf5c
3 changed files with 37 additions and 0 deletions

View File

@@ -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(() => {})
},
})