Unable to establish connection of TestCafe to docker chrome headless

Viewed 932

I have all my setup on AWS EC2 and I'm using Jenkins for my test jobs. It seems pretty difficult to install chrome in AWS so that easiest option for me is to get the docker chrome for my tests. I'm using this docker image and running the container using the command docker run -p 3000:3000 -d browserless/chrome.

As per the TestCafe documentation, I'm using the remote browser connection to trigger my tests. I'm not getting any error but looks like the connection hangs and here is the output:

+ node awsrunner.js
http://localhost:1337/browser/connect/6M9cgTu
<<spinning wheel here>>

I'm not sure how do I establish a connection with the headless chrome through TestCafe so that I can run my tests.

1 Answers

I suggest you use the testcafe-browser-provider-browserless plugin instead.

As for the remote browser connection, it provides an URL (http://localhost:1337/browser/connect/6M9cgTu in your case) that you should visit from a remote browser. Once the browser connects to it, tests start running. This URL is autogenerated and can differ every time tests are launched.

UPD: see the guide about the use of TestCafe in Docker: https://devexpress.github.io/testcafe/documentation/guides/advanced-guides/use-testcafe-docker-image.html

Related