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

nightwatch-data-driven

v0.0.8

Published

Provides tool for emulating data driven tests in Nightwatch.js.

Downloads

26

Readme

nightwatch-data-driven

Provides tool for emulating data driven tests in Nightwatch.js.

Installation

npm i nightwatch-data-driven --save

Example 1: Simple usage

import DataDrivenTest from 'nightwatch-data-driven';
import {authConfig}  from '../configs/auth';

var test = {
    after: function (browser) {
        browser.init();
    },
    'Valid credentials => successfull login': function (browser) {
        // . Initialize DataDrivenTest with browser and AAA function
        //   and call it for a set of test cases
        new DataDrivenTest(browser, function(data, name){
            // . Arrange
            browser.logout();
            // . Act
            browser.page.login().loginAndWaitForRedirect(data.email, data.pass);
            // . Assert
            browser.page.workspace().assertIsCurrentPage(name);
        })
        .forCases({
            "Valid credentials": {email: authConfig.main.EMAIL, pass: authConfig.main.PASS},
            "Ignore leading space in email": {email: ' ' + authConfig.main.EMAIL, pass: authConfig.main.PASS},
            "Email in upper case": {
                email: authConfig.main.EMAIL.toUpperCase(),
                pass: authConfig.main.PASS,
                disabled: true
            }
        });
    },
    after: function (browser) {
        browser.end();
    }
};
export = test;

Example 2: Building and reusing of "test blanks"

import DataDrivenTest from 'nightwatch-data-driven';
import {mother} from '../mother';

// . Create "test blank"
let submitLoginForm = new DataDrivenTest()
	.withArrange(function(cb) {
		this.browser.logout(cb)
	})
	.withAct(function(dt) {
		this.browser.page.login().section.loginForm.fillAndSubmit(dt.email, dt.pass)
	});
	
 var test = {
    before: function (browser) {
        browser.init();
        // . Initialize "test blank" with browser
        submitLoginForm.withBrowser(browser);
    },
    'Login is invalid email: show error': function (browser) {
        // . Use "test blank" with specific assertion and test cases
        submitLoginForm
            .withAssert((dt, nm) => browser.page.login().assertNoProgress(nm))
            .forCases({
                "1. ": {email: "a", pass: mother.Valid.PASS},
                "2. ": {email: "@b", pass: mother.Valid.PASS},
                "3. ": {email: "@b.", pass: mother.Valid.PASS},
                "4. ": {email: "@b.c", pass: mother.Valid.PASS},
                "5. ": {email: "a@b", pass: mother.Valid.PASS},
                "6. ": {email: "a@b.", pass: mother.Valid.PASS},
                "7. ": {email: "[email protected]", pass: mother.Valid.PASS},
                "8. ": {email: "й@ц.ук", pass: mother.Valid.PASS},
            });
    },
    'Login is valid email: show progress': function (browser) {
        // . Use "test blank" with specific assertion and test cases
        submitLoginForm
            .withAssert((dt, nm) => browser.page.login().assertProgressDisplayed(nm))
            .forCases({
                "1. ": {email: "[email protected]"},
                "2. ": {email: "1#$%&'*+/=?^-_`{|}[email protected]"},
                "3. ": {email: "[email protected]"},
                "4. ": {email: "[email protected]"}
            });
    }
}
export = test;