A Playwright Inbox Probe for Slow Email Tests
Description and use
The Playwright inbox probe reliably detects verification emails, eliminates flaky failures, and captures detailed evidence for debugging.
Problem
Email-driven browser tests often fail because the verification email is not found, leading to random failures due to clock drift between the application, worker, and mailbox API.
Outcome
The probe reliably detects the verification email, reduces flaky failures, and records actionable evidence (run ID, mailbox, poll count, timestamps, inbox status, browser trace).
Workflow
- Create a unique test mailbox address
- Submit the sign‑up form
- Poll the mailbox for a message addressed to the test address and containing a unique run ID
- Return the message and polling metrics or throw an error if the deadline is exceeded
Evidence
Email-driven browser tests often fail in the least helpful way: the registration form passes, but the test cannot find the verification message.
A reliable test needs more than a long timeout. It needs an inbox probe: a small, bounded workflow that proves which mailbox belongs to the test, polls for the expected message, and records enough evidence to explain a miss.
The sample keeps the deadline separate from the polling interval. That makes the behavior visible in code and easy to tune.
- Record date: 2026-10-27T06:11:19.543Z