codeceptjs-remote-maildev-helper

    0.0.1 • Public • Published

    codeceptjs-remote-maildev-helper

    CodeceptJS helper for simplest email check using remote maildev server

    Installation

    npm install --save-dev condeceptjs-remote-maildev-helper

    Running remote server

    On the target remote host clone codeceptjs-remote-maildev, install dependencies with npm and start. NodeJS should be installed.

    git pull https://github.com/kuzjka/codeceptjs-remote-maildev.git
    cd codeceptjs-remote-maildev
    npm install
    npm run serve

    Alternatively, you can use Docker image

    docker run --name remote-maildev -d kuzjka/codeceptjs-remote-maildev

    By default, SMTP listens on port 25 and REST API is exposed on 8080. You can override it with SMTP_PORT and WEB_PORT environment variables.

    CodeceptJS configuration

    In codecept.conf.json:

    {
      //...
      "helpers": {
        //...
        "RemoteMaildevHelper": {
          "require": "./node_modules/codeceptjs-remote-maildev-helper",
          "host": "123.124.125.126",
          "port": "8080"    
        }
      }
    }

    Default value for host is localhost, and for port is 8080.

    You may run

    npx codeceptjs def .

    to generate typescript definitions for all installed helpers - this adds code autocompletion to IDEs, which support TypeScript.

    Usage

    Configure your application to use remote Maildev server (see Maildev docs).

    In your CodeceptJS scenario use I.haveMailbox(address) to initialize mailbox and I.grabNextUnreadMail() to get email object.

    For example:

    Scenario('test email sending' async (I) => {
      I.haveMailbox('john.doe@example.com');
     
      I.amOnPage('/sendMeEmail');
      I.fillField('email', 'john.doe@example.com');
      I.click('Send Me Email!');
     
      const email = await I.grabNextUnreadMail();
     
      I.say('I have email: ' + email.subject);
    });

    I.grabNextUnreadMail() returns Promise like all CodeceptJS grabber methods. It resolves to email object, which is used by Maildev and seems to conform Mailparser specification.

    You may register more recipient addresses by adding more I.haveMailbox() calls.

    License

    MIT

    Install

    npm i codeceptjs-remote-maildev-helper

    DownloadsWeekly Downloads

    0

    Version

    0.0.1

    License

    MIT

    Unpacked Size

    6.03 kB

    Total Files

    4

    Last publish

    Collaborators

    • kuzjka