grunt-huxley

Grunt task for node-huxley.

npm install grunt-huxley
49 downloads in the last week
214 downloads in the last month

Grunt-huxley

Grunt task runner for node-huxley.

  • Records your actions as you browse.
  • Takes screenshots.
  • Compares new screenshots against the old ones and checks for differences.

Installation

npm install grunt-huxley

Selenium Server is used to automate the recorded browser actions. If you already have it, skip this. Don't have it and don't want the hassle of managing it? Download the node wrapper instead.

API

If you're already familiar with node-huxley, the API takes only two minutes to get. If not, check out node-huxley first.

Options

action

One of record, playback and update. Default is playback.

browser

Either "firefox" or "chrome".

For source files, specify them the usual grunt way.

server

Used to run Huxley on a remote Selenium server.

Defaults to Selenium's defaults for each browser:

driver

You can specify your own driver. Create anonymous function which returns your driver.

Examples

Locally:

module.exports = function(grunt) {
  grunt.initConfig({
    huxley: {
      all: {
        options: {
          action: 'update'
        },
        src: ['./folderInWhichTheHuxleyfileJsonResides',
              '/folder2WithNestedFolders/**']
      }
  });

  grunt.loadNpmTasks('grunt-huxley');

  grunt.registerTask('default', ['huxley:all']);
};

Remotely:

module.exports = function(grunt) {
  grunt.initConfig({
    huxley: {
      all: {
        options: {
          action: 'playback',
          browser: 'firefox',
          server: 'http://somedomainName:4440/wd/hub'
        },
        src: ['./folderInWhichTheHuxleyfileJsonResides',
              '/folder2WithNestedFolders/**']
      }
  });

  grunt.loadNpmTasks('grunt-huxley');

  grunt.registerTask('default', ['huxley:all']);
};

Third-Party Driver, e.g. BrowserStack:

var webdriver = require('browserstack-webdriver');

module.exports = function(grunt) {
  grunt.initConfig({
    huxley: {
      all: {
        options: {
          action: 'playback',
          driver: function () {
            var capabilities = {
              'browserName' : 'firefox',
              'browserstack.user' : 'USERNAME',
              'browserstack.key' : 'ACCESS_KEY'
            }

            return new webdriver.Builder().
              usingServer('http://hub.browserstack.com/wd/hub').
              withCapabilities(capabilities).
              build();
          }
        },
        src: ['./folderInWhichTheHuxleyfileJsonResides',
              '/folder2WithNestedFolders/**']
      }
  });

  grunt.loadNpmTasks('grunt-huxley');

  grunt.registerTask('default', ['huxley:all']);
};
npm loves you