Pattern: Cypress tasks
Cypress tests run in the browser — they cannot make cross-origin API calls directly. Use Cypress tasks to call the TempInbox API from the Node.js process instead.Setup: cypress/support/tasks.ts
cypress/support/tasks.ts
Register tasks: cypress.config.ts
cypress.config.ts
Example test
cypress/e2e/signup.cy.ts
Increasing task timeout
Cypress tasks have a default timeout of 60 seconds. For slow staging environments:Tips
Store jwt in Cypress env or alias
Store jwt in Cypress env or alias
Use
cy.wrap(jwt).as('jwt') or pass it through the test via closures — don’t rely on Cypress.env for per-test values.Parallel specs are safe
Parallel specs are safe
Each spec creates its own inbox — parallel Cypress workers won’t collide.
No mock service needed
No mock service needed
This approach hits real SMTP. You catch real delivery failures that mocks would hide.
Related reading
- Disposable Email in Playwright and Cypress: E2E — broader E2E patterns and pitfalls
- Email for Testing: A Practical QA Playbook — when to use real inboxes vs mocks
- Playwright guide — the same flow with Playwright fixtures