protractor icon indicating copy to clipboard operation
protractor copied to clipboard

Jasmine timeout when running protractor on headless server with Xvfb or vncserver

Open adtrsa opened this issue 11 years ago • 5 comments

Hi

I get a timeout error when running my protractor tests on a headless server. Initially I tried getting the tests to run in Jenkins, but then realised I could replicate my error outside of Jenkins when executing from shell.

When I run the tests on my dev machine, no problem.

As soon as I run them on headless server (using either Xvfb or vncserver to provide display), I get the Jasmine timeout error.

I've tried it with or without selenium (latter by setting directConnect: true in protractor config), same result. I've tried setting the allScriptsTimeout and jasmineNodeOpts: {defaultTimeoutInterval: timeout_in_millis} timeouts, but all that happens then is that the test takes as long as the largest timeout value to fail.

I am running the tests on Ubuntu 14.04 LTS, protractor version 1.6.1.

Test and configuration is dead simple. Names of files reflect that this was for debugging Jenkins test runs :D

== BEGIN protractor_jenkins.conf ==

exports.config = {
  directConnect: true,
  chromeDriver: '../node_modules/protractor/selenium/chromedriver',
  capabilities: {
        browserName: 'firefox'
  },

  specs: ['e2e/jenkins.spec.js']
 };

== END ==

== BEGIN jenkins.spec.js ==

/**
Dead simple test to debug test execution on headless server.
*/
describe('angularjs homepage', function() {
  it('should have a title', function() {
    browser.get('http://www.angularjs.org');
    expect(browser.getTitle()).toEqual('AngularJS — Superheroic JavaScript MVW Framework');
  });
});

== END ==

Test run like so: export DISPLAY=:0 && Xvfb :0 -ac & ./node_modules/protractor/bin/protractor test/protractor_jenkins.conf

Error log to follow (stripped project name/paths from output):

== BEGIN error log ==

[launcher] Running 1 instances of WebDriver
browser.getTitle() : [object Object]
A Jasmine spec timed out. Resetting the WebDriver Control Flow.
The last active task was: 
Protractor.get(http://www.angularjs.org/) - test for angular
node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:345:15)
    at [object Object].Protractor.executeAsyncScript_ (node_modules/protractor/lib/protractor.js:247:26)
    at [object Object].Protractor.get (node_modules/protractor/lib/protractor.js:467:8)
    at [object Object].<anonymous> (test/e2e/jenkins.spec.js:6:13)
    at node_modules/protractor/node_modules/jasminewd/index.js:94:14
    at [object Object].webdriver.promise.ControlFlow.runInNewFrame_ (node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1654:20)
    at [object Object].webdriver.promise.ControlFlow.runEventLoop_ (node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1518:8)
    at [object Object].wrapper [as _onTimeout] (timers.js:252:14)
    at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)
F

Failures:

  1) angularjs homepage should have a title
   Message:
     timeout: timed out after 30000 msec waiting for spec to complete

== END ==

adtrsa avatar Feb 05 '15 06:02 adtrsa

Hey, @adtrsa!

Could this be the same problem of #1734?

Basically, it's a problem with Firefox 35 and the selenium webdriver.

If possible, I suggest you test it against Chrome or downgrade Firefox to 33~34.

By the way, looks like they fixed it already, but didn't release it yet.

ericmdantas avatar Feb 05 '15 09:02 ericmdantas

Hi @ericmdantas

Thanks for the reply, appreciate it.

The Ubuntu installations I run the tests on (dev or CI server) should be identical; except the one is operating in headless mode with the tests using an Xvfb provided display for rendering the browser windows (in theory :D).

I think I had issues with Chrome running in headless mode (failing outright due to some other WebDriver issues) so I tried to get it working with Firefox first. At least with Firefox it executes the tests, but they all time out.

I will try your suggestion to downgrade Firefox and report back the results.

adtrsa avatar Feb 05 '15 09:02 adtrsa

@ericmdantas So much for my assumption that my machines were using identical versions Firefox! Turns out dev machine uses Firefox 33 and CI server uses 35. So definitely going to do the downgrade now ;)

adtrsa avatar Feb 05 '15 09:02 adtrsa

@adtrsa, haha, it's ok.

We better close this one and focus on #1734, since julie is tracking the modifications there.

ericmdantas avatar Feb 05 '15 09:02 ericmdantas

Right, I thought the Firefox Selenium version should not be an issue since we are using the 'directConnect: true' option (bypassing Selenium). However, I have just confirmed Firefox 35 is the culprit here, even in directConnect mode. Upgraded my dev machine Firefox (less effort than downgrading the CI server FF) and now the tests break.

Thanks, closing issue.

adtrsa avatar Feb 05 '15 09:02 adtrsa