Cypress email & OTP verification without flaky sleeps or expensive SaaS.
Give every Cypress test case an isolated disposable inbox via POST /v1/mailboxes, await message.ready deterministically over Fetch SSE, extract your OTP or magic link, and tear down cleanly.
3-Step Deterministic Workflow
1. Provision per test
Call POST /v1/mailboxes to receive a unique address and 256-bit Bearer access_token.
2. Stream SSE event
Subscribe to GET /v1/mailboxes/me/events with Authorization: Bearer until message.ready arrives.
3. Extract & clean up
Read GET /v1/mailboxes/me/messages/{id} for text/HTML and DELETE /v1/mailboxes/me in teardown.
Copy-Ready Cypress OTP Verification Template
TypeScript// cypress/support/e2e.ts or cypress.config.ts task
const API = 'https://api.inboxflick.com/v1';
// In cypress/e2e/signup.cy.ts
it('completes email OTP verification', () => {
cy.request('POST', `${API}/mailboxes`, {}).then(({ body }) => {
const address = body.data.mailbox.address;
const token = body.data.access_token;
cy.visit('/signup');
cy.get('input[type="email"]').type(address);
cy.contains('button', 'Send code').click();
// Poll /messages or await custom cy.task('waitForSseOtp', token)
const poll = (attempt = 0): Cypress.Chainable<string> =>
cy.request({
url: `${API}/mailboxes/me/messages`,
headers: { Authorization: `Bearer ${token}` },
}).then((res) => {
const items = res.body.data.items;
if (items.length > 0) {
return cy.request({
url: `${API}/mailboxes/me/messages/${items[0].id}`,
headers: { Authorization: `Bearer ${token}` },
}).then((detail) => detail.body.data.text_body.match(/\b(\d{6})\b/)![1]);
}
if (attempt > 10) throw new Error('OTP timeout');
return cy.wait(1500).then(() => poll(attempt + 1));
});
poll().then((otp) => {
cy.get('input[name="otp"]').type(otp);
cy.url().should('include', '/dashboard');
cy.request({
method: 'DELETE',
url: `${API}/mailboxes/me`,
headers: { Authorization: `Bearer ${token}` },
});
});
});
}); Running Parallel CI Workers? Batch-Create 1–20 Inboxes with Pro
Guest IPs allow 1 active inbox at a time (5/day). Upgrade to Pro ($1.99/mo or $8.99 one-time lifetime) to provision 1–20 parallel worker mailboxes in a single API call on isolated clean domains.
POST https://api.inboxflick.com/v1/member/mailboxes/batch
Authorization: Bearer <PRO_MEMBER_JWT>
Content-Type: application/json
{ "count": 20, "is_permanent": false } Scale parallel CI email tests for $8.99 one-time
Unlock unlimited daily creation, 1–20 batch provisioning, isolated Pro domains, and 10,000 permanent inboxes.