testcafe: Parallel Firefox does not work using TestCafe Docker Image
What is your Test Scenario?
Parallel Firefox does not work using TestCafe Docker Image. Tried many times with many different settings and it only works when concurrency
is set to 1
.
2x fixture files that go to https://www.google.com
and check visibility of logo
Tried:
# Tried
docker run --rm -it -v tests/:/tests --shm-size=4g testcafe:latest '-c 2 firefox:headless' tests/**/*
# Tried
docker run --rm -it -v tests/:/tests --shm-size=4g testcafe:latest '-c 2 firefox -headless --incognito --disable-dev-shm-usage --display=:1.0 --profile="./firefox-profile" -MOZ_LOG_FILE="./asd.txt" -MOZ_LOG="timestamp,rotate:200,nsHttp:5,cache2:5,nsSocketTransport:5,nsHostResolver:5,sync"' tests/**/*
# Tried
docker run -v /app/:/app -v /tmp/.X11-unix:/tmp/.X11-unix --shm-size=4g -it --entrypoint /bin/sh testcafe/testcafe:latest
dbus-daemon --session --fork
Xvfb :1 -screen 0 "1280x720x24" >/dev/null 2>&1 &
export DISPLAY=:1.0
fluxbox >/dev/null 2>&1 &
PARALLEL=2 node ./node_modules/.bin/ts-node ./run-tests.ts
What is the Current behavior?
TestCafe runs indefinitely - does not end - or it fails with following error:
{ Error: Unable to establish one or more of the specified browser connections. This can be caused by network issues or remote device failure.
at BrowserSet._waitConnectionsOpened (/app/e2e-tests/node_modules/testcafe/lib/runner/browser-set.js:64:30)
at pinkie_1.default.resolve.then (/app/e2e-tests/node_modules/testcafe/lib/runner/browser-set.js:81:31)
at invokeCallback (/app/e2e-tests/node_modules/pinkie/index.js:60:12)
at Array.forEach (<anonymous>:null:null)
at publish (/app/e2e-tests/node_modules/pinkie/index.js:147:32)
at Array.publishFulfillment (/app/e2e-tests/node_modules/pinkie/index.js:152:2)
at Immediate.asyncFlush (/app/e2e-tests/node_modules/pinkie/index.js:17:19)
at runCallback (timers.js:706:11)
at tryOnImmediate (timers.js:676:5)
at processImmediate (timers.js:658:5)
at process.topLevelDomainCallback (domain.js:120:23)
code: 'E1004', data: [] }
What is the Expected behavior?
Firefox works properly in parallel using provided TestCafe Docker image.
Steps to Reproduce:
- Create 2 simple specs checking google.com
- Execute TestCafe using docker image with “firefox:headless”
- Check if TestCafe passes
Your Environment details:
- testcafe version: 1.5.0 + 1.4.0 + 1.2.1
- node.js version: 10.15
- command-line arguments: firefox:headless
- browser name and version: Firefox 68.0.0 / Linux 0.0.0
- platform and version: Docker TestCafe started on macOS 10.14.5
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 15 (4 by maintainers)
We have a similar issue which turns out to be the firewall issue. Maybe you can try to disable your firewall or specific
--hostname <an accessible domain or IP>
I just want to report my findings here, maybe they help other people 😃 (also the other related issues are locked)
I am using Ubuntu 18.04 dockerized with Firefox 71. And it just did nothing and had disconnects a.s.o What fixed it for me was:
-video
recording options for firefoxshm-size
to 2GBUPDATE: I got it working on local machine on MacOS but currently not on ubuntu 18.04 inside docker ce 19. Currently I am very lost why it works on docker macos and not on ubuntu, but I will further investigate. This is what works on MacOS but not on Ubuntu: https://gist.github.com/csgruenebe/c33e01e601580175fc1e72d88f1f2aa0
UPDATE 2 I put everything together so you can see for yourself. Full repo with dummy app and very simple test. Story short: ✅ It works if you do NOT use
-headless
for firefox together with XvfbThe particular problem seems to originate with this line of code
https://github.com/DevExpress/testcafe/blob/master/src/compiler/index.js#L93
Workaround: Our team created a reproducible environment by using a large number of test files that must be compiled on a docker image with limited CPU. This led us to a workaround for anyone interested or blocked by this issue. The error can be avoided by moving the iteration for each test files outside of testcafe, thereby reducing the number of files that you request testcafe to compile.