Skip to content

zerodrop-dev/resend-playwright-zerodrop

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

resend-playwright-zerodrop

CI zerodrop-client resend

Send with Resend. Catch with ZeroDrop.

Testing Resend email flows with Playwright — email verification, magic links, OTP, password reset. No regex, no shared inboxes, no Docker.

git clone https://github.com/zerodrop-dev/resend-playwright-zerodrop
cd resend-playwright-zerodrop
npm install
cp .env.example .env   # add RESEND_API_KEY
npx playwright install chromium
npm test

What this tests

Test file Email flow ZeroDrop field
email-verification.spec.ts Signup verification email.magicLink
magic-link.spec.ts Passwordless login email.magicLink
otp.spec.ts OTP sign-in email.otp
password-reset.spec.ts Password reset email.magicLink

Each test file includes:

  • A full E2E test against your app
  • A direct Resend → ZeroDrop test (no app needed)

How it works

import { Resend } from "resend";
import { ZeroDrop } from "zerodrop-client";

const resend = new Resend(process.env.RESEND_API_KEY);
const mail = new ZeroDrop();

test("email verification", async ({ page }) => {
  const inbox = mail.generateInbox(); // instant, no network request

  // Resend sends the email
  await resend.emails.send({
    from: "Auth <onboarding@resend.dev>",
    to: inbox,
    subject: "Verify your email",
    text: "Click to verify: https://yourapp.com/verify?token=abc123",
  });

  // ZeroDrop catches it at Cloudflare's edge
  const email = await mail.waitForLatest(inbox, { timeout: 15000 });

  email.otp        // "847291" — auto-extracted, no regex
  email.magicLink  // "https://yourapp.com/verify?token=abc123" — auto-extracted
});

Stack

Tool Purpose
Resend Email sending
ZeroDrop Email catching + OTP/magic link extraction
Playwright E2E testing

Setup

1. Clone and install

git clone https://github.com/zerodrop-dev/resend-playwright-zerodrop
cd resend-playwright-zerodrop
npm install
npx playwright install chromium

2. Configure environment

cp .env.example .env

Add your RESEND_API_KEY from resend.com.

ZeroDrop needs no API key — free, no signup.

3. Run tests

npm test

GitHub Actions CI

- uses: actions/checkout@v4
- uses: actions/setup-node@v4
  with:
    node-version: 20
- run: npm install
- run: npx playwright install --with-deps chromium
- run: npm test
env:
  RESEND_API_KEY: ${{ secrets.RESEND_API_KEY }}
  APP_URL: https://your-staging-url.com

No Docker. No SMTP. ZeroDrop works out of the box in CI.

Why ZeroDrop

Resend handles the sending side perfectly. The catching side — reading verification emails in tests — is the unsolved gap.

Approach Problem
Mock the email Tests pass while broken emails ship
Shared Gmail inbox Race conditions in parallel test runs
MailHog Requires Docker, doesn't test real Resend delivery

ZeroDrop gives each test a real isolated inbox. Emails sent via Resend land in under 1 second. OTPs and magic links are extracted at Cloudflare's edge — your test just reads email.otp or email.magicLink.

Free, no signup → zerodrop.dev

Related

About

Testing Resend email flows with Playwright and ZeroDrop — OTPs and magic links auto-extracted. No regex, no shared inboxes, no Docker.

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Contributors