Last active
August 29, 2015 14:07
-
-
Save ChrisLTD/f8bbdba2a8c35b6b0a61 to your computer and use it in GitHub Desktop.
Getting started with Phantom CSS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://github.com/Huddle/PhantomCSS | |
npm install phantomcss | |
sudo npm install -g casperjs | |
sudo npm install -g phantomjs | |
create minimally viable testsuite.js: | |
========= | |
var phantomcss = require('../node_modules/phantomcss/phantomcss.js'); | |
phantomcss.init({ | |
screenshotRoot: './csstests/screenshots', | |
failedComparisonsRoot: './csstests/failures', | |
libraryRoot: './node_modules/phantomcss/' | |
}); | |
casper.start( 'http://localhost/app/home' ); | |
casper.viewport(1024, 768); | |
casper.then(function(){ | |
casper.click(‘#some-button’); | |
phantomcss.screenshot('.global-terms-conditions', 'Global Terms & Conditions'); // will limit screenshot to element selected | |
}); | |
casper.then( function now_check_the_screenshots(){ | |
phantomcss.compareAll(); | |
}); | |
casper.then( function end_it(){ | |
casper.test.done(); | |
}); | |
casper.run(function(){ | |
console.log('\nTHE END.'); | |
phantom.exit(phantomcss.getExitStatus()); | |
}); | |
========= | |
To run tests: casperjs test pathTo/testsuite.js | |
Make some changes, then run tests again to see diffs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment