npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

codeceptjs-tempmail

v0.4.7

Published

Codecept Helper using temp-mail.ru api for email testing

Downloads

6

Readme

Table of Contents

Intro

Codecept Helper with that consumes the temp-mail.ru api for test scenarios that require email interaction. An example scenario can be found below

Config

Add to codecept.conf.js with:

exports.config = {
    helpers: {
        Nightmare: {
            url: "http://localhost"
            },
        Mailbox: {
            "require": "node_modules/codeceptjs-tempmail"
        }
    }
    /*...some config*/
}

or to codecept.json with:

{
  "helpers": {
    "Nightmare": {
      "url": "http://localhost"
    },
    "Mailbox": {
      "require": "node_modules/codeceptjs-tempmail"
    }
  }
}

Mailbox

Extends Helper

Helper with disposable mailbox api that is availible within test execution.

Parameters

  • config

constructor

Parameters

  • config Object configuration can be overridded by values found in codecept.json

createMailbox

Parameters

  • name string? Optional string to be used in mainlbox address

Examples

I.createMailbox('testmail') //{address: "[email protected]", messages: {error: "there are no messages yet"}}
I.createMailbox() //{address: "[email protected]", messages: {error: "there are no messages yet"}}

Returns object Creates a mailbox object and checks for mail before returning.

deleteLatestMessage

Parameters

  • mailbox object? Takes a mailbox object and detletes the last (i.e. most recent) value from messages and the mail server. (optional, default this.mailbox)

getMailbox

Parameters

  • debug boolean Logs the mailbox out to the console to aid debugging. (optional, default false)

Returns any The mailbox object in it's current state, i.e. if you have called the methods elsewhere in this file without arguments, the Mailbox object is updated internally. This returns it.

getMailbox

Returns any The mailbox object in it's current state, i.e. if you have called the methods elsewhere in this file without arguments, the Mailbox object is updated internally. This returns it.

getLatestMessage

Parameters

  • mailbox any {object=} mailbox - Takes a mailbox object and assigns a mailbox.latest object with the last (i.e. most recent) value in the messages array returned from the server. (optional, default this.mailbox)

getMailById

Parameters

  • id string Takes a mail_id string and returns it from the mailbox.messages array

waitForMessage

Parameters

  • mailbox object? Takes a mailbox object and makes 10 attempts at retrieving messages from the server. Once a suitible response is recieved the mailbox.messages and mailbox.latest are updated. (optional, default this.mailbox)

Example

Feature("Create Account");

Scenario("Create account email", function* (I) {
    // Process initiated from an email with a link to create an account.
    I.waitForMessage();
    mailbox = yield I.getMailbox();
    //I.grabRegex() should be replaced with a regex function that extracts a value from the supplied email text.
    createLink = yield I.grabRegex(null, mailbox.latest.mail_text_only);
});

Scenario("Create Account", (I) => {
    I.amOnPage(createLink);
    I.waitForText("Create a New Account");
    I.click("Create a New Account");
    I.fillField("password", "Som3Rand0mPa55");
    I.fillField("confirmPassword", "Som3Rand0mPa55");
    I.click("Create Account");
    I.waitForText("Activate Your Account");
    I.see("Activate Your Account");
    I.see(`An email has been sent to ${mailbox.address}`);
    
    I.deleteLatestMessage(mailbox);
    //Delete can take a few seconds to register with the temp-mail server, it's recommended that an arbitrary wait is used in your scenario.
    I.wait(10);
});

Scenario("Activation Email", function* (I) {
    // Wait for new activation email
    I.waitForMessage();
    mailbox = yield I.getMailbox();
    activationLink = yield I.grabRegex(null, mailbox.latest.mail_text);
});

Scenario("5862 Login", (I) => {
    I.amOnPage(activationLink);
    I.waitForText("Email Address Verified");
    I.see("Login");
    I.fillField("username", mailbox.address);
    I.fillField("password", "Som3Rand0mPa55");
    I.click("Login");

    I.deleteLatestMessage(mailbox);
    I.wait(10);
    I.getMessages();
});