# Cypress reporter

Source: https://docs.qualflare.com/docs/reporters/cypress · Last updated: 2026-10-29

Install @qualflare/cypress, register its plugin and support file, and upload the qualflare-results folder with the Qualflare CLI after cypress run.

`@qualflare/cypress` is the Qualflare reporter for Cypress 12 or later: its plugin and support file write each run's results, with retries, screenshots, command steps and videos, to `./qualflare-results`, and `qf <identifier> collect` uploads the folder as one launch.

| Fact                 | Detail                                                                                          |
| -------------------- | ----------------------------------------------------------------------------------------------- |
| Package              | [`@qualflare/cypress`](https://www.npmjs.com/package/@qualflare/cypress) on npm                 |
| Works with           | Cypress 12 or later, Node.js 18 or later (Cypress 15 needs Node.js 20)                          |
| qf                   | (requires qf 0.1.24 or later)                                                                   |
| License              | Apache-2.0                                                                                      |
| Source               | [Qualflare/qualflare-cypress](https://github.com/Qualflare/qualflare-cypress) on GitHub         |
| Without the reporter | `--format cypress` with [Mochawesome JSON](https://docs.qualflare.com/docs/cli/formats#cypress) |

## Before you begin

* The Qualflare CLI, `qf`: [Install the CLI](https://docs.qualflare.com/docs/cli/installation).
* A saved login: `qf login <identifier>` with a project access token whose creator still holds the project role that uploads need (requires the Editor role or higher in the project) ([Authenticate with qf login](https://docs.qualflare.com/docs/cli/authentication)).
* The **Identifier** of the environment the results belong to ([Environments](https://docs.qualflare.com/docs/runs/environments#identifier)).

## Install

```bash
npm install --save-dev @qualflare/cypress
```

## Configure

Add both files:

```typescript
// cypress.config.ts
import { defineConfig } from 'cypress';
import { qualflareCypress } from '@qualflare/cypress/plugin';

export default defineConfig({
  e2e: {
    setupNodeEvents(on, config) {
      return qualflareCypress(on, config, {
        environment: 'staging',
      });
    },
  },
});
```

```typescript
// cypress/support/e2e.ts
import '@qualflare/cypress';
```

| Option | Type | Default | Required | Description |
| --- | --- | --- | --- | --- |
| `videoOnFailureOnly` | `boolean` | `true` | No | Attach a spec's video only when one of its tests failed. Variable `QUALFLARE_VIDEO_ON_FAILURE_ONLY`. |
| `attachScreenshots` | `boolean` | `true` | No | `false` leaves screenshots out of the report. Variable `QUALFLARE_ATTACH_SCREENSHOTS`. |
| `maxVideoBytes` | `number` | `50000000` | No | Skips a larger video before copying it. Variable `QUALFLARE_MAX_VIDEO_BYTES`. |

Every reporter shares the other settings: see [Reporter configuration](https://docs.qualflare.com/docs/reporters/configuration).

Set `environment` to the environment's Identifier: a name such as `Staging` fails the upload with HTTP 400 ([Environment](https://docs.qualflare.com/docs/reporters/configuration#environment)).

## Run and upload

```bash
npx cypress run
qf <identifier> collect ./qualflare-results
```

Screenshots upload by default; add `--upload-artifacts video` for videos.

## Run in CI

```yaml
- name: Upload results to Qualflare
  if: ${{ !cancelled() }}
  env:
    QF_TOKEN: ${{ secrets.QF_TOKEN }}
    QF_BRANCH: ${{ github.head_ref || github.ref_name }}
    QF_COMMIT: ${{ github.event.pull_request.head.sha || github.sha }}
  run: |
    npm install -g @qualflare/cli
    qf login ci --force
    qf ci collect ./qualflare-results
```

`if: ${{ !cancelled() }}` uploads the results when tests fail, and `QF_BRANCH` and `QF_COMMIT` record a pull request's own branch and commit ([Pull request branches](https://docs.qualflare.com/docs/cli/ci-cd#pull-request-branches)). For GitLab CI/CD, Jenkins and Azure Pipelines, see [Run the upload when tests fail](https://docs.qualflare.com/docs/cli/ci-cd#run-when-tests-fail).

## Sharding and retries

Cypress gives reporters no shard number. Set `QUALFLARE_SHARD_INDEX` from your CI matrix, for example `QUALFLARE_SHARD_INDEX: ${{ matrix.shard }}`; every process writes its own file to the shared folder. See [Merge sharded CI jobs into one launch](https://docs.qualflare.com/docs/cli/sharding#merge-sharded-ci-jobs).

Each attempt's status, duration and error is uploaded; steps, labels, tags and attachments come from the final attempt.

## What gets uploaded

* Status, with the history of each retried attempt.
* Screenshots, taken automatically when a test fails.
* Step-by-step command traces.
* Labels, links, tags and attachments.

A test sets its own metadata with the `qualflare` calls:

```typescript
import { qualflare } from '@qualflare/cypress';

it('logs in with valid credentials', () => {
  qualflare.label('epic', 'Authentication');
  qualflare.tag('smoke');

  qualflare.step('fill in credentials', () => {
    cy.get('#email').type('user@example.com');
    cy.get('#password').type('correct-horse-battery-staple');
  });
});
```

`qf` doesn't read the branch, commit, language or milestone from the report: set them on the upload ([Branch, commit, language and milestone](https://docs.qualflare.com/docs/reporters/configuration#upload-metadata)).

## Troubleshooting

* No video on a passing spec: `videoOnFailureOnly` is on.
* `environment "Staging" does not exist in this project`: use the environment's Identifier, or pass `--environment` on the upload ([Environment](https://docs.qualflare.com/docs/reporters/configuration#environment)).
* Screenshots can't be downloaded: `qf` is older than 0.1.24. [Upgrade qf](https://docs.qualflare.com/docs/cli/installation#upgrading).

## Related

* **Guides:** [Reporters](https://docs.qualflare.com/docs/reporters) · [Upload results with qf collect](https://docs.qualflare.com/docs/cli/collect) · [Sharded runs and result directories](https://docs.qualflare.com/docs/cli/sharding) · [Upload screenshots, videos and traces](https://docs.qualflare.com/docs/cli/artifacts)
* **Reference:** [Reporter configuration](https://docs.qualflare.com/docs/reporters/configuration) · [Cypress format](https://docs.qualflare.com/docs/cli/formats#cypress)
* **More:** [Cypress test reporting in Qualflare](https://qualflare.com/cypress-test-reporting/)
