← All use cases

E2E Test Automation

Automate tests for signup and email verification flows in CI/CD

Test the flow from user registration to email verification in code. Create an address for each test, and write the steps from receiving the confirmation email to opening its link into your test. Add it to your CI pipeline to run the same check on each change.

What you can do with MailBrew

  1. 01

    A separate address per test

    Create an address for each test case. Emails are kept per address, so tests running in parallel do not see each other's mail.

  2. 02

    Works from CI/CD

    It is a REST API called with an API key from an environment variable, so you can use it from GitHub Actions, CircleCI, GitLab CI, and others. If IP restrictions are on, add your CI IP addresses to the allowlist.

  3. 03

    A wait API that returns on arrival

    The wait API waits on the server and returns as soon as the email arrives (up to 60 seconds). No fixed sleeps in your tests.

  4. 04

    Use it with your framework

    Call it through the REST API or the Node.js SDK (@mailbrew/sdk) from Playwright, Cypress, Selenium, Puppeteer, and other test tools.

Sample code

JavaScript (Playwright)

JavaScript (Playwright)
// Playwright + MailBrew: Signup E2E test
import { test, expect } from '@playwright/test';
import { MailBrew } from '@mailbrew/sdk';

const mb = new MailBrew(process.env.MAILBREW_API_KEY);

test('user registration to email verification', async ({ page }) => {
  // 1. Create a test address (ttl in seconds)
  const addr = await mb.createAddress({ ttl: 300 });

  // 2. Fill in the signup form
  await page.goto('https://staging.example.com/signup');
  await page.fill('[name="email"]', addr.address);
  await page.fill('[name="password"]', 'SecurePass123!');
  await page.click('button[type="submit"]');

  // 3. Wait for the confirmation email (timeout in milliseconds)
  const email = await mb.waitForEmail(addr.address, { timeout: 30000 });

  // 4. Extract the verification link and open it
  const [verifyUrl] = await mb.extractLinks(addr.address, email.id, { pattern: 'verify' });
  await page.goto(verifyUrl);
  await expect(page.locator('.welcome')).toBeVisible();

  // 5. Clean up
  await mb.deleteAddress(addr.address);
});

Ready to try this use case?

Get started with the free plan today. No credit card required.
Free plan: up to 100 emails/month and 5 addresses

Create free account →