---
id: ui-coverage/configuration/views
title: Views | Cypress UI Coverage
description: >-
  The `views` configuration allows you to group URLs in UI Coverage using custom
  logic.
section: ui-coverage
source_path: docs/ui-coverage/configuration/views.mdx
version: 6a908a532b1fca4ed18538a4c1c5a9bc7f24f403
updated_at: '2026-05-01T19:25:18.656Z'
---
# views

Cypress automatically groups certain URL patterns to create views. However, for URLs that are not automatically grouped (e.g., `/users/alice` and `/users/bob` are not automatically grouped into `/users/*`), the `views` property allows you to specify custom URL patterns to define views. This configuration enhances the clarity and organization of your coverage reports.

The `groupBy` property allows you to create multiple views from a single URL pattern by specifying which parts of the URL should create distinct groupings.

## Why use views?

**Note**: setting `views` impacts both Accessibility and UI Coverage reports. This cannot be nested.

*   **Group Dynamic URLs**: Group URLs with dynamic path parameters (e.g., `/users/alice` and `/users/bob`) that are not ids or uuids into a single view.
*   **Organize by Query Parameters**: Create views based on query parameters to group URLs where query strings are important to the context of the page.
*   **Create Distinct View Groups**: Use `groupBy` to maintain separate views for meaningful URL parameters while still grouping dynamic content.

## Using groupBy

The `groupBy` property creates distinct views based on named parameters in your URL pattern. For example, if your pattern is `/analytics/:type/:id`, using `groupBy: ["type"]` would create separate views for each unique value of `type` (like `/analytics/performance/:id` and `/analytics/usage/:id`).

This is particularly useful when:

*   Different parameter values represent distinct functional areas
*   You want to track coverage separately for different categories of content
*   URL parameters determine significant UI changes

URLs with the same values for the specified parameters will be grouped together, while different values create distinct views.

## Syntax

```
{  "views": [    {      "pattern": string,      "groupBy": [        string      ],      "comment": string    }  ]}
```

### Options

The first pattern that a given URL matches is used as its view. If a URL doesn't match any of the patterns, it is grouped by the default view grouping rules, if possible.

| Option | Required | Default | Description |
| --- | --- | --- | --- |
| `pattern` | Required |  | A URL pattern to group matching URLs into a single view. Uses [URL Pattern API](https://developer.mozilla.org/en-US/docs/Web/API/URL_Pattern_API) syntax. |
| `groupBy` | Optional |  | An array of named parameters from your pattern that should create separate views. |
| `comment` | Optional |  | A comment describing the purpose of this view configuration. |

## Examples

### Grouping dynamic path parameters

#### Config

```
{  "views": [    {      "pattern": "https://www.my-app.com/users/*"    }  ]}
```

#### Visited URLs

```
https://www.my-app.com/users/alicehttps://www.my-app.com/users/bobhttps://www.my-app.com/users/bob#settingshttps://www.my-app.com/users?assigned=true
```

#### Views shown in UI

```
www.my-app.com/userswww.my-app.com/users/*
```

* * *

### Using named path parameters

#### Config

```
{  "views": [    {      "pattern": "https://www.my-app.com/users/:name"    }  ]}
```

#### Visited URLs

```
https://www.my-app.com/users/alicehttps://www.my-app.com/users/bobhttps://www.my-app.com/users/bob#settingshttps://www.my-app.com/users?assigned=true
```

#### Views shown in UI

```
www.my-app.com/userswww.my-app.com/users/:name
```

* * *

### Group URLs by named parameters

#### Config

```
{  "views": [    {      "pattern": "https://www.my-app.com/analytics/:type/:id",      "groupBy": ["type"]    }  ]}
```

#### Visited URLs

```
https://www.my-app.com/analytics/performance/amarahttps://www.my-app.com/analytics/performance/harperhttps://www.my-app.com/analytics/usage/amarahttps://www.my-app.com/analytics/usage/harper
```

#### Views shown in UI

```
www.my-app.com/analytics/performance/:idwww.my-app.com/analytics/usage/:id
```

* * *

### Group URLs by named query parameters

#### Config

```
{  "views": [    {      "pattern": "https://www.my-app.com/home?*status=:status{&*}?#*",      "groupBy": ["status"]    }  ]}
```

#### Visited URLs

```
https://www.my-app.com/home?page=1&status=donehttps://www.my-app.com/home?status=done&group=2https://www.my-app.com/home?tag=trip&status=new&group=4https://www.my-app.com/home?tag=trip&status=new#statusView
```

#### Views shown in UI

```
www.my-app.com/home?status=donewww.my-app.com/home?status=new
```

* * *

### Grouping URLs across subdomains

#### Config

```
{  "views": [    {      "pattern": "https://*.my-app.com/:path*",      "groupBy": ["path"]    }  ]}
```

#### Visited URLs

```
https://staging1.my-app.com/homehttps://staging2.my-app.com/homehttps://www.my-app.com/homehttps://staging1.my-app.com/profilehttps://www.my-app.com/profile/edit
```

#### Views shown in UI

```
https://*.my-app.com/homehttps://*.my-app.com/profilehttps://*.my-app.com/profile/edit
```
