Playwright
Install the proxymail-qa package and keep the API key in PROXYMAIL_QA_API_KEY:
npm install --save-dev proxymail-qaCreate an address, sign up with it, then wait for the code:
import { expect, test } from '@playwright/test';import { ProxyMailQA } from 'proxymail-qa';
const qa = new ProxyMailQA(); // reads PROXYMAIL_QA_API_KEY
test('sign-up sends a working code', async ({ page }) => { const { address, password } = await qa.createAddress({ persona: true, password: true }); const submitted = new Date();
await page.goto('/signup'); await page.getByLabel('Email').fill(address); await page.getByLabel('Password').fill(password); await page.getByRole('button', { name: 'Sign up' }).click();
const { value } = await qa.waitForCode(address, { since: submitted }); await page.getByLabel('Code').fill(value); await expect(page).toHaveURL(/welcome/);
await qa.deleteAddress(address);});since makes the wait ignore anything sent before the form was submitted, so a retry never picks up an old code. Waits hold for up to 30 seconds; pass timeout for longer.
For a link instead of a code:
const { value: link } = await qa.waitForLink(address, { type: 'verify', since: submitted });await page.goto(link);If nothing arrives, the error says why as far as Proxy Mail QA can tell, for example that your app’s email provider only sends to verified addresses. The package also covers dates of birth and countries on personas, app links, the email’s HTML for template tests, and unusual addresses: see its README. For running in CI, see Running in CI.
Prefer plain HTTP? Every call is in the REST API guide.