W3cubDocs

/Cypress

Projects

With Cypress, you have the ability to record your project’s tests.

You typically want to record when running tests in Continuous Integration, but you can also record your tests when running locally.

Setup

To set up your project to record, you must use the Test Runner.

Make sure you install and open it first!

Set up a project to record:

Setup Project Screen
  1. Click on the Runs tab of your project within the Test Runner.
  2. Click Set up Project to Record.
  3. You will need to log in to record your tests, so you will need to log in to the Cypress Dashboard here.
  4. Fill in the name of your project (this is only for display purposes and can be changed later).
  5. Choose who owns the project. You can personally own it or select an organization you’ve created. If you do not have any organizations, click Create organization. Organizations work just like they do in GitHub. They enable you to separate your personal and work projects. Read more about organizations.
  6. Choose whether this project is Public or Private.
    • A public project can have its recordings and runs seen by anyone. Typically these are open source projects.
    • A private project restricts its access to only users you invite.
  7. Click Setup Project.
  8. Now you should see a view explaining how to record your first run.
  9. After setting up your project, Cypress inserted a unique projectId into your cypress.json. If you’re using source control, we recommend that you check your cypress.json including the projectId into source control.
  10. Within Continuous Integration, or from your local computer’s terminal, pass the displayed Record Key while running the cypress run command.

    • Provide record key directly:

      cypress run --record --key <record key>
      
    • Or set record key as environment variable

      export CYPRESS_RECORD_KEY=<record key>
      
      cypress run --record
      

🎉 Your tests are now recording! As soon as tests finish running, you will see them in the Dashboard and in the Runs tab of the Test Runner.

Dashboard Screenshot Runs List

Identification

Cypress uses your `projectId` and Record Key together to uniquely identify projects.

Project ID

Once you set up your project to record, we generate a unique projectId for your project and automatically insert it into your cypress.json file.

The projectId is a 6 character string in your cypress.json

{
  "projectId": "a7bq2k"
}

This helps us uniquely identify your project. If you manually alter this, Cypress will no longer be able to identify your project or find the recorded builds for it.

If you’re using source control, we recommend that you check your cypress.json, including the projectId, into source control. If you don’t want your projectId visible in your source code you can set it as an environment variable using the name CYPRESS_PROJECT_ID. The exact mechanism for doing so depends on your system but could be as simple as:

export CYPRESS_PROJECT_ID={projectId}

Record key

The record key is used to authenticate that your project is allowed to record tests to the Dashboard Service. As long as your record key stays private, nobody will be able to record test runs for your project - even if they have your projectId.

If you have a public project you should still keep your record key secret. If someone knows both your record key and your projectId, they could record test runs for your project - which could mix up all of your results and be counted towards your usage during billing.

Think of your record key as the key that enables you to write and create runs. However, it has nothing to do with being able to read or see runs once they are recorded.

If your Record Key is accidentally exposed, you should delete it and create a new one.

Once you’re set up to record test runs, we automatically generate a Record Key for the project.

A record key is a GUID that looks like this

f4466038-70c2-4688-9ed9-106bf013cd73

You can create multiple Record Keys for a project, or delete existing ones from our Dashboard.

Record key in project settings

You can also find your Record Key inside of the Settings tab in the Test Runner.

Record Key in Configuration Tab

Record keys

See Record key for a full description of how the record keys are used.

Create new record key

  1. Go to your organization’s projects page.
  2. Select the project you want to change access to.Select a project
  3. Go to the project’s Settings page.Visit project settings
  4. Here you will see a Record Keys sectionRecord keys in Dashboard
  5. Click Create New Key. A new key will be automatically generated for your project.

Delete record key

  1. Go to your organization’s projects page.
  2. Select the project you want to change access to.Select a project
  3. Go to the project’s Settings page.Visit project settings
  4. Here you will see a Record Keys sectionRecord keys in Dashboard
  5. Click Delete beside the record key you want to delete.

Parallelization settings

Run completion delay

You can edit the number of seconds that a run will wait for new groups to join before transitioning to ‘completed’. See our parallelization guide to learn more.

Run completion delay settings

GitHub Integration

You can integrate your project with GitHub and edit its settings from within the project settings page.

Visit project settings

See our GitHub Integration guide to learn more.

Access to Runs

Visit your project settings to see who has access to your project’s runs.

Visit project settings

Public vs Private

  • Public means that anyone can see the recorded test runs for the project. It is similar to how public projects on GitHub, Travis CI, or CircleCI are handled. Anyone who knows your projectId will be able to see the recorded runs for public projects.

  • Private means that only users you invite to your organization can see its recorded runs. Even if someone knows your projectId, they will not have access to your runs unless you have invited them.

Change project access

  1. Go to your organization’s projects page.
  2. Select the project you want to change access to.