Replacing Selenium with Poltergeist
My friend @pellegrino gave me an awesome tip: to replace "Selenium" with "Poltergeist". For those who don't know, Poltergeist is a PhantomJS driver for Capybara. I've done it in some projects and it works very well!
In order to do it, include the gem to your
Update your Capybara configuration:
Run the specs!
If you are testing some
page.driver.browser.switch_to.alert.accept, you'll get this error:
undefined method `switch_to'
While I was trying to fix it, I found out that Poltergeist always returns
window.confirm. There's no way (at the moment) to make it return
false, but at least it won't prevent your test from passing: all I had to do was to remove that particular line and it solved the issue.
This is the results from the first project I've migrated:
Finished in 1 minute 35.45 seconds
Finished in 41.03 seconds
Hope you find it helpful as I did!