Plugin to do CSS regression testing via PhantomCSS.
Automate CSS regression testing with PhantomCSS
This plugin requires Grunt
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-phantomcss --save-dev
In your project's Gruntfile, add a section named
phantomcss to the data object passed into
The test files to run.
The screenshots directory where test fixtures (comparison screenshots) are stored. Baseline screenshots will be stored here on the first run if they're not present.
The directory to store source, diff, and failure screenshots after tests.
The viewport size to test the site in
[width, height] format. Useful when testing responsive layouts.
The CasperJS log level. See CasperJS: Logging for details.
Run tests in
test/visual/ against comparison screenshots stored in
test/visual/screenshots/, and put the resulting screenshots in
Run tests in
test/visual/ against comparison screenshots for destop and mobile.
Test files should do the following:
You can also load a local file by specifying a path (relative to the Gruntfile):
Your first test file should use
Subsequent files should call
casper.then to continue the previous test.
You can also use
casper.thenOpen to load a new url and continue testing in subsequent files instead of
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.