Playwright Email Testing Guide 2026

How to test email verification in Playwright with disposable inboxes. Complete guide: OTP codes, magic links, password reset, parallel fixtures, GitHub Actions. TypeScript-ready. No Mailhog needed.

Frequently Asked Questions

How do I test email in Playwright without a real mail server?

sed.sh gives you real email addresses that receive actual emails, accessible via REST API. No SMTP server, no Mailhog, no Docker container to run alongside your app. Install @sed-sh/sdk, create an inbox, poll for messages, done.

How do I do Playwright email testing without Mailhog?

sed.sh is the simplest Mailhog replacement for Playwright. No infrastructure to set up — just a REST API. Your CI pipeline stays clean with no extra services to start. Works in any cloud CI environment that has outbound internet access.

How do I wait for an email to arrive in Playwright?

Use a while-loop polling GET /inboxes/{code}/messages every 2 seconds with a 30-second overall timeout. Return as soon as messages.length > 0. Never use page.waitForTimeout() with a fixed delay.

How do I use Playwright fixtures for email testing?

Create a custom fixture with test.extend() that calls createInbox() in setup and deleteInbox() in teardown. Import this extended test object in your spec files instead of @playwright/test. The inbox is automatically created before each test and deleted after, even on failure.

Can I run Playwright email tests in parallel?

Yes. Set fullyParallel: true in playwright.config.ts. Since each test creates its own inbox with a unique code, parallel workers cannot interfere with each other. The fixture pattern makes this seamless — each test automatically gets and releases its own inbox.

How do I extract a 6-digit OTP from an email in Playwright?

Fetch the full message with getMessage(), then apply /\b(\d{6})\b/ to email.body. The sed.sh API always returns a plain-text body field, so you do not need to strip HTML. Type the OTP into the form with page.fill().

How much does it cost to run Playwright email tests?

$0.0012 per email. 1,000 Playwright email tests cost $1.20. The $10 minimum deposit covers ~8,300 tests at tier A pricing. No subscription, no monthly minimum.