Cypress testing

Cypress is a strong fit for end-to-end browser tests where email is part of the workflow. MailSlurp adds real inbox control so your tests can assert links, codes, and content instead of mocking email delivery.

For a full plugin walkthrough, see the in-depth Cypress tutorial.

What to test with Cypress and MailSlurp

Use the combo for high-value user flows:

  • New-user signup and confirmation links
  • Password reset links and expiry behavior
  • OTP and MFA code delivery
  • Invitation and magic-link authentication
  • Transactional notifications that must be rendered correctly

Why teams use this pattern

Compared with static fixtures, real inbox testing catches classes of failures your UI suite alone misses:

  • Misconfigured sender/authentication settings
  • Broken links in generated templates
  • Delayed delivery and retry edge cases
  • Environment routing mistakes (staging vs production)

Cypress vs Selenium

Cypress and Selenium solve similar E2E goals with different mechanics:

  • Cypress: browser-first DX, fast local feedback, strong frontend developer ergonomics.
  • Selenium: broad browser/grid compatibility and enterprise test-grid integrations.

Both can work with MailSlurp; choose based on your team’s runtime and tooling constraints.

Setup

Install Cypress in your project:

Load your MailSlurp client/plugin in test support files:

Use environment variables for API keys in local and CI runs. Do not hardcode credentials in spec files.

A reliable email E2E test usually follows this sequence:

  1. Create inbox at test start.
  2. Perform browser action that triggers an email.
  3. Wait for the expected message (with timeout budget).
  4. Assert subject, sender, and body content.
  5. Extract and visit confirmation/reset links.
  6. Clean up inbox artifacts.

This gives you both UI confidence and mail-delivery confidence in one test pass.

CI reliability practices

To reduce flaky Cypress email tests:

  • Use dedicated inbox per test worker.
  • Add explicit wait windows for asynchronous delivery.
  • Assert minimal required content first, then deep checks.
  • Keep retries targeted (not globally masking failures).
  • Capture raw email payloads in CI logs for fast triage.