0

I'm trying to run testcafe in our pipeline (Semaphore) using a docker image based on the official one, where the only additions are copying our tests inside it and install some other additional npm packages used by them. Those tests run against a test environment, that for security reasons can only be accessed either via VPN or a proxy. I'm using the --proxy flag but the test run fails with the message:

ERROR Unable to establish one or more of the specified browser connections
1 of 1 browser connections have not been established:
- chromium:headless 
Hints: 
- Use the "browserInitTimeout" option to allow more time for the browser to start. The timeout is set to 2 minutes for local browsers and 6 minutes for remote browsers. 
- The error can also be caused by network issues or remote device failure. Make sure that the connection is stable and the remote device can be reached.

I'm trying to find out what's the problem, but as testcafe doesn't have a verbose mode, and the --dev flag doesn't seem to log anything anywhere; so I don't have any clue why it's not connecting. My test command is:

docker run --rm -v ~/results:/app/results --env HTTP_PROXY=$HTTP_PROXY $ECR_REPO:$TESTCAFE_IMAGE chromium:headless --proxy $HTTP_PROXY

If I try to run the tests without the proxy flag, they reach the test environment; can't run the tests as the page shown is not our app but a maintenace page served by default for connections outside the vpn or that doesn't come from the proxy.

If I go inside the testcafe container and run:

curl https://mytestserver.dev --proxy $HTTP_PROXY

it connects without any problem.

I've also tried to use firefox:headless instead of Chromium, but I've found out that it actually ignores the --proxy option altogether (reckon it's a bug).

We have a cypress container in that same pipeline going through that same proxy and it connects and runs the tests flawlessly.

Any insight about what the problem could be would be much appreciated.

Alex Skorkin
  • 4,264
  • 3
  • 25
  • 47
ejosafat
  • 401
  • 2
  • 12
  • You can collect the debug info by setting the `DEBUG` environment variable to `hammerhead:*,testcafe:*`, e.g.: `set DEBUG=hammerhead:*,testcafe:* testcafe chrome ./test.js 2> testcafe.log` Please share it here or create a new issue in the TestCafe GitHub repository: https://github.com/DevExpress/testcafe/issues/new?assignees=&labels=&template=bug-report.md – aleks-pro Jul 07 '21 at 08:54
  • Thanks for the tip! I'll create a new issue as the log is too long to post here; however I finally got access to our proxy logs and found that it's denying connections as for some reason the initial browser connection is routed through the proxy, as it's a local address, it denies it: TCP_DENIED/403 4464 GET http://172.17.0.2:1337/browser/connect/sYNp3vU - HIER_NONE/- text/html – ejosafat Jul 07 '21 at 16:25
  • @aleks-pro I opened an issue in the end: https://github.com/DevExpress/testcafe/issues/6363 – ejosafat Jul 07 '21 at 16:56

0 Answers0