interaction test
A test that simulates a user clicking, typing or pressing keys and checks the component responds correctly.
In more detail
In Storybook, interaction tests are written as play functions on stories, so the same story is documentation, a visual test and a behavioural test. They catch broken behaviour, such as a click no longer firing a callback, that screenshots cannot see.
Related terms
- play function — A function on a Storybook story that runs after it renders, simulating user actions and asserting on the result.
- Testing Library — A family of testing libraries that render components and query them the way users find them, by role, label and text.
- unit test — An automated check of one small piece of code, such as a single function, that runs quickly and on its own.
Taught in
- Storybook & Component Driven Development Workflows — Design Systems & Component Engineering