-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(test): Storybook test integration #878
Conversation
…orybook-integration
…orybook-integration
…orybook-integration
…orybook-integration
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, this is great! It adds another layer of tests, and it did indeed find some errors in Storybook stories (some of which have been fixed in the meantime). Since we have to write the stories anyways, it makes sense to also use them as tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is really helpful enhancement to the storybook setup and it could catch future non-working stories.
Just a miscellaneous question - is the excludeSpecPattern='[\"**/layercontrol.cy.js\"]'
necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good idea to "reuse" the existing stories as tests!
In cypress.config.ts we exclude the storybook spec so it doesn't run at the same time with the E2E tests (storybook tests take 2-3 minutes so it makes life easier when trying to only run E2E tests) but in order to actually run the storybook spec we need to overwrite the config via the CLI and in that case I'm excluding a fictitious |
Implemented changes
This PR introduces a new test format (additionally to component and e2e tests) to the PR check pipeline.
This new test loops through all Storybook stories and fails in case of console errors.
With the new action we managed to detect the above error in the Stacinfo custom slot content story and fix it!
After the fix we can see that all 67 tests are passing.
Average time to run through every story is ~3 minutes but that won't happen on every PR, in cypress/e2e/storybook.cy.js we check the git diff (passed as an environment variable) so that we only test stories of elements that were changed in the current branch with the exception that if the
cypress
folder has been changed it will run through every story (heavy inspiration from cypress.config.ts).Checklist before requesting a review