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-webdriver-jasmine2-runner

v0.3.11

Published

A grunt plugin that runs jasmine2 tests using webdriver.

Downloads

4

Readme

grunt-webdriver-jasmine2-runner

A grunt plugin that runs jasmine (v2.0+) tests using webdriver.

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 -D grunt-webdriver-jasmine2-runner

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

grunt.loadNpmTasks('grunt-webdriver-jasmine2-runner');

Setting up webdriver

Browser drivers will need to be installed for the browsers you plan to run tests on. If you use brew and want to run tests on Chrome, use the following command:

brew install chromedriver

The driver for firefox is included in the plugin.

The "webdriver_jasmine_runner" task

Overview

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

grunt.initConfig
  webdriver_jasmine_runner:
    your_target:
        options:
            # your options here

Options

Summary (w/ default values)

      seleniumJar: "#{__dirname}/lib/selenium-server-standalone-2.45.0.jar" # Only specified when starting a local selenium server
      seleniumServerHost: undefined # Only specified when running tests on a remote selenium server
      seleniumServerPort: 4444
      seleniumServerArgs: [] # Only specified when starting a local selenium server
      seleniumServerJvmArgs: [] # Only specified when starting a local selenium server
      browser: 'chrome'
      capabilities: {} #desiredCapabilities for the webdriver
      testServer: 'localhost'
      testServerPort: 8000
      testFile: '_SpecRunner.html'
      allTestsTimeout: 30 * 60 * 1000    # 30 minutes
      keepalive: false

options.seleniumJar

  • Type: String
  • Default value: "#{__dirname}/lib/selenium-server-standalone-2.45.0.jar"

The location of the selenium standalone server jar.

options.capabilities

  • Type: Object
  • Default value: {}

The desiredCapabilites passed to the webdriver

options.seleniumServerHost

  • Type: String
  • Default value: none

The hostname of a remote selenium server to use. If specified, a selenium server won't be started.

options.seleniumServerPort

  • Type: Number
  • Default value: 4444

The port number to use for the local selenium server when running locally or the remote selenium server when using a remote server.

options.seleniumServerArgs

  • Type: Array
  • Default value: []

Arguments to pass to the Selenium Server java command.

options.seleniumServerJvmArgs

  • Type: Array
  • Default value: []

JVM arguments to pass to the Selenium Server java command. (e.g. ['-Xmx256M'])

options.browser

  • Type: String
  • Default value: 'chrome'
  • Allowed values: 'chrome', 'firefox', 'internet explorer', ... source

The browser in which the tests will be run. This can also be specified via the --browser command-line option (below), which takes precedence.

options.testServer

  • Type: String
  • Default value: 'localhost'

The address of the server where the application is running.

options.testServerPort

  • Type: Number
  • Default value: 8000

The port where the application is running.

options.testFile

  • Type: String
  • Default value: '_SpecRunner.html'

The file to load that runs the jasmine tests.

options.allTestsTimeout

  • Type: Number
  • Default value: 30 * 60 * 1000 (30 minutes)

Time in milliseconds to wait for all of the tests to finish running.

options.symbolSummaryTimeout

  • Type: Number
  • Default value: 20000 (20 seconds)

Time in milliseconds to wait for the symbol summary to appear.

Command-Line Options

--browser=[chrome|firefox|internet explorer|...]

source

The browser in which the tests will be run. Takes precedence over the "browser" gruntfile option (above).

--keepalive=true

The selenium server and browser are not closed after the tests have been run. Useful for interactive debugging of failing tests.

--ignoreSloppyTests=true

The selenium server added a parameter to the query string of url passed to the browser to tell Jasmine to disable verification of proper tests cleanup.

--printTitles=true

Generates output of the spec title as test are run. e.g. Running Jasmine tests for '#{title}'

Output

This task:

  • logs the number of tests executed, the number of failed tests, and the full stack traces (Jasmine output) of any failing tests to the Grunt log.
  • fails if any tests fail.

Usage Examples

Default Options

This task isn't very useful by itself. A usual use case if to configure webdriver_jasmine_runner in a grunt.initConfig() call and combine it with other tasks with grunt.registerTask().

In this example, we start a connect server running the app. The jasmine:build task also creates an appropriate _SpecRunner.html file with the specs to be run.

grunt.initConfig
    webdriver_jasmine_runner:
        myProject:
            options: {}

grunt.registerTask 'browser:test', ['default', 'jasmine:build', 'connect', 'webdriver_jasmine_runner']

Contributors