Cypress is a popular end-to-end testing framework for NodeJS. With the MailSlurp plugin you can test applications using real email addresses. MailSlurp is a free email account API with official support for Cypress. Here is a full example on how to test an web application sign up process using Cypress and MailSlurp:
Quick guides
- CypressJS Plugin documentation
- CypressJS Plugin source
- See the examples on github or the Cypress guide to get started.
Disposable email addresses in Cypress JS
MailSlurp has an official plugin for CypressJS that allows you to create throwaway email inboxes on demand during tests.
Setup email client
MailSlurp is free but requires an API Key. Get yours by creating a free account. Set the environment variable CYPRESS_MAILSLURP_API_KEY or use the cypress.json file env property:
The package json for your project should look something like this:
Creating email inboxes
Create inboxes using the method to obtain a mailslurp instance and then call instance methods such as
.
Example test
Here is an example that signs up for a user account on the demo app at playground.mailslurp.com
Here is the code using in typescript: