# Mailosaur and Cypress - Quickstart guide Get Mailosaur up and running within your Cypress project in a few steps. ## What you'll need - A Mailosaur account. If you don't already have one, [create a free trial account](/app/signup). - [An API key](/app/keys). Log in to your account and generate one in order to run automated tests. - Knowledge of how to send emails (or SMS) into your account. ## Express: Generate a sample project If you have **npm** installed, you can generate a basic starter project for Cypress via the command line: ```sh npm create mailosaur@latest ``` This will give you a simple Cypress project with Mailosaur already configured, along with some basic tests that show how a project would typically work. You can also see similar [sample code](https://github.com/mailosaur/examples/tree/main/cypress) on GitHub. ## Integrate with an existing Cypress project If you have an existing Cypress project, or have just created one, you'll need to install and configure Mailosaur's API client library: ### Install the Mailosaur plugin Mailosaur provides an official set of custom commands for automating email testing in Cypress. Extend Cypress by installing Mailosaur’s custom commands package: [cypress-mailosaur](https://github.com/mailosaur/cypress-mailosaur). 1. Install the plugin via `npm`: ```bash npm install cypress-mailosaur ``` 2. Open `cypress/support/e2e.js` in your project folder, and add the following line of code to it: ```js import "cypress-mailosaur"; ``` 3. Add your [Mailosaur API key](/app/keys) to `cypress.config.js`, in your project folder: ```js module.exports = defineConfig({ env: { MAILOSAUR_API_KEY: "YOUR_API_KEY", }, // ... }); ``` **Note:** We strongly recommend against storing API keys in source control. Therefore you can also set your API key using the environment variable `CYPRESS_MAILOSAUR_API_KEY`. ### Make your first API call ```js // Make a simple API call to find the name of your inbox cy.mailosaurListServers().then((result) => { cy.log(`Inbox name is ${result.items[0].name}`); }); ``` ## Start testing Now that you have a project connected to the Mailosaur API, you can start creating a variety of tests: - [Email testing](/docs/automation/cypress/email-testing) - test password resets, account verification, order confirmations, etc. - [SMS testing](/docs/automation/cypress/sms-testing) - test alerts, notifications, and 2FA logins - [2FA app testing](/docs/authenticator) - mimic the functionality of apps like Google Authenticator and Auth0 - [Email deliverability testing](/docs/api)