Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

grunt-webdriver

webdriverio1.9kMITdeprecated3.0.0

not maintained anymore

grunt-webdriver is a grunt plugin to run selenium tests with the WebdriverIO test runner

grunt, plugin, webdriverjs, webdriverio, webdriver, selenium, mocha, jasmine, cucumber, bdd, tdd, saucelabs, gruntplugin

readme

grunt-webdriver Code Climate Build Status Join the chat at https://gitter.im/webdriverio/grunt-webdriver

grunt-webdriver is a grunt plugin to run selenium tests with the WebdriverIO testrunner

Getting Started

This plugin requires Grunt ~1.0.1

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 --save-dev grunt-webdriver

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

grunt.loadNpmTasks('grunt-webdriver');

The "webdriver" task

Overview

In your project's Gruntfile, add a section named webdriver to the data object passed into grunt.initConfig(). Your test should contain a configFile property with a path to your wdio config. You can pass in additional options as cli arguments.

Run this task with the grunt webdriver command.

grunt.initConfig({
  webdriver: {
    test: {
        configFile: './test/wdio.conf.js'
    }
  },
  // ...
})

The plugin is an easy helper to run WebdriverIO tests using the wdio test runner. You can find more information about the test runner on our docs page.

Example using Sauce Labs

To use a cloud service like Sauce Labs make sure you define user and key properties like in the example below to authenticate yourself with your username and access key.

grunt.initConfig({
  webdriver: {
    options: {
        user: SAUCE_USERNAME,
        key: SAUCE_ACCESS_KEY
    },
    test: {
        configFile: './test/wdio.conf.js'
    }
  },
  // ...
})

Options

All options get passed into to the wdio testrunner. You should define your main configurations within your wdio config file. The plugin allows you to easy overwrite them. You can find all available cli arguments here: http://webdriver.io/guide/testrunner/gettingstarted.html

Contributing

Please fork, add specs, and send pull requests! In lieu of a formal styleguide, take care to maintain the existing coding style.

changelog

Release History

  • 2013-03-13   v0.1.1   first working version, without special features
  • 2013-03-14   v0.1.2   bugfixing, enhanced task option, improved test case
  • 2013-03-15   v0.1.3   added support for phantomjs, implemented reporter option
  • 2013-03-16   v0.1.4   save result of busterjs reporters to a file, use travis for CI testing
  • 2013-03-16   v0.1.5   added support for setUp function
  • 2013-03-16   v0.1.6   fixed WebdriverJS version
  • 2014-02-01   v0.2.0   rewrote plugin, replaced BusterJS with Mocha
  • 2014-03-13   v0.3.0   support Sauce Connect
  • 2014-03-16   v0.3.1   start selenium server and Sauce Connect tunnel only once
  • 2014-03-22   v0.3.2   make task work with absolute minimum required options - closes #11
  • 2014-03-13   v0.3.3   updated version of WebdriverJS
  • 2014-03-13   v0.4.0   pipe reporter output into file, expose flag to prevent spawing of selenium process
  • 2014-05-23   v0.4.1   updated dependencies
  • 2014-08-17   v0.4.2   updated webdriverjs dependencies
  • 2014-08-17   v0.4.3   fixed broke v0.4.3 version
  • 2014-09-18   v0.4.4   selenium server outputs log on stderr, implemented workaround
  • 2014-11-27   v0.4.5   Updated WebdriverIO package version, smaller bugfixes regarding file output
  • 2014-11-27   v0.4.6   Additional bugfixes
  • 2014-11-27   v0.4.7   check isLastTask properly
  • 2014-11-27   v0.4.8   bugfix
  • 2015-04-22   v0.5.0   updated selenium-standalone dependency
  • 2015-04-26   v0.5.1   better handling of different environments - closes webdriverio/webdriverio#506
  • 2015-06-04   v0.5.2   update selenium-standalone dependency
  • 2015-09-02   v1.0.0   let grunt-webdriver be a simple tool to run wdio testrunner tests
  • 2016-05-06   v2.0.0   rewritten code to es2016, updated WebdriverIO peer dependency to v4
  • 2016-05-06   v2.0.1   updated dependencies
  • 2016-10-25   v2.0.2   updated dependencies
  • 2016-12-09   v2.0.3   updated dependencies
  • 2018-12-30   v3.0.0   Update WebbdriverIO to v5