CasperJS is a navigation scripting and testing utility for PhantomJS.
Since the setup is really simple, I wondered if CasperJS can be used for testing a Rails application and more so, how hard it is to run those tests on Semaphore.
Here is a single test that visits the posts page and checks if everything is in order:
The full example repository can be found here.
The setup includes a few steps:
– preparing the Rails application
– installing CasperJS (PhantomJS is already available on Semaphore)
– loading test data
– running the Rails application server
– executing CasperJS tests
This translates nicely into several Semaphore build commands:
The result looks pretty green:
It’s worth noting that in this setup CasperJS tests don’t run in isolation: there are no database transactions so state persists across the whole test suite.
The right tool for the job
If you do want use CasperJS in a Rails project, consider crafting a Rake task that can serve a similar purpose as the build commands from above.
What cool and unusual tools are you using in your project? Anything interesting in your Semaphore build commands? Let us know!