---
title: "Cypress | Proxy Mail QA"
description: "A Cypress test that signs up with a disposable Proxy Mail QA address and opens the verification link from the email, using the proxymail-qa package in Cypress tasks."
url: https://proxymail.qa/docs/cypress
---

# Cypress

Install the [proxymail-qa](https://www.npmjs.com/package/proxymail-qa) package:

Terminal window

```bash
npm install --save-dev proxymail-qa
```

Cypress runs tasks in Node, so register them in the config. The [API key](https://proxymail.qa/docs/api-keys) comes from `PROXYMAIL_QA_API_KEY` in the environment Cypress runs in:

cypress.config.ts

```ts
import { defineConfig } from 'cypress';
import { ProxyMailQA } from 'proxymail-qa';

export default defineConfig({
  e2e: {
    setupNodeEvents(on) {
      const qa = new ProxyMailQA(); // reads PROXYMAIL_QA_API_KEY
      on('task', {
        createAddress: () => qa.createAddress({ persona: true }),
        waitForLink: ({ address, since }: { address: string; since: string }) => qa.waitForLink(address, { type: 'verify', since }),
        deleteAddress: (address: string) => qa.deleteAddress(address).then(() => null),
      });
    },
  },
});
```

Then sign up and open the link from the email:

cypress/e2e/signup.cy.js

```js
it('verifies the email', () => {
  cy.task('createAddress').then(({ address }) => {
    const since = new Date().toISOString();
    cy.visit('/signup');
    cy.get('[name=email]').type(address);
    cy.contains('Sign up').click();
    cy.task('waitForLink', { address, since }, { timeout: 35000 }).then(({ value }) => cy.visit(value));
    cy.task('deleteAddress', address);
  });
});
```

The task timeout is 35 seconds because a wait can hold for up to 30\. For a code instead of a link, add a task that calls `qa.waitForCode(address, { since })` and type its `value` into the form.

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. For running in CI, see [Running in CI](https://proxymail.qa/docs/ci). Prefer plain HTTP from the spec with `cy.request`? Every call is in the [REST API](https://proxymail.qa/docs/rest-api) guide.

[Previous Playwright](https://proxymail.qa/docs/playwright.html) [Next Puppeteer](https://proxymail.qa/docs/puppeteer.html)
