Puppeteer
A Puppeteer script that signs up with a fresh address and enters the code from the email, using the Node.js client.
Install the packages
Section titled “Install the packages”Install the Node.js client next to Puppeteer, and set the API key as
PROXYMAIL_QA_API_KEY.npm install --save-dev puppeteer proxymail-qapnpm add -D puppeteer proxymail-qayarn add -D puppeteer proxymail-qabun add -d puppeteer proxymail-qaSign up and enter the code
Section titled “Sign up and enter the code”Create an address, sign up with it, wait for the code and enter it.
For a link instead of a code,
const { value: link } = await qa.waitForLink(address, { type: 'verify', since: submitted })andawait page.goto(link).signup.mjs import puppeteer from 'puppeteer';import { ProxyMailQA } from 'proxymail-qa';const qa = new ProxyMailQA(); // reads PROXYMAIL_QA_API_KEYconst 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 form that asks more than the email and password, such as a username, a team size or “How did you hear about us?”, qa.formValues({ fields, address, site, page }) gives what to type or pick in each field: the project’s custom fields fill your app’s own fields, and fields nobody taught get a guess to check (kind: 'guess'). For a sign-up over several screens, call it once per screen with the same address and that screen’s site and page.
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.