Skip to content

Grunt task for taking screenshots via BrowserStack's screenshot API.

License

Notifications You must be signed in to change notification settings

MarkusPint/grunt-browsersnapsy

 
 

Repository files navigation

grunt-browsersnapsy

Grunt task for taking screenshots via the BrowserStack screenshot API.

NPM

Build Status Build Status Circle CI Dependency Status

Getting Started

This plugin requires Grunt ~0.4.2

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-browsersnapsy --save-dev

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

grunt.loadNpmTasks('grunt-browsersnapsy');

The "browsersnapsy" task

Overview

In your project's Gruntfile, the browsersnapsy task is available to use.

You can run grunt browsersnapsy standalone Or add it to an existing task: grunt.registerTask('test', ['clean', 'browsersnapsy']);

Options

options: {
  user: '<username>',
  token: '<access token>',
  downloadTo: '<path to where screenshots should be saved>',
  statusDelay: '<Delay between task polling BrowserStack for the screenshots\' status>',
  waitTime: '<Initial delay for request to be made>',
  abort: '<max number of pings for screenshot (* statusDelay)>',
  tunnel: '<passed to node-BrowserStackTunnel>'
}

The browserstack option object will be passed as the JSON-body in the request to BrowserStack. It can contain anything as specified in the docs. You might check the example here. For local tunnled testing please refer to node-BrowserStackTunnel and the local testing documentation at BrowserStack.

Developing & Contributing

Developing on the task alone is fairly easy just git clone https://github.com/tdeekens/grunt-browsersnapsy.git then cd grunt-browsersnapsy. From there one has to link the package to itself via npm link && npm link grunt-browsersnapsy which will allow for calling grunt dev. Now just work the task/browsersnapsy.js and check results - feel free to submit a pull-request!

Release History

  • 0.0.1 First release - proof of concept
  • 0.0.2 Improved error handling with BrowserStack's API
  • 0.0.3 Handle authentification errors with BrowserStack
  • 0.0.4 Prettifies logging of status
  • 0.0.5 Add immediate downloading of available screenshots
  • 0.0.6 Add support for maximum amount of tries to fetch screenshots
  • 0.1.0 Add support for local testing (tunneling)
  • 0.1.1 Improves logging of screenhots' status

Roadmap

  • Automatic image diffing against reference screenshots

About

Grunt task for taking screenshots via BrowserStack's screenshot API.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%