Test real signup emails instead of mocking verification.
mails0 gives Playwright tests a real mailbox and a deterministic code-retrieval API. Use it to test account creation, login, password reset, and email confirmation flows end to end.
Playwright flow
Use a test mailbox
Use a hosted sandbox mailbox for a quick test, or self-host mails0 for stable CI domains and retention control.
Submit the signup form
Playwright fills the mailbox into the app signup form and waits for the verification screen.
Wait for the OTP
Call mails code, Python wait_for_code, or the HTTP API with a timeout.
Assert verified state
Paste the code into the page and assert the dashboard, success route, or verified badge.
Example pattern
import { test, expect } from '@playwright/test';
import { execFileSync } from 'node:child_process';
const mailbox = '[email protected]';
test('signup verifies email', async ({ page }) => {
await page.goto('https://example.test/signup');
await page.fill('input[name="email"]', mailbox);
await page.fill('input[name="password"]', 'correct horse battery staple');
await page.click('button[type="submit"]');
const code = execFileSync('mails', [
'code',
'--to', mailbox,
'--timeout', '60'
], { encoding: 'utf8' }).trim();
await page.fill('input[name="code"]', code);
await page.click('button[type="submit"]');
await expect(page.getByText('Email verified')).toBeVisible();
});
When to self-host for tests
Use the hosted sandbox for early development. Self-host when the test suite needs a stable domain, predictable retention, higher limits, domain reputation control, or CI secrets managed inside your own Cloudflare account.