CodeceptJS email plugin
CodeceptJS Integration
MailSlurp has a deep integration with an official CodeceptJS plugin that lets you create and control real email accounts (and phone numbers) in codecept Js tests.
Install
First get a free API Key for MailSlurp. Then install the following packages:
npm i @codeceptjs/mailslurp-helper mailslurp-client --save-devThen configure your codecept.conf.js:
exports.config = { tests: './*_test.js', output: './output', helpers: { MailSlurp: { apiKey: process.env.API_KEY || 'YOUR_MAILSLURP_API_KEY', require: '@codeceptjs/mailslurp-helper' }, }, name: 'codeceptjs'};Make sure you set your API_KEY in codecept.conf.js setup.
Example
Here is a test that does the following:
- Create a new mailbox
- Use email address to create new user account
- Wait for confirmation code email
- Extract verification code using regex
- Submit code and log in as verified user
Loading...Resources
Please see the example Github repository and CodeceptJS documentation for more information.