All guides

Testing guide

Test email flows with Selenium without opening Gmail

Selenium recommends using an email provider API instead of automating Gmail or another mailbox interface. PNTR separates those jobs: WebDriver exercises your application, while a small API poll retrieves the message.

Explore PNTR's disposable email for developers
TypeScript inbox helper/TypeScript
import { PntrTestKit } from "@pntr/testkit";const hostname = process.env.PNTR_EMAIL_HOSTNAME!;const pntr = new PntrTestKit({ token: process.env.PNTR_TOKEN! });export function waitForEmail(recipient: string, since: Date) {  return pntr.waitForEmail(hostname, {    recipient,    since,    timeoutSeconds: 20,  });}

Setup

  1. 1

    Prepare the PNTR inbox

    Create an email-enabled PNTR hostname and generate an API token. Put PNTR_TOKEN and the full hostname in the test runner's secret environment, not in the repository.

  2. 2

    Generate a per-test address

    Create an address such as selenium- plus a UUID at your PNTR subdomain. No inbox setup is required for each local part because PNTR receives them all.

  3. 3

    Drive only your application with Selenium

    Enter the generated address, submit the form, and assert the application's immediate success state with WebDriver's normal explicit waits.

  4. 4

    Poll PNTR outside the browser

    Use @pntr/testkit in the Node process to wait for the exact recipient. API waiting is faster and less fragile than opening a third-party mailbox with WebDriver.

  5. 5

    Continue the browser journey

    Fetch the matching email body, extract the expected link or code, then return to Selenium to complete the verification flow and assert the final signed-in state.

Before you ship

Do not automate a Gmail or Outlook login as part of this test. It introduces another site's authentication, selectors, and anti-bot behavior into a flow that only needs the delivered message.

Primary documentation