The OTP testing architecture that works
The pattern is simple: your E2E test signs up with a temp Gmail, then reads `GET /api/mail?gmail=...` until the OTP appears, extracts `extractedOtp` from the JSON, and feeds it into the forms under test. No IMAP credentials, no MIME parsing, no flaky folders.
For even lower latency, subscribe to the SSE endpoint and get pushed the instant a message lands. Combined with the REST fallback, you get a deterministic, self-cleaning test dependency.