5 ms·
It's not quite the same as screenshot testing, but I've had success using snapshot testing in React. The idea is outlined here: https://jestjs.io/docs/en/snapsh
by jluxenberg 6y ago
It's not quite the same as screenshot testing, but I've had success using snapshot testing in React. The idea is outlined here:
https://jestjs.io/docs/en/snapshot-testing https://jestjs.io/docs/en/snapshot-testing
Snapshots of the intermediate representation (e.g. JSX in React) will be less brittle than e.g. a screenshot of pixels. It also works best when your UI is a function of some easily-constructed state. Other frameworks sharing these features would also work well with snapshot testing.
- harlanlewis 6y agoIn the same vein, I'm a fan of Storybook [1], which uses Jest under the hood [2], paired with Chromatic [3]. Chromatic generates screenshots from component stories for visual change detection with an easy to use and share web UI. It's neat. [1] https://storybook.js.org https://storybook.js.org [2] https://storybook.js.org/docs/testing/structural-testing/ https://storybook.js.org/docs/testing/structural-testing/ [3] https://www.chromatic.com https://www.chromatic.com