Skip to content

zerodrop-dev/zerodrop-playwright-example

Repository files navigation

zerodrop-playwright-example

E2E email verification testing with Playwright and ZeroDrop

CI

No Docker. No SMTP. No MailHog. Just npm install and a real inbox.


What this demonstrates

Testing auth flows that send emails (verification links, password resets, magic links) is painful. Most teams either:

  • Mock the email sending layer (doesn't test real delivery)
  • Run MailHog in Docker (adds CI overhead and maintenance)
  • Skip the test entirely

This repo shows a third option: catch real emails in CI using ZeroDrop — a disposable inbox that works over HTTP with no infrastructure.


How it works

# .github/workflows/ci.yml

- name: Generate ZeroDrop test inbox
  id: inbox
  uses: zerodrop-dev/create-inbox@v1

- name: Run Playwright tests
  run: npx playwright test
  env:
    TEST_INBOX: ${{ steps.inbox.outputs.inbox }}
// tests/auth.spec.ts

import { ZeroDrop } from 'zerodrop-client';

const mail = new ZeroDrop();
const inbox = process.env.TEST_INBOX ?? mail.generateInbox();

// Sign up with the disposable inbox
await page.fill('[data-testid="email"]', inbox);
await page.click('[data-testid="submit"]');

// Wait for the real verification email
const email = await mail.waitForLatest(inbox, { timeout: 15000 });
const link = email.body.match(/https?:\/\/\S+verify\S+/)?.[0];

// Click it
await page.goto(link);

No mocking. No Docker container. The email arrives in under 3 seconds.


Running locally

npm install
npx playwright install chromium
npm run dev

In a second terminal:

npx playwright test

A fresh inbox is generated automatically when TEST_INBOX is not set.


Stack


Free tier

ZeroDrop's free tier uses a shared domain (zerodrop-sandbox.online) with AI spam filtering and 30-minute TTL. No signup required.

For custom domains, team seats, and API keys: zerodrop.dev

About

E2E email verification testing with Playwright and ZeroDrop — no Docker, no SMTP

Topics

Resources

License

Stars

Watchers

Forks

Contributors