Webhook delivery is eventually consistent — your application fires HTTP callbacks asynchronously after events occur. Tests must poll until the expected webhook arrives or time out. The @seontechnologies/playwright-utils webhook module provides deterministic polling, typed matchers, rich timeout diagnostics, and cleanup strategies safe under fullyParallel: true.
Webhook tests fail for four structural reasons:
afterEach creates a race condition under fullyParallel: trueThe playwright-utils approach:
recurse: Uses Playwright’s expect.poll under the hood — retries with configurable timeout and interval until a match is foundmatchField, matchPartial, matchPredicate — all must pass (AND semantics); matchers never throw on missing pathsWebhookTimeoutError carries totalReceived, receivedWebhooks, and matcherDetails so you can see what arrived vs. what was expectedstartedAt: Each WebhookRegistry instance records its creation timestamp; polling only fetches webhooks received after that point, preventing leakage from prior testsfull-reset (resets entire journal) and matched-only (deletes only matched webhooks — parallel-safe when the provider supports delete-by-ID, e.g. WireMock)| Scenario | Use webhook tests |
|---|---|
| Application publishes events to external subscribers | ✅ Required |
| Event-driven architecture with Kafka/event bus → webhook delivery | ✅ Required |
| Payment, order, or notification side effects via webhooks | ✅ Required |
| Testing that a webhook was NOT delivered | ✅ Verify via timeout |
| Polling a status endpoint for eventual consistency | ❌ Use recurse directly |
| Frontend receiving push notifications (WebSocket) | ❌ Different mechanism |
webhook-module-setup.md — Fixture wiring and cleanup strategieswebhook-template-matchers.md — matchField, matchPartial, matchPredicatewebhook-waiting-querying.md — waitFor, waitForCount, getReceived, drain patternwebhook-timeout-error.md — WebhookTimeoutError debuggingwebhook-providers.md — WireMock, MockServer, Mockoon, custom providerwebhook-risk-guidance.md — Risk-based guidance for TA and TD capabilities