Hey, long time no see, right? Quite a lots of things have happened to my tiny CasperJS pet project since then, which has just hit its 1.0 stable milestone. Merry Christmas :)
As a reminder, CasperJS is an open source navigation scripting & testing utility written in Javascript and based on PhantomJS — the scriptable headless WebKit engine.
Now some scary metrics about the project:
- the project has now more than 1000 stargazers and 150 forks on github
- more than 900 commits have been pushed to the master branch (430 just for the documentation one)
- 47 people have contributed patches and docs to the project; I hereby want to hug them all!
- 683 tests ensure the software is actually stable
- 387 members are subscribed to the mailing-list
- 88 questions have been posted on Stack Overflow about CasperJS
- 400 people are following the @casperjs_org twitter account
Btw here’s a short excerpt of what people are saying on twitter about it:
---Trying out CasperJS. I am blown away casperjs.org
— Beau (@beaumartinez) December 19, 2012
---Selenium : j'ai jamais pu piffré. Casperjs c'est de la balle ! J'ai installé, et réalisé mes premiers tests en 15 minutes. Merci @n1k0
— Laurent Jouanneau (@ljouanneau) December 10, 2012
Turns out that @phantomjs with casperjs for headless, in-browser integration testing is rather awesome. Recommended.
— Boris Terzic (@boristerzic) Décembre 4, 2012
---
---@n1k0 Thanks for CasperJS. If we ever meet in person, I owe you a beer.
— Stephen Hay (@stephenhay) November 30, 2012
sweet goodness -- Phantom.JS + Casper.JS is what we always wanted for testing client-side stuff
— christian verkerk (@chrisverkerk) November 27, 2012
</brag><realism>
That makes a lot of attention — and therefore expectations — for what started as a tiny helper script on top of PhantomJS… and put a bit of pressure on my shoulders :)
So what’s new in CasperJS 1.0?
Lots of stuff, and I mean it. In no particular order:
- added a
casperjs test
command to run test scripts - added support for CSS3 and XPath selectors
- added support for popups and (i)frames
- there’s now a way to specify how many tests were planned when
done()
is called - easy access of current HTTP response object as the first parameter of step callbacks (thx oncletom!)
- many new assertions methods have been added to the
Tester
class - added a convenient Batch script for Windows users that’s where you gotta love your community
- better contextualization of errors, nicer output of them
- XUnit XML test result logs now contain the duration of each test case
- added many new events and filters so you can hook quite wherever you want into the casper asynchronous workflow
- better compliance with PhantomJS’ native
evaluate()
argument passing - plus many bugfixes, refactors and other enhancements
As a side note:
The CasperJS ecosystem
As I realized that opensource projects based on CasperJS were created, I decided to open a dedicated github organization, first for trying to list them in a central place.
Some interesting CasperJS-based projects:
- SpookyJS, which basically allow driving CasperJS from Node.js
- resurectio, a Chrome extension for recording your casper tests
- casper-chai extends Chai with assertions for CasperJS
- grunt-casperjs and grunt-functional, both based on grunt, allowing to launch your CasperJS tests as well as other javascript build operations in a single command line call
- PhantomCSS, which provides integration of js-imagediff with PhantomJS (and CasperJS) for automated visual regression testing
- yadda, which has just started but is genuinely exciting, intends to bring BDD to CasperJS
- … and many other cool & useful projects
The future
- CasperJS 1.1 is on its way starting today, and will provide new features and bugfixes, trying not to reinvent the casper wheel
- CasperJS 2.0 will probably be a big
rewriterefactor of the 1.x codebase, and will try to use more of the existing javascript ecosystem (think mocha for instance)… but let’s enjoy the 1.x for a while first! and let me have a bit of sleep too
See ya.