Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Visual testing with Cypress #163

Closed
masakudamatsu opened this issue May 2, 2020 · 6 comments
Closed

Visual testing with Cypress #163

masakudamatsu opened this issue May 2, 2020 · 6 comments
Labels
Milestone

Comments

@masakudamatsu
Copy link
Owner

Read https://docs.cypress.io/guides/tooling/visual-testing.html#Functional-vs-visual-testing for how to do it.

@masakudamatsu masakudamatsu added this to the Testing milestone Jun 13, 2020
@masakudamatsu
Copy link
Owner Author

masakudamatsu commented Jun 17, 2020

We tried Cypress Image Snapshot

But I keep getting this error: "The value of "offset" is out of range. It must be >= 0 and <= 13113564. Received -6792"

The error was reported in cypress-io/cypress#2034 (with the help of Gleb Bahmutov)

@masakudamatsu
Copy link
Owner Author

It seems visual regression testing requires some paid software such as Applitools

@masakudamatsu
Copy link
Owner Author

See my tweet https://twitter.com/masa_kudamatsu/status/1273263197047279616?s=21 on how to deal with the errors

masakudamatsu added a commit that referenced this issue Jul 7, 2020
masakudamatsu added a commit that referenced this issue Jul 7, 2020
To take the full-page snapshots for all the breakpoint screen widths
masakudamatsu added a commit that referenced this issue Jul 7, 2020
@masakudamatsu
Copy link
Owner Author

We've figured out how to take the full-page snapshots

We've created shortcut CLI commands to run cypress-image-snapshot

  • npm run test:visual to run visual-tests.js only with Cypress CLI
  • npm run test:update to update the snapshots

We only take the full-page snapshots

We take snapshots at each of the breakpoints as well as the narrowest screen (320px)

Snapshots are committed with Git LFS.

masakudamatsu added a commit that referenced this issue Jul 7, 2020
To avoid false positive due to rendering differences across browsers
@masakudamatsu
Copy link
Owner Author

We also disable the image-snapshots if we run Cypress with Chrome.

@masakudamatsu
Copy link
Owner Author

For a summary of how to set up visual-testing with cypress-image-snapshot, see https://www.evernote.com/l/AFMjgtLhI5ZO757i757ke27x5Eal9I2xABE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant