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 ask PNTR to wait for that exact message.
Explore PNTR's disposable email for developersimport { PntrTestKit, createRecipient, extractOtp } from "@pntr/testkit";const hostname = process.env.PNTR_EMAIL_HOSTNAME!;const pntr = new PntrTestKit({ token: process.env.PNTR_TOKEN! });const since = new Date();const recipient = createRecipient(hostname, { prefix: "signup" });await page.getByLabel("Email").fill(recipient);await page.getByRole("button", { name: "Sign up" }).click();const message = await pntr.waitForEmail(hostname, { recipient, subject: "Verification code", since, timeoutSeconds: 20,});const otp = extractOtp(message, /\b(\d{6})\b/);await page.getByLabel("Verification code").fill(otp);Setup
- 1
Create and enable an inbox
Use the email onboarding flow to create a PNTR hostname. Generate an API token under MCP integration, then store PNTR_TOKEN and the full hostname as PNTR_EMAIL_HOSTNAME in your test environment.
- 2
Install the public TestKit package
Run npm install --save-dev @pntr/testkit. TestKit accepts the full hostname shown in the dashboard and resolves its internal ID automatically.
- 3
Generate one address per test
Call createRecipient with your hostname. All addresses arrive in one catch-all inbox, while the unique recipient keeps parallel test runs isolated.
- 4
Complete the application flow
Record the start time, enter the generated address in your signup, reset-password, or OTP flow, and submit the form normally through Playwright.
- 5
Wait for and assert the message
Call waitForEmail with the hostname, exact recipient, test start time, and a bounded timeout. The result contains the full message for extracting a code or link.
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.