Testcafe: ERROR Unable to establish one or more of the specified browser connections

Created on 13 Jan 2017  路  10Comments  路  Source: DevExpress/testcafe

Are you requesting a feature or reporting a bug?

bug

What is the current behavior?

when I launch test with nightmare (using testcafe-browser-provider-nightmare) i get
ERROR Unable to establish one or more of the specified browser connections. This can be caused by network issues or remote device failure.

I use amazone EC2 instance,
also i open some ports from amazon console, and runt tests using "DEBUG=* testcafe nightmare tests/ --ports 9991,9992 --hostname 127.0.0.1" - no luck(

What is the expected behavior?

test results expected

How would you reproduce the current behavior (if this is a bug)?

fails at any test

Provide the test code and the tested page URL (if applicable)

Tested with test.js example from testcafe

Specify your

  • operating system: ubuntu 14.04
  • testcafe version: 0.12.0-alpha4
  • node.js version: 4.2
Auto-locked

Most helpful comment

Chrome needs the --no-sandbox flag in a Docker container, or container should be started in privileged mode.

testcafe 'chrome --no-sandbox' tests/

All 10 comments

Hello, Eldar! Likely it's because the nightmare browser requires an X11 display server on Linux, which is not enabled by default on Amazon EC2. It required to install and run Xvfb; required commands depend on a distribution that you use in your instance. E.g. for Debian-based distros, including Ubuntu, it is like:

apt-get install xvfb
Xvfb :99 -ac -screen 0 1024x768x16
export DISPLAY=:99.0
testcafe nightmare tests/

Hi Andrey,
It works!!

I use "xvfb-run" to run this tests,

Thanks!

Hi how to run xvfb-run? what's the options?

Hello @jackyxiao126, it's likely

xvfb-run --server-num=99 --server-args='-ac -screen 0 1024x768x16' testcafe ...

Check the xvfb-run manual.

Could get Jenkins in Docker to run TestCafe with Firefox and Nightmare, but not Chrome/Chromium.

xvfb-run -a --server-args='-ac -screen 0 1024x768x16' npm run jenkins-testcafe

Chrome needs the --no-sandbox flag in a Docker container, or container should be started in privileged mode.

testcafe 'chrome --no-sandbox' tests/

Hi Everyone,
I am facing the same issue when running tests in Jenkins env using Firefox browser.
Unable to establish one or more of the specified browser connections. This can be caused by network issues or remote device failure.

@AndreyBelym
Could you please help me here?

Hi @avozicov,if it's a headless Linux server you should check that you've configured Xvfb: https://github.com/DevExpress/testcafe/issues/1133#issuecomment-272447990. Or you can try to use Firefox 57+ in headless mode.

If it's a WIndows server, and you configured Jenkins to run as a service, you can try to start Jenkins from command line, or follow this article to enable GUI for the Jenkins service.

I had the same issue with the Travis CI setup for the open source project I am working on.
The changes made the work again.

Github PR

Testcafe itself has a documentation page for such topics.
Documentation

This thread has been automatically locked since it is closed and there has not been any recent activity. Please open a new issue for related bugs or feature requests. We recommend you ask TestCafe API, usage and configuration inquiries on StackOverflow.

Was this page helpful?
0 / 5 - 0 ratings