viewFilters
UI Coverage is a paid add-on. Schedule a demo today and see how easy it is to enhance your testing while speeding up your development process.
Note: setting viewFilters
impacts both Accessibility and UI Coverage reports.
This cannot be nested.
By default, every URL that is visited within a run is included in UI Coverage. The viewFilters
property allows you to specify URL patterns for URLs that should be excluded from UI Coverage. Excluding a URL also excludes all links to that URL.
For every URL visited by Cypress in a run and every link element found, the first viewFilters
rule for which the pattern
property matches the URL is used to either include or exclude the URL based on the include
value. URLs that do not match any rules are included by default.
Syntax​
{
"viewFilters": [
{
"pattern": string,
"include": boolean
}
]
}
viewFilters​
Optional. Object[]
An array of objects used to specify URLs to exclude from UI Coverage. Each object can have the following properties:
pattern​
Required. String (URL Pattern)
Used to match URLs. Uses URL Pattern API syntax.
include​
Optional. Boolean
Default: true
A boolean that represents whether or not a matched URL should be included in UI Coverage.
Examples​
Excluding URLs by hostname​
Config​
{
"viewFilters": [
{
"pattern": "https://app.okta.com/*",
"include": false
}
]
}
Visited URLs​
https://app.okta.com/login
https://cypress.io/home
https://cypress.io/about
Views shown in UI​
https://cypress.io/home
https://cypress.io/about
Including only specific URLs​
Config​
{
"viewFilters": [
{
"pattern": "https://cypress.io/dashboards*",
"include": true
},
{
"pattern": "*",
"include": false
}
]
}
Visited URLs​
https://cypress.io/dashboards
https://cypress.io/dashboards/1
https://cypress.io/dashboards/2
https://cypress.io/home
https://cypress.io/login
Views shown in UI​
https://cypress.io/dashboards
https://cypress.io/dashboards/*