Common issues (`run cypress visual tests`)
"Cannot find element" error
If Cypress encounters an error, such as being unable to find [data-test="header-account-button"], it prevents screenshots from being generated for all subsequent pages.
To resolve this, either:
- Fix the issue by ensuring the element exists, or
- Skip the failing test using Cypress syntax (
.skip).
"Image difference is greater than the threshold: 0" error
This error indicates that a difference has been detected between the baseline image (from the test environment) and your changes. The current threshold is set to 0 pixels, meaning even a 1px shift will be reported as a difference.
While detecting differences is expected when developing new features, this strict threshold is particularly useful when updating Mosaic Templates. It ensures that updates do not unintentionally introduce any visual changes.
The HTML file containing all the screenshots with detected differences is available in GitLab. To locate it, click on run cypress visual tests in the pipeline. You will find a link to the HTML file at the bottom of the job details:
After reviewing the test results, you can determine whether the detected changes are desirable or require further action.