Seeking Guidance on Writing Interaction Stories #24785
-
Hi there, I'm currently delving into the world of writing storybook stories with interaction tests, and I'm faced with a decision on the approach. I've identified two main options and was hoping to get some insight into which one is generally recommended.
I'm curious if there's a middle ground where tests aren't run by default, and only initiate when the user navigates or clicks on the interaction tabs. This seems like a potential solution, but I haven't been able to find a way to implement it. I'd greatly appreciate your thoughts and any recommendations you might have on the matter. How do you usually approach this in your experience? Thanks in advance for your help! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Hey @eeyzkoj 👋 This is a really great question! Right now I don't believe there is any way to only run interaction tests when you hit play or option the interactions panel. Although, that is an awesome idea for us to consider. I have seen some teams write separate stories for their interaction tests and leave them in a sub folder named "tests" for each component so the extra stories don't clutter up the side bar, which seems like a possible workaround for you in the mean time. However, this presents a flaw in the idea that your stories should be able to function as your tests as well without extra effort. |
Beta Was this translation helpful? Give feedback.
-
@manandkumaar if you're dealing with the same issue, Storybook v8.5 has some great improvements! Check out this article and the docs for more info: |
Beta Was this translation helpful? Give feedback.
Hey @eeyzkoj 👋
This is a really great question! Right now I don't believe there is any way to only run interaction tests when you hit play or option the interactions panel. Although, that is an awesome idea for us to consider.
I have seen some teams write separate stories for their interaction tests and leave them in a sub folder named "tests" for each component so the extra stories don't clutter up the side bar, which seems like a possible workaround for you in the mean time. However, this presents a flaw in the idea that your stories should be able to function as your tests as well without extra effort.