Beautiful Cypress dashboard with simple setup
Tags: testing, frontend, javascript, cypress
Published: 2020-06-19 23:14:46

---
title: Beautiful Cypress dashboard with simple setup
published: true
date: 2020-06-19 23:05:07 UTC
tags: testing,frontend,javascript,cypress
canonical_url: 
---

![](https://cdn-images-1.medium.com/max/1024/1*a3y6Onu0u_nfBBwgVq1oTg.png)<figcaption>Cypress logo</figcaption>

[Cypress](https://www.cypress.io/) is probably the best testing tool for web applications at the moment. But Cypress also has one flaw, reports. If you spent any time setting these up, you know how painful it can be. They are unstable, require multiple dependencies, and even slightly different versions can break them. And when you finally set those up, you get comments from management that they are not clear enough. Those are some of the reasons why I decided to write a [cypress-dashboard](https://www.npmjs.com/package/cypress-dashboard) library. An [npm](https://www.npmjs.com/) package that helps you generate a clear reporting dashboard with minimum setup. In this post, I explain how to use it.

![](https://cdn-images-1.medium.com/max/600/1*KlglComhULt2aiZOhV4dCQ.gif)<figcaption>Cypress dashboard</figcaption>

**Problem with current solutions**

When I decided to introduce Cypress into existing projects, one of the first questions I got was: “What about reports?”. And I spent some time trying to implement them. I even wrote three other articles on the topic ([generating reports](https://dev.to/chriss/cypress-generating-mochawesome-reports-mo1) and [merging reports](https://dev.to/chriss/cypress-merging-multiple-mochawesome-reports-1855)). Setup was already problematic. Libraries had to have exact versions, and some things wouldn’t work with the newest mocha. After that, you find out that it generates a separate report for each spec file. Or, if you have to overwrite enabled, keeps only report for last spec file it runs. So you disable that flag, and when you get a separate report for each spec file, you need additional dependency that merges them. But then, you need to do cleanup manually. And after all that, you get a comment that they are not as good as Selenium or whatever other testing solution you are using. And that is where the cypress-dashboard package comes to save the day.

**Installation**

To generate these reports, all you need is just one dependency, cypress-dashboard.

npm install cypress-dashboard

**Setup**

When running the Cypress tests, one of the many files that get generated is cypress.json. To have reports generated after the package is installed, all you need to do is add cypress-dashboard as a reporter.

```
{
  "reporter": "cypress-dashboard"
}
```

There are a few possible options that are configurable, but I cover only one here. That is the report location. If you don’t set anything, a default location is a cypress-dashboard folder created in your project root folder. If you want to change this, you can set reportDir property under reporterOptions.

```
{  
  "reporter": "cypress-dashboard",
  "reporterOptions": {
    "reportDir": "cypress/reports"
  }
}
```

You can pass these parameters trough CLI, just like they usually would in Cypress. But I do recommend using a JSON configuration file.

**Conclusion**

As a developer, I don’t want to spend lots of time or have a bunch of hassle setting up reports. An application needs testing, but the setup for it should be simple. That is the reason behind me creating this library, and that is the goal of the cypress-dashboard package.

---

Follow me on [Twitter](https://twitter.com/hi_iam_chris_), [LinkedIn](https://www.linkedin.com/in/kpajtasev/) or [GitHub](https://github.com/kristijan-pajtasev).