-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Problem
All 9 billing E2E tests (tests/e2e/billing.spec.ts) pass reliably in isolation but time out when run as part of the full test suite alongside portal tests.
Isolation run: 10/10 pass in ~22s
Full suite run: 0/9 pass — all timeout
Root Cause
The billing tests are sensitive to dev-server load. The buildMinimalInvoice helper navigated to /invoices/new then called page.waitForLoadState("networkidle"), which waits for all network requests to be idle for 500ms. When portal tests run concurrently on the same dev server, network activity never settles within the timeout.
An attempt was made to replace waitForLoadState("networkidle") with page.locator('[id="client_id"]').waitFor({ state: "visible", timeout: 30_000 }), but the tests continued to fail, suggesting the bottleneck is deeper — likely the dev server struggling to handle concurrent requests from 2 Playwright workers.
Failing tests (all in billing — invoice management)
- line item totals are computed correctly in the builder UI
- adding and removing a line item updates the subtotal
- creating an invoice redirects to the detail page with draft status
- sending an invoice changes its status to sent
- invoice PDF endpoint returns 200 with correct content-type
- recording full payment marks invoice as paid
- invoice with past due date shows overdue badge after sending
- invoice number increments across two consecutive invoices
- reports page loads revenue and time summary without errors
Possible paths forward
-
Run billing tests serially, isolated from portal tests — add
test.describe.configure({ mode: 'serial' })to the billing describe block AND split billing into its own Playwright project that runs after portal tests complete (viadependencies). -
Increase dev-server capacity — run the dev server with
--turboor use a production build (npm run build && npm run start) for E2E tests, which handles concurrent requests better thannext dev. -
Reduce concurrency — drop
workersto1for the full local suite. Slower but guaranteed to work. Portal + billing + auth combined should still complete in under 5 minutes. -
Add per-test timeouts — set
timeout: 60_000on each billing test to give more headroom under load.
Current workaround
Run billing tests in isolation: npx playwright test tests/e2e/billing.spec.ts