Introduction to Snapshot Tests

Get introduced to testing changes in user interfaces with snapshot testing.

What is snapshot testing?

Snapshot testing is specific to testing client-side code. While other tests are focused on logic, values, and execution, they fail to test the visual aspect of our code past the most basic level. For instance, if we are testing a button and Jest can’t find the button, the test will fail. Snapshot testing relies on a stored snapshot of a rendered user interface, which is then used for comparison against the current rendered user interface. Jest flags the differences between the two states, making us aware of changes to our UI.

Get hands-on with 1200+ tech skills courses.