Poltergeist 1.0!

Almost a year ago, on a complete whim, I decided to try to hook up the headless browser PhantomJS with Ruby’s full-stack acceptance testing framework, Capybara.

After some furious prototyping I decided that the idea was a goer, but my initial progress towards a usable driver was dogged by segfaults and oddities coming from within WebKit.

If I’d known it was going to be such hard work then I probably wouldn’t have started, but after having written lots of code I wasn’t willing to give up. So I started learning about C++ and poking around the WebKit source code until I managed to solve my problems. Probably the biggest change I made was to implement proper handling of Javascript exceptions

  • before this, any error generated inside PhantomJS would be a mystery, since there was no stack trace to follow.

In January, I finally announced to project and started encouraging people to give it a try. Some time soon after we switch the Loco2 codebase onto it, pretty much halving our test time compared to Selenium. This provided some invaluable real-world feedback to help iron out bugs.

Since then, many many bugs have been fixed, and the user base has grown. The community around PhantomJS has also grown, and this has been a great benefit to Poltergeist because other people have been adding features to PhantomJS that we can then make use of.

Over the months I’ve seen lots of tweets from people who are using Poltergeist and liking it. This is probably my favourite thing about the project: just hearing about people’s successes feels awesome.

But the work isn’t over. Not everybody has a pain-free time. PhantomJS does sometimes crash, and I’m sure there are still bugs lurking in the Poltergeist codebase.

My aim from the start has always been to make Poltergeist the driver that fails as helpfully as possible.

I pretty much believe that full-stack testing will always be difficult and somewhat painful. I will continue trying to deal with bugs as much as possible, but I also place a great deal of value on having clear, helpful error messages and debugging aids. This is why I put effort into sorting out Javascript errors in PhantomJS, and adding remote web inspector support to Poltergeist.

One thing I should have done a long time ago is provide good documentation about troubleshooting. This also comes under the remit of failing helpfully, and so I’ve finally done that.

Thanks to everyone who has given Poltergeist a try, and especially to those who have contributed code. Tell all your friends, let’s make this thing even better!

Comments

I'd love to hear from you here instead of on corporate social media platforms! You can also contact me privately.

Dr Nic Williams's avatar

Dr Nic Williams

Congrats!

Justin Baker's avatar

Justin Baker

"In January, I finally announced".... links to localhost:3000.

Jon Leighton's avatar

Jon Leighton

Fixed it! Thanks

Jon Leighton's avatar

Jon Leighton

Fixed it! Thanks

Roger's avatar

Roger

I've been using it for a couple of months and it's really awesome, thanks for the hard work!

Karl Baum's avatar

Karl Baum

Would love to see a comparison to capybara-webkit. Is it faster? More stable? Handles more edge cases?

Jon Leighton's avatar

Jon Leighton

Yes ;)

A number of people have reported faster test times after switching from c-w to Poltergeist. Also being based on PhantomJS is a huge asset for Poltergeist, as PhantomJS is an active project getting new releases every 3 months. And you don't have to compile anything to install PhantomJS. At this stage Poltergeist also sees a lot more active development than c-w.

Matt Polito's avatar

Matt Polito

Thank you very much for the hard work. Tools like these make my everyday life a little better

Add your comment