It's a headless testing tool. Description taken from: https://www.npmjs.com/package/casperjs CasperJS is a navigation scripting & testing utility for PhantomJS and SlimerJS (still experimental). It eases the process of defining a full navigation scenario and provides useful high-level functions, methods & syntactic sugar for doing common tasks such as:
- defining & ordering navigation steps
- filling forms
- clicking links
- capturing screenshots of a page (or an area)
- making assertions on remote DOM
- logging & events
- downloading resources, even binary ones
- catching errors and react accordingly
- writing functional test suites, exporting results as JUnit XML (xUnit)
- first install phantomjs and casperjs globally with
install.sh
so you can use it in the terminal. Alternatively you can brew install both of them.- For documentation on installation visit http://docs.casperjs.org/en/latest/installation.html
- Next create a
tests
folder in your project directory to house your tests - Create a js file like you see below or something similar to accomplish what you are looking for
- For documentation on casperjs scripts visit https://github.com/casperjs/casperjs/tree/master/samples
- Start using it. In this specific gist example, we take a screenshot of a twitter account the user enters like: Usage: $ casperjs tests/screenshot.js
twitter-account
filename.[jpg|png|pdf]
- Alternately you can create your own npm scripts for various preconfigured tests and do things like fill out a form, then take a screenshot. Click a button, and then take a screenshot, take a screenshot at mobile, tablet, and desktop size, etc.