At work we have an automation suite for one of our apps that is set to run on every commit to master/deploy to prod and for a long long time we've been having issues trying to make it reliable enough.
The tests are run in Jenkins using Selenium webDriver + Chrome + xvfb as the display server. We know the tests work because if we run them locally on our laptops (me and 2 friends had tried it) they run perfectly every single time but they fail almost every time in Jenkins. The almost being the keyword as they do work there too... just once every 5 times or so.
And when they fail they don't always fail at the same spot. Sometimes it's a timeout while waiting for an element, sometimes the test ends up in an error page that shouldn't have reached in the first place and I have no idea how it got there... So yeah, it's frustrating.
We've tried a lot of different approaches to debug it. Re-writing the setup of each test to make sure everything is cleared up at the end of every single test so that the next one starts with a clean workspace/cache, making it so Selenium takes screenshots everytime it fails to see what happened, tried different versions of chromedriver/chrome/selenium, put the tests to run several times in a row to see if there was any pattern... and since I'm running out of ideas I've figured I could ask here!.
Is there any way I could set Selenium driver to record the entire flow instead of just taking a screenshot every here and there?. I would LOVE to be able to watch the tests running in Jenkins but I have no idea if that's possible or how to do it.
The tests use Java7 + Spring + TestNG 6.8.1 + Selenium 2.45.0 + XVFB as the display server.
Any thoughts or hints on what I could try?.