1

I'm struggling with testing my app with my Cypress with docker, I use the dedicated docker image with this command : docker run -it -v $PWD:/e2e -w /e2e cypress/included:8.7.0

I have ALWAYS this error when I launch it : `Could not find a Cypress configuration file, exiting.

We looked but did not find a default config file in this folder: /e2e`

Meaning that cypress can't find the cypress.json but it is precisely in the dedicated folder, here is my directory/file tree :

pace    
   front
      cypress
      cypress.json

So this is a standard file tree for e2e testing, and despite all of my tricks (not using $PWD but using full directory path, reinstall docker, colima engine etc. nothings works, and if I run npm run cypress locally everything works just fine !

Needless to say that I am in the /pace/front directory when I'm trying these commands

Can you help me please ?

Antoine Deloy
  • 75
  • 1
  • 3
  • 6
  • Have you also tried passing the cypress.json explicitly by using the —config-file flag as described here: https://docs.cypress.io/guides/guides/command-line#cypress-run-config-file-lt-config-file-gt (assuming you are using cypress run to execute your tests) – Sebastiano Schwarz Jan 12 '22 at 19:59
  • Yep i tests this wih an entry point on this ocker and specify the --config-file option, does not work either :/ – Antoine Deloy Jan 13 '22 at 16:16

1 Answers1

0

The -v $PWD:/e2e is a docker instruction to mount a volume (a bind mount). It mounts the current directory to /e2e inside the docker container at runtime.

In the docs it mention a structure where it expects the cypress.json file to end up directly under /e2e. To get it do be like this you have to do either:

  • -v $PWD/pace/front:/e2e
  • run the command from inside the pace/front directory

Since the CMD and ENTRYPOINT commands in docker run from the WORKDIR you could also try running it from where you were but changing the workdir as: -w /e2e/pace/front I have not seen their dockerfile, but my assumption is that that would work. My personal choice would be to just run it from pace/front

Chai
  • 1,796
  • 2
  • 18
  • 31