Skip to content

Puppeteer

Install the Node.js client next to Puppeteer, and set the API key as PROXYMAIL_QA_API_KEY:

Terminal window
npm install --save-dev puppeteer proxymail-qa
signup.mjs
import puppeteer from 'puppeteer';
import { ProxyMailQA } from 'proxymail-qa';
const qa = new ProxyMailQA(); // reads PROXYMAIL_QA_API_KEY
const browser = await puppeteer.launch();
const page = await browser.newPage();
const { address, password } = await qa.createAddress({ persona: true, password: true });
await page.goto('https://staging.example.com/signup');
await page.type('input[name=email]', address);
await page.type('input[name=password]', password);
const submitted = new Date();
await Promise.all([page.waitForNavigation(), page.click('button[type=submit]')]);
const { value: code } = await qa.waitForCode(address, { since: submitted });
await page.type('input[name=code]', code);
await Promise.all([page.waitForNavigation(), page.click('button[type=submit]')]);
await qa.deleteAddress(address);
await browser.close();

For a link instead of a code, const { value: link } = await qa.waitForLink(address, { type: 'verify', since: submitted }) and 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 same calls work with Jest or Vitest around them; see Running in CI for keys and parallel runs.