Webdriverio: ESOCKETTIMEDOUT when launching tests in Jenkins

Created on 5 Apr 2018  ·  4Comments  ·  Source: webdriverio/webdriverio

The problem

I am not able to run tests several times in Jenkins. I can run tests in my local machine several times and it always works fine, but I am getting an ESOCKETTIMEDOUT error in Jenkins.

Environment

  • WebdriverIO version: happened with 4.10.1 and also updating to 4.12.0
  • Node.js version: 8.9.1
  • Standalone mode or wdio testrunner: standalone
  • if wdio testrunner, running synchronous or asynchronous tests: sync
  • Additional wdio packages used (if applicable): I am using cucumber-boilerplate

Details

Important to mention that when I get this error, I cannot recover (running again and again the job in Jenkins always produces the same error). But I've been able to run it 2-3 times without errors (so, I've seen it work).
Tests are launched in Chrome. Jenkins slave is a MacMini. Providing selenium host and port does not fix the issue.

Link to Selenium/WebdriverIO logs

Jenkins error with verbose loglevel is like:

+ yarn run local-webserver
yarn run v1.3.2
$ forever start -s ./node_modules/.bin/http-server ./demo-app -s
warn:    --minUptime not set. Defaulting to: 1000ms
warn:    --spinSleepTime not set. Your script will exit if it does not stay up for at least 1000ms
info:    Forever processing file: ./node_modules/.bin/http-server
Done in 0.44s.
+ yarn run wdio
yarn run v1.3.2
$ /Users/jenkins/workspace/family-portal-deploy-test/e2etests/node_modules/.bin/wdio
[18:48:07]  COMMAND POST     "/wd/hub/session"
[18:48:07]  DATA        {"desiredCapabilities":{"javascriptEnabled":true,"locationContextEnabled":true,"handlesAlerts":true,"rotatable":true,"maxInstances":5,"browserName":"chrome","loggingPrefs":{"browser":"ALL","driver":"ALL"},"requestOrigins":{"url":"http://webdriver.io","version":"4.12.0","name":"webdriverio"}}}
ERROR: ESOCKETTIMEDOUT
chrome
    at new RuntimeError (/Users/jenkins/workspace/family-portal-deploy-test/e2etests/node_modules/webdriverio/build/lib/utils/ErrorHandler.js:144:12)
    at Request._callback (/Users/jenkins/workspace/family-portal-deploy-test/e2etests/node_modules/webdriverio/build/lib/utils/RequestHandler.js:330:43)
    at self.callback (/Users/jenkins/workspace/family-portal-deploy-test/e2etests/node_modules/request/request.js:186:22)
    at emitOne (events.js:116:13)
    at Request.emit (events.js:211:7)
    at ClientRequest.<anonymous> (/Users/jenkins/workspace/family-portal-deploy-test/e2etests/node_modules/request/request.js:816:16)
    at Object.onceWrapper (events.js:313:30)
    at emitNone (events.js:106:13)
    at ClientRequest.emit (events.js:208:7)
    at Socket.emitTimeout (_http_client.js:708:34)
    at Object.onceWrapper (events.js:313:30)
    at emitNone (events.js:106:13)
    at Socket.emit (events.js:208:7)
    at Socket._onTimeout (net.js:407:8)
    at ontimeout (timers.js:475:11)
    at tryOnTimeout (timers.js:310:5)

error Command failed with exit code 1.

Code To Reproduce Issue

What Jenkins job is doing is very simple:

  • go to specific dir
  • set node version
  • yarn install
  • launch the tests with: yarn run wdio

Most helpful comment

For those who can be experiencing the same problem, I just tried with headless chrome and it is working fine for some days ago :D So add the "headless" chromeOption in your capabilities and see if it works.

All 4 comments

Looks like WebdriverIO can't establish a connection to the WebDriver backend (probably Chromedriver). This could be due to many reasons but it is unlikely that it is related to WebdriverIO. Something is not right with your driver setup. Maybe you run to many tests at the same time? There is nothing we can do to fix this in WebdriverIO. Therefor closing this. Feel free to reach out in our support Gitter if you have further questions.

Hi @christian-bromann thanks for your quick response.

I am concerned because I am only running one test (one feature), the login, and also as I mentioned I've been able to see it work in Jenkins for 2-3 times but then it started failing (always with the same error). Is it possible that the selenium/webdriver is not well disconnected/closed when the test is finished? Maybe there are some opened connections from previous runs?

I did other different tests (as I am testing different webs) and configured new jobs in Jenkins and found the same problem. First tests are working fine and then it started failing with ESOCKETTIMEDOUT.

Again, I can run those tests in local without problems and several times.

For those who can be experiencing the same problem, I just tried with headless chrome and it is working fine for some days ago :D So add the "headless" chromeOption in your capabilities and see if it works.

Hi @LaiaPR , I had the same problem today. As you suggested, adding "headless" option fixes the problem. Thanks!

Was this page helpful?
0 / 5 - 0 ratings