Skip to main content
Cypress 10 support is here! Upgrade your BrowserStack Cypress-CLI to v1.18.0 and start testing. Try now!

Set the record flag

Learn how to set the record flag and use the Cypress Dashboard service to view your test results.

Overview

Cypress record flag records your test runs and other details related to your Cypress tests and uses the Cypress Dashboard service to publish them to the dashboard. When you use this flag, your test results along with the screenshots, test status, etc. are published to both the BrowserStack and Cypress dashboards.

You must pass the record-key and the project-id flags along with the record flag to generate test results on the Cypress dashboard. Without either of the flags, though the Cypress build runs, the record functionality will not be supported. You can still see the test results on the Automate dashboard.

In this guide, you will learn about:

Note: The record flag feature is available in browserstack-cypress-cli v1.14.0 or higher. Run npm i -g browserstack-cypress-cli to ensure that the latest version is used.

Set record flag using browserstack.json

Add the record, record-key, and project-id key within the run_settings object in the browserstack.json file.

Key Accepted values
record Set as true to send test results to the Cypress dashboard.
record-key record-key generated for the project as defined on Cypress dashboard.
projectId projectId generated for the project as defined on Cypress dashboard. You can also find the projectId in the Cypress configuration file of your project.
Note: To locate the project-id and record-key of your Cypress project, navigate to Project > Project Settings in the Cypress dashboard. You can find the project-id and record-key under the General and Record Keys section, respectively.

The following code snippet shows a sample configuration.

//browserstack.json
"run_settings": {
  ...
    "record": true,
    "record-key": "<your_record-key>",
    "projectId": "<your_cypress_project_id>"
}

Set record flag using the CLI

Use the --record argument in the CLI to view test results on the Cypress dashboard as follows:

Argument Accepted values
--record Set to send test results to the Cypress dashboard.
--record-key record-key generated for the project as defined on Cypress dashboard.
--projectId projectId generated for the project as defined on Cypress dashboard. You can also find the projectId in the Cypress configuration file of your project.

For example:

Command Line
 browserstack-cypress run  --record --record-key "<your_record-key>" --projectId "<your_cypress_project_id>"

Points to remember

Before you set the record flag, note the following points:

  • For any of the keys/arguments, the values set through CLI takes precedence over the values set in the browserstack.json file.
  • The projectId key/argument set through CLI or the browserstack.json file takes precedence over the value set in the Cypress configuration file.

We're sorry to hear that. Please share your feedback so we can do better

Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked






Thank you for your valuable feedback

Is this page helping you?

Yes
No

We're sorry to hear that. Please share your feedback so we can do better

Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked






Thank you for your valuable feedback!

Talk to an Expert
Talk to an Expert