Running Headless Acceptance Tests in PhantomJS

Acceptance tests are the way in which we assure that our application meets the needs of the users. In most Rails applications, an acceptance test performs a black box test against the HTTP endpoints and routes.

When our application uses a lot of JavaScript—as our Angular-powered typeahead search does—it’s often necessary for our acceptance tests to execute the downloaded HTML, CSS, and JavaScript in a running browser, so we can be sure that all of the DOM manipulation we are doing is actually working.

Typically, developers would use Selenium, which would launch an instrumented instance of Firefox, running it on your desktop during the acceptance testing phase. This is quite cumbersome and slow, ...

Get Rails, Angular, Postgres, and Bootstrap now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.