Move cypress folder from the root of the project

If you want to directly specify from the command line which one to launch, you can use the project flag:

cypress open --project test

That's particularly useful if you have a monorepo with multiple cypress folders to test different apps.

project option direct link

example repo with usage

cypress run cli documentation


Cypress has a few configuration options to specify custom folder structure.

For that you will need to have cypress.json file in the root of your project and specify the following structure there for cypress to properly pick up the files in test/cypress/:

{
  "fixturesFolder": "test/cypress/fixtures",
  "integrationFolder": "test/cypress/integration",
  "pluginsFile": "test/cypress/plugins/index.js",
  "screenshotsFolder": "test/cypress/screenshots",
  "videosFolder": "test/cypress/videos",
  "downloadsFolder": "test/cypress/downloads",
  "supportFile": "test/cypress/support/index.js"
}

More info in the cypress docs.


If you are looking to move your Cypress "installation" directory which is being created when executing cypress open or cypress run, I suggest to follow this steps:

1) Run cypress with --project <directory> flag where directory is where you would like cypress to be installed. In my case I chose test directory:

cypress open --project test

2) Cypress should now create its startup directory in /test/cypress folder. Add your cypress.json file directly under /test (!) directory. If you are using TypeScript, you can add your tsconfig.json file there too.

3) In your cypress.json you can relatively configure your tests subdirectories. My file is:

{
  "projectId": "XXXXXX",
  "fixturesFolder": "cypress/fixtures",
  "integrationFolder": "ui",
  "screenshotsFolder": "cypress/screenshots",
  "videosFolder": "cypress/videos"
}

which means that my tests are under /test/ui directory and the rest within /cypress. I keep only fixtures, plugins, screenshots, videos, support dirs and the rest removed.

Works without issues. I hope that helps.