Skip to main content
Cypress AccessibilityPremium Solution

Compare reports

You can compare accessibility reports from different runs in the Branch Review area of Cypress Cloud. The comparison instantly surfaces any new issues that have been introduced, and drills in to full-page HTML and CSS snapshots showing only those new issues.

See the video below for an example of using Branch Review in a Pull Request:

Comparing two accessibility reports manually is usually a challenge:

  • each report may test thousands of application snapshots for a single Cypress run
  • 80+ accessibility rules apply to each snapshot
  • each report covers many different pages or components, which may have changes
  • elements might have different identifiers in each run

Branch Review for Cypress Accessibility is set up to help you browse this nested set of changes and find what's important. You can review any accessibility violation increases found for specific rules, and drill into the Views where those changes happened.

Use cases​

Comparing the results from different runs is useful in multiple scenarios.

Key use cases:

  • Pre-merge checks: Know if UI code changes introduce any net-new issues.
  • Monitoring changes: Compare nightly monitoring runs and track down the introduction of new problems caused by underlying changes in the application.
  • Detecting content issues: Sometimes content editors can introduce accessibility issues unrelated to code changes. Seeing the example issues presented visually, in context, helps you quickly triage whether you are dealing with a recent code change issue, or a content authorship problem.
  • Reviewing AI-generated code changes: The increased use of AI to generate and/or review front-end code creates some increased risks of accessibility regressions making it to production. The increase or decrease of accessibility issues when reviewing a pull request helps you understand the impact of the change.
  • Tracing the introduction of issues: With dropdowns for each run, you can rapidly compare different A and B runs to find the exact commit that introduced a problem.
  • Demonstrating the resolution of issues: Confirm the effect of your improvements, and share the overview with your team to more quickly review code changes.

Content of the report​

Cypress Accessibility Branch Review showing two main sections - New Failed Elements and Resolved Elements

The key to understanding the run comparison report is that the Changed run is the focal point for all data that the report displays, and the Base run serves as a reference point for comparison. So everywhere that you see an element, or drill in for more details, you only see data from the Changed run.

The Branch Review report has two sections:

  • New failed elements: Counts of elements that have failures in the Changed run, where Cypress Accessibility found no matching failures on the Base run. The report lists new failed elements by View, for each accessibility rule where Cypress Accessibility detected new failures.
  • Resolved elements: Counts of elements that had failures in the Base run which Cypress Accessibility no longer detects in the Changed run. The report also lists resolved elements as improvements in each View, under the accessibility rules that had improvements.

If the Changed run is associated with a Pull Request and runs the same overall test suite as the Base run, the changes in the report are likely due to code changes in the pull request.

How to compare runs​

The first step is to get to the Branch Review area of Cypress Cloud, where you compare one branch against another - or different runs on the same branch, if needed. You can access this area by clicking the branch name associated with a run, or in several other ways. Learn more about how to compare runs.

Details of each section​

New failed elements​

A new failed element is any failed element which either did not exist in the Base run at all, or existed in the Base run but was passing its accessibility checks.

Cypress Accessibility Branch Review showing two main sections - New Failed Elements and Resolved Elements

Any rules with new failed elements appear here. There are two ways to explore this list. You can open each rule and choose from the list of Views where Cypress Accessibility detected a new failed element, or if you click the "View All" link, you see a full report containing all of the net-new failures in the run, across all rules and views.

Either path takes you to the detailed report, either for a single View or for all View combined. This report works exactly like the main Cypress Accessibility report, with full-page snapshot examples for every violation. The only difference is that the report removes all issues that are the same on both runs, leaving just what's new - either for the specific View you've chosen, or across all views.

Cypress Accessibility Branch Review showing the detailed diff for a demo contact form. A 'name' field in the contact form is highlighted in red because it is missing a label.

Single-View diff vs whole-run diff​

Each rule has an "All Views" comparison as the first item, and then lists individual Views below that. Depending on the level of detail you are looking for, you can drill into a specific page or component and see the changes in accessibility there, or just look at the combined report.

The combined "All Views" report for a single rule is especially useful if violations tend to move around between pages over time. For example, if there is a popup with an accessibility problem that appears on a random page in every run, it may appear "new" for a View in the Changed run, and "resolved" for the View where it was in the Base run, but in reality your accessibility score is the same and the problem is the same. "All Views" sidesteps noise of this kind.

Resolved elements​

A resolved element is an element that had a failed accessibility rule in the Base Run, where Cypress Accessibility finds no matching failure in the Changed run.

A list of accessibility rules with resolved elements in the new run

Cypress Accessibility calculates resolved elements for every rule and View, but does not display them individually. The report does not display resolved elements because, as far as the Changed report is concerned, the failures do not exists, so there is not a guarantee the element is still present in the "new" report.

If you have a use case for seeing the specific elements that are no longer detected to have failures, reach out to your Cypress representative for further discussion. For the time being the focus of Branch Review is on new problems - we avoid mixing old and new data in the same report to minimize the chances of confusion.

What if there are no changes?​

If there are no changes, the Accessibility Branch Review report still displays all the sections, and explains that there are no elements that appear to be new or resolved in Changed run:

The new and resolved elements sections each showing a message to explain that there are no findings

An empty Branch Review report means the reports are identical, and that the Changed run has not had any impact on accessibility.

Ensuring a good comparison​

The easiest subjects to compare are passing runs that ran similar tests on the similar content. Comparing such runs means that each run visited roughly the same pages and completed the same kinds of workflows. In this situation, any diff in the results is likely the result of changes present in the newer run. Comparable runs are usually what you get out-of-the box when comparing a pull-request branch with your main branch, for example - assuming the same tests run on both branches.

That said, it still possible and valid to compare runs from different points in time with different sets of test results, as long as you bear in mind all the potential sources of difference between the two runs, which you can evaluate for yourself as you explore the results.

To see unified changes for your entire test suite, you need to group all the tests together under a single Cypress run, for each report. Learn more about this in the Branch Review Best Practices documentation.

Stabilizing the comparison​

On most projects, comparing accessibility reports works nicely out of the box. But in some cases, configuration is useful to handle dynamic values that might be present in page URLs or element locator. You may also want to take steps to improve the consistency of the elements under test.

Stable Views​

URLs with dynamic slugs in them can appear as "new" pages in some situations. You can adjust this behavior with View configuration to make sure page names match across runs by wildcarding parts of the URL as needed.

Cypress performs this process automatically for certain known patterns. For example, the default behavior is to track a URL like https://example.com/products/123 as https://example.com/products/* so that Cypress groups the underlying product pages together as one View, and then recognizes that View in a stable way between runs.

If a View appears to be "new", Branch Review marks it with a green plus icon, and a tooltip explaining that this View was seen on the Changed run but not on the base run, as seen here in the New Failed Elements section:

Cypress Accessibility Branch Review showing several added views in a report, with a plus sign beside each one and a tooltip explaining that the view was seen in one report, but not the other.

Likewise, if a rule appears to have resolved elements on Views that are simply no longer captured on the Changed run, the Resolved Elements section identifies those Views:

Cypress Accessibility Branch Review showing several added views in a report, with a plus sign beside each one and a tooltip explaining that the view was seen in one report, but not the other.

These changes in Views may be because someone actually added a new page to the application, or because testing reached a new page that it didn't reach before. If configuration is needed to improve View stability across runs, you see unexpected added and removed URLs.

Stable Elements​

Cypress stores a string that represents each failed element in a report, determined using a standardized element identification process. This identification process operates in a different way to the standard Axe-Core® element identification algorithm, to support the comparison of runs from different builds of the application, and make use of the testing-related attributes you may already have created in the DOM.

Where possible, we prioritize known stable locators like data-cy or data-testid. In some cases the identification strings contain dynamic values that change on every build of your application, introducing noise in a diff. The element identification behavior is flexible, and you can configure it to meet your needs and fully avoid dynamic values as identifiers.

For example, if an element's default locator includes a class like .css-21kj23 in Build A, and a slightly different class like .css-2309kj in Build B, it appears as though there was a "resolved element" and "new violation".

This behavior is highly customizable so that you can avoid depending on values that don't matter to you, but also you can choose specific attributes that do matter for element recognition and get sensible deduplication and matching behavior based on your own goals.

Learn more about the attributeFilters and significantAttributes configuration available, or reach out to us for any assistance on dialing in the behavior.

Stable underlying reporting area​

It's likely that you have never used your tests for always-on accessibility tests before, and while most codebases produce stable results, some projects have inherent differences between runs due to the performance of specific processes during testing.

For example, sometimes the test may spend enough time on a page to see a confirmation message after a form is submitted, unless the server response is slow, then the test may finish without rendering the state.

There are different solutions depending on the nature of the issue. If you want to ensure Cypress Accessibility always picks up the state, you can add some assertion about that state to your tests. On the other hand, if you do not want to account for this state at all, you can ignore it with elementFilters configuration. Either approach leads to a more stable branch comparison.

Optimizing for Pull Request reviews​

If you plan to use branch comparison for investigating Pull Requests that have been blocked through the Results API for not meeting your standard, it's useful to implement this in a gradual way, prioritizing the developer experience at first.

Choose a scope of rules, page, and elements that reduces ambiguity. A good starting point is something like "We will fail a build if it introduces new critical issues on the login or checkout page."

If your application is unstable between runs in terms of content, pages, or different states reached, fine tune your configuration to ignore the unstable parts of the DOM that have issues already. You can document these unstable parts and deal with them on their own.

When everything is dialled in correctly, the Branch Review diff is 100% clean, unless something has actually changed in an area you didn't already know about. A clean diff gives you the highest confidence that if an issue is blocking a merge, it is genuinely a new problem introduced by the incoming Pull Request.

If the team is not already familiar with accessibility, it's useful to consider which rules to start with. See Fix accessibility violations for how to choose a first rule and scope the report around it.

If multiple teams are working on the same project and need accessibility results to be isolated from each other, consider splitting runs into dedicated Cypress projects or using configuration profiles so that each team can have a customized report for the areas they are responsible for.