cypresse2e-testingvideo-recordingcypress-configuration

Cypress recording


just wanted to ask if this is possible to change the location folder for recorded file? I am running tests for two different applications, one after another, and when tests are finished for both of them, I can only access the latest recording.

Thanks in advance!


Solution

  • You can add videosFolder attribute in your cypress config file with the folder path.

    videosFolder: 'cypress/videos_project_2'
    

    You can override the videosFolder path from the CLI, something like this:

    npx cypress run --config videosFolder=cypress/videos_project_2
    

    In your package.json, create two scripts like this:

    "scripts": {
      "test:project1": "npx cypress run --config videosFolder=cypress/videos_project_1",
      "test:project2": "npx cypress run --config videosFolder=cypress/videos_project_2",
    }
    

    Then as per the project, directly run the commands:

    npm run test:project1
    //or
    npm run test:project2