FAQ | This is a LIVE service | Changelog

Skip to content

Add console error checking to Cypress tests

As a developer, 
I want to capture and fail Cypress tests when errors are thrown in the browser console during the test run 
so that test failures are more reflective of underlying issues and we can ensure a more robust testing process.

Background

Currently, our Cypress tests check for accessibility and validation on various pages and components, but they do not fail if an error is thrown in the browser console during execution. This can lead to unnoticed issues, as console errors might indicate problems that are not directly caught by existing assertions or checks. To ensure higher test coverage and reliability, we need to add functionality to detect console errors and fail the test when one occurs.

Acceptance Criteria

  • The afterEach hook is added to all relevant test suites to capture console errors.
  • Any test that results in a console error automatically fails.
  • The Cypress test output clearly indicates when a test fails due to console errors.
  • Existing tests continue to pass as long as no console errors are thrown.