0

TLDR: issues in running parallel cypress tests in docker containers at the same machine in jenkins.

I'm trying to run on single aws machine 2 docker instances of cypress to run different suite in parallel at the same time. I've encountered issues while seems that there's a collision on ports even though I've configured and exposed 2 unique and different ports on docker-compose.yml and on cypress.json files. he first container works but the the secnod one crashing on the error below:

✖  Verifying Cypress can run /home/my-user/.cache/Cypress/4.1.0/Cypress
→ Cypress Version: 4.1.0
Xvfb exited with a non zero exit code.

There was a problem spawning Xvfb.

This is likely a problem with your system, permissions, or installation of Xvfb.

----------

Error: _XSERVTransSocketUNIXCreateListener: ...SocketCreateListener() failed
_XSERVTransMakeAllCOTSServerListeners: server already running
(EE)
Fatal server error:
(EE) Cannot establish any listening sockets - Make sure an X server isn't already running(EE)

----------

Platform: linux (Ubuntu Linux - 18.04)
Cypress Version: 4.1.0

important note: I want to implementthe parallelization on my own and not use the feature --parallel in cypress , I need to implement it in house on the same machine only in encapsulated environment.

Any suggestions?

avivamg
  • 12,197
  • 3
  • 67
  • 61
  • The error seems to suggest that this is a problem with X11 and not with Cypress. Maybe that's where the port collision is happening? – Shafiq Jetha Jan 17 '21 at 11:58

1 Answers1

0

If I understood correctly all you need to do is to start cypress (in containers) with xvfb-run -a. E.g. xvfb-run -a npx cypress run --browser Chrome So -a will assign next available port number, means you can run multiple cypress containers in parallel. Check http://elementalselenium.com/tips/38-headless