Skip to content

test: set up Cypress visual diff smoke tests#2707

Open
contolini wants to merge 1 commit intomasterfrom
5269-visual-smoke
Open

test: set up Cypress visual diff smoke tests#2707
contolini wants to merge 1 commit intomasterfrom
5269-visual-smoke

Conversation

@contolini
Copy link
Member

Adds a global afterEach hook that runs after every test and takes a screenshot of the app's current state. Baseline screenshots are generated with yarn test-visual:baseline and comparisons against the baseline are made with yarn test-visual.

Changes

Testing

  1. Run yarn test-visual:baseline to generate baseline screenshots.
  2. Change some aspect of the app.
  3. Run yarn test-visual to take new screenshots and compare against the baselines. It should fail if you changed something and pass if you didn't.

Notes

  • I gitignored the entire screenshots directory. Normally you'd only ignore the actual subdirectory and check the base subdirectory into git. Because this is a new thing and all our environments are a little different, I decided to ignore everything for now.


xhr.open('HEAD', url)
xhr.send()
})
Copy link
Member Author

@contolini contolini Mar 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This helper function wasn't working as expected with the Cypress global afterEach hook so I replaced it with Cypress' native request method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant