All guides

Testing guide

Test signup emails with Playwright and a PNTR inbox

Every address on an email-enabled PNTR subdomain reaches the same inbox. A test can generate a unique recipient, submit the signup form, and poll the PNTR API until the message arrives.

Explore PNTR's disposable email for developers

Playwright example

const recipient = `signup-${Date.now()}@testbox.pntr.dev`;

await expect.poll(async () => {
  const response = await request.get(
    `https://api.pntr.dev/api/subdomains/${process.env.PNTR_SUBDOMAIN_ID}/emails`,
    { headers: { Authorization: `Bearer ${process.env.PNTR_TOKEN}` } }
  );
  const emails = await response.json();
  return emails.some((email: { recipient: string }) =>
    email.recipient === recipient
  );
}, { timeout: 30_000 }).toBe(true);

Setup

  1. 1

    Create and enable an inbox

    Use the email onboarding flow to create a PNTR subdomain. Generate an API token in dashboard settings and store it in your test environment.

  2. 2

    Generate one address per test

    Use a unique local part such as signup- plus a timestamp. All addresses still arrive in one catch-all inbox, while the recipient field identifies the test run.

  3. 3

    Complete the application flow

    Enter that generated address in your signup, reset-password, or OTP flow and submit the form normally through Playwright.

  4. 4

    Poll the PNTR API

    Use Playwright's API request context and expect.poll. Filter returned messages by the exact recipient instead of assuming the newest message belongs to this test.

  5. 5

    Read and assert the message

    Fetch the matching message by ID, then assert its subject or extract a code or link. Keep the API token in environment variables, never in source control.

Before you ship

The free tier retains email for 48 hours and Premium for 90 days. Tests should still filter by recipient and timestamp so parallel runs do not read each other's messages.

Primary documentation