mailslurp-examples - javascript-codecept-js

https://github.com/mailslurp/examples

Table of Contents

javascript-codecept-js/package.json

{
  "scripts": {
    "test": "npx codeceptjs run"
  },
  "dependencies": {
    "@codeceptjs/mailslurp-helper": "^1.0.5",
    "codeceptjs": "^2.3.0",
    "mailslurp-client": "^15.0.1"
  }
}

javascript-codecept-js/example_test.js

Feature('Example');

/**
 * See https://codecept.io/ for more information
 */
Scenario('Can create a new inbox', async (I) => {
  const mailbox = await I.haveNewMailbox();
  await I.sendEmail({
    to: [mailbox.emailAddress],
    subject: 'Hello',
    body: 'World'
  });
  await I.waitForLatestEmail(10);
  await I.seeInEmailSubject('Hello');
  await I.seeInEmailBody('World')
});

javascript-codecept-js/codecept.conf.js

exports.config = {
  tests: './*_test.js',
  output: './output',
  helpers: {
    MailSlurp: {
      apiKey: process.env.API_KEY,
      require: '@codeceptjs/mailslurp-helper'
    }
  },
  bootstrap: null,
  mocha: {},
  name: 'codeceptjs'
};

javascript-codecept-js/README.md

# CodeceptJS MailSlurp Example
This example  demonstrates how to use [MailSlurp](https://www.mailslurp.com) with [CodeceptJS](https://codecept.io/) and the official [codeceptjs-mailslurp-helper](https://www.npmjs.com/package/@codeceptjs/mailslurp-helper).

### Setup
- Install NodeJS

### Running
```bash
API_KEY=your-api-key make test
``` 

javascript-codecept-js/Makefile

node_modules:
	npm install

test: node_modules
	API_KEY=$(API_KEY) npm run test