Cucumber test with Selenium and Ruby in Jenkins server fails but passes in local machine
<p>I have some cucumber tests made using the gem 'cucumber-rails'.</p>

<p>This tests use another gem called 'page-objects' (from cheezy) and in my tests I use Selenium and Chrome-driver.</p>

<p>To make the tests run in the Jenkins server (that has no X) I use the gem 'headless' and I've configured the server to use Xfvb (my local machine runs Elementary OS Freya 0.3.2 and the server runs Ubuntu 15.10).</p>

<p>When I run these tests in my local machine (also using headless), <strong>they all pass flawlessly</strong> every time. The same happens <strong>when I run the tests in Jenkins' server from the Terminal</strong>. </p>

<p>But <strong>when I run them on Jenkins CI, some fail</strong> (the error is "didn't find an element" - when the element is there). </p>

<p>Both tests fail because it cannot find an element (the element exists and when it fails I print the screen just to check what's happening. The page print show that it is on the right page and displays the element).</p>

<p>The strange thing is that they both fail at the second step (the first one is going to the login page and authenticate, which it does correctly). Also, there's another test that runs first that always passes (the tests have pretty much the same structure).</p>

<p>Both tests run over the same server (the webpage they access is the same and the data is the same).</p>

<p>I have looked at this over and over and I can't find any explanation. I know the problem is not very detailed, so if there's anything missing that might be important, just tell me and I'll update the post.</p>

<p>If you happen to know any reason why the tests might fail on a 'Xless' server, I would greatly appreciate it!</p>

<p>Thanks a lot for the help!</p>

<hr>

<p>Edit:
The failures are both "element not found" and the element is present.</p>

<p>I've also made the Jenkins user part of the sudoers.
Any ideas? </p>

<p>Thanks a lot</p>