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

grunt-datadriver

v0.6.0

Published

grunt-datadriver is a grunt plugin to run selenium tests with Mocha and WebdriverIO

Downloads

5

Readme

grunt-datadriver is a grunt plugin to run selenium tests with Mocha and WebdriverIO

Getting Started

This plugin requires Grunt ~0.4.0

If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

npm install grunt-datadriver --save-dev

One the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks('grunt-datadriver');

The "datadriver" task

Overview

In your project's Gruntfile, add a section named datadriver to the data object passed into grunt.initConfig().

Run this task with the grunt datadriver command.

grunt.initConfig({
  datadriver: {
    options: {
        desiredCapabilities: {
            browserName: 'chrome'
        }
    },
    login: {
        tests: ['test/spec/login/*.js'],
        options: {
            // overwrite default settings
            desiredCapabilities: {
                browserName: 'firefox'
            }
        }
    },
    form: {
        tests: ['test/spec/form/*.js']
    }
    // ...
  },
})

Example using Sauce Labs

To use a cloud service like Sauce Labs make sure you define host and port properties like in the example below as well as authenticate yourself with your username and key.

grunt.initConfig({
  datadriver: {
    options: {
        host: 'ondemand.saucelabs.com',
        port: 80,
        user: SAUCE_USERNAME,
        key: SAUCE_ACCESS_KEY,
        desiredCapabilities: {
            browserName: 'chrome',
            version: '27',
            platform: 'XP'
        }
    },
    login: {
        tests: ['test/spec/login/*.js']
    },
    form: {
        tests: ['test/spec/form/*.js']
    }
    // ...
  },
})

Example using Sauce Connect

If you specify a tunnel-identifier within your desiredCapabilities object, the task will automatically try to establish a tunnel connection via Sauce Connect. With the tunnel-flags property you can pass command line options to the created Sauce Tunnel.

grunt.initConfig({
  datadriver: {
    options: {
        user: SAUCE_USERNAME,
        key: SAUCE_ACCESS_KEY,
        desiredCapabilities: {
            browserName: 'chrome',
            version: '27',
            platform: 'XP',
            'tunnel-identifier': 'my-test-tunnel',
            'tunnel-flags': [ '-vv', '-l sauce_connect_tech_support.log' ]
        }
    },
    login: {
        tests: ['test/spec/login/*.js']
    },
    form: {
        tests: ['test/spec/form/*.js']
    }
    // ...
  },
})

Options

All options get passed into the WebdriverIO remote function. So this is the place where you can define your driver instance. You'll find more informations about all WebdriverIO options here. You can overwrite these options in any target. Also you have to define all Mocha options here. The following are supported:

bail

Type: Boolean Default: false

If true you are only interested in the first execption

ui

Type: String Default: bdd Options: bdd | tdd | qunit | exports

Specify the interface to use.

reporter

Type: String Default: spec Options: Base | Dot | Doc | TAP | JSON | HTML | List | Min | Spec | Nyan | XUnit | Markdown | Progress | Landing | JSONCov | HTMLCov | JSONStream

Allows you to specify the reporter that will be used.

slow

Type: Number Default: 75

Specify the "slow" test threshold, defaulting to 75ms. Mocha uses this to highlight test-cases that are taking too long.

timeout

Type: Number Default: 1000000

Specifies the test-case timeout.

grep

Type: String

When specified will trigger mocha to only run tests matching the given pattern which is internally compiled to a RegExp.

updateSauceJob

Type: Boolean Default: false

If true it will automatically update the current job and does publish it.

output

Type: String Default: null

If set grunt-webdriver will pipe reporter output into given file path

quiet

Type: Boolean Default: false

If true it prevents the original process.stdout.write from executing - no output at all

nospawn

Type: Boolean Default: false

If true it will not spawn a new selenium server process (useful if you use Sauce Labs without Sauce Tunnel)

seleniumOptions

Type: Object Default: {}

Options for starting the Selenium server. For more information check out the selenium-standalone project.

seleniumInstallOptions

Type: Object Default: {}

Options for installing Selenium dependencies. For more information check out the selenium-standalone project.