I have been having problems with my tests timing out and failing randomly. I have been looking around for best practices of how to write robust capybara integration tests but I don't find anything helpful.
Ever since we started writing a bunch of tests our CI server has been failing randomly, making our app look ver unstable, but the tests always (mostly) pass locally.
I want to find out how you and other experienced BDD/TDD gurus handle:
Any help would be appreciated.
To follow up on this. I appreciated @jonleighton's invitation to file a bug on poltergeist, but the problems that I encountered were related to two separate problems:
I have found that in many cases I can help my integration tests be more deterministic by taking advantage of Poltergeist's blacklist feature. In my case, I have blacklisted host names like the following.
typekit.net
facebook.net
facebook.com
google.com
google-analytics.com
...
The idea is to turn off anything that a) is not really needed for testing and b) could affect the page load completion under the CI environment. I have noticed this helps tremendously. Also, using this PhantomJS option with Poltergeist helps too:
phantomjs_options: ['--ignore-ssl-errors=yes']
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With