Skip to content
Discussion options

You must be logged in to vote

You are correct. The issue you're encountering stems from the difference between synchronous and asynchronous operations in your Storybook play function, especially when running in a CI environment like Chromatic which can have different rendering timings than your local machine.

The error message Unable to find an accessible element with the role "button" and name /back/i occurs because you are using getByRole. This is a synchronous query from the Testing Library. It expects the "back" button to be present in the DOM the instant the code executes. When the component takes a fraction of a second longer to render in Chromatic, the test fails because the button isn't there yet.

The correct …

Replies: 4 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@joaopslins
Comment options

Answer selected by valentinpalkovic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
3 participants
Converted from issue

This discussion was converted from issue #32002 on July 10, 2025 19:00.