End-to-End Verification Pattern
Example: Verifying Signup OTPs in Automated Tests
Instead of hardcoding a static test mailbox that breaks when two pull requests run simultaneously, provision an isolated session per test case and poll until the parsed otpCode field arrives:
// 1. Provision a fresh ephemeral address
const sessionRes = await fetch('https://usecloakmail.com/api/session', { method: 'POST' });
const { address, token } = await sessionRes.json();
// 2. Trigger your application's signup flow with `address`
await page.fill('input[name="email"]', address);
await page.click('button[type="submit"]');
// 3. Poll /api/messages for the extracted OTP
const msgRes = await fetch(`https://usecloakmail.com/api/messages?token=${token}`);
const { messages } = await msgRes.json();
const otp = messages[0]?.otpCode; // e.g., "482910"