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

nadda

v0.6.1

Published

A zero config plugin for BDD acceptance testing in the browser using a combination of yadda and nightwatch

Downloads

14

Readme

nadda Build Status Coverage Status

A zero config plugin for BDD acceptance testing in the browser using a combination of yadda, nightwatch, selenium, chromedriver, phantomjs and iedriver (if applicable).

Install

$ npm install nadda

Command Line

nadda includes a command-line test runner to easily run a suite e.g.

nadda -f 'tests/**/*.feature' -s 'tests/**/*.steps.js'

Things to note:

  • If using globbing in paths you may need to surround in quotes to stop the OS from resolving these prior to passing to nadda.
  • Globbed file paths don't support the use of ~.

The test runner supports a number of run-time options. To view all, run the following:

$ nadda --help

| Name | Shortname | Default | Description |-------------- |-----------|---------------|------------------------------- | features | f | ['**/*.feature', '!node_modules/**/*'] | globs to select feature files. | steps | s | ['**/*.steps.js', '!node_modules/**/*'] | globs to select steps files.
| config | c | | file path to local nightwatch.json if you want to override/add to nightwatch config. | localisation | l | | selects the Yadda localisation library to pass to step files. | env | e | PHANTOMJS | selects the browser environment to use. | tags | t | | tags to determine which scenarios to run.--tags ~@wip will run scenarios that do not have the @wip tag.--tags @wip will run scenarios that have the @wip tag.--tags ~@wip,@feature will run scenarios that do not have the @wip tag AND have the @feature tag. --tags ~@wip --tags @feature will run scenarios that do not have the @wip tag OR have the @feature tag.

API

nadda can be required into a project exposing a function which takes the same options as the command line tool and returns a promise. A list of possible yadda localisations and environments can be found under nadda.LOCALISATIONS and nadda.BROWSERS respectively.

var nadda = require('nadda');
nadda({
  features: 'tests/**/*.js',
  steps: 'tests/**/*.steps.js',
  config: 'path/to/nightwatch.json',
  localisation: nadda.LOCALISATIONS.ENGLISH,
  env: nadda.BROWSERS.CHROME,
  tags: [['~@wip', '@feature'], ['@done']]
}).finally(function () {
  //do something
});

Writing Yadda Steps

Step files should be written as CommonJS modules exporting a single function that will, at runtime, be passed a yadda library (the type of which can be defined using the 'localisation' option) on which to register steps e.g.

module.exports = function (lib) {
    lib.when(/I type in (\w*)/, function (searchTerm) {
        this.browser.setValue('input#search_form_input_homepage', searchTerm);
    })
    .when('I click search', function () {
        this.browser.waitForElementVisible('input#search_button_homepage', 1000)
            .click('input#search_button_homepage')
            .pause(1000);
    });
};

Each step itself has access to the nightwatch browser object (this.browser) and a context object (this.ctx). The context object can be used to pass data between steps and is initially populated with the amalgamated annotations (this.ctx.annotations) of the feature and scenario currently being run (if a feature and scenario annotation of the same name exist the scenario annotation will win out).