Automation testing with multiple viewports #24942
-
SummaryWith the test-runner, we can automatically run tests for all the stories with or without the play function. However, I was unable to find documentation or a solution on how to test each story in multiple viewports with the test-runner. Is it possible? Additional informationNo response Create a reproductionNo response |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Hey @venugopalkathavate! The test-runner allows you to configure a specific snapshot per story, as can be seen in this recipe. However, It does not have a way to multiply the same test with multiple configurations. If you really want to achieve that with the test-runner, you could potentially duplicate your stories and set a different viewport for each of these stories' parameters. Alternatively, if you ever looked at Chromatic, they have a feature called story modes which does exactly what you want to achieve: |
Beta Was this translation helpful? Give feedback.
-
I would like to do the same except running snapshot tests for all themes. Is there no other way except duplicating stories if I don't want to use Chromatic? |
Beta Was this translation helpful? Give feedback.
Hey @venugopalkathavate!
The test-runner allows you to configure a specific snapshot per story, as can be seen in this recipe. However, It does not have a way to multiply the same test with multiple configurations. If you really want to achieve that with the test-runner, you could potentially duplicate your stories and set a different viewport for each of these stories' parameters.
Alternatively, if you ever looked at Chromatic, they have a feature called story modes which does exactly what you want to achieve:
https://www.chromatic.com/docs/modes/#modes-for-testing-themes-viewports-locales-amp-more