-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Add chromatic visual tests #2505
Conversation
@ndelangen do you have the permission to grant access from the |
Note that there's an ongoing work on adding visual testing functionality to storyshots: #2413 |
Yes! I think this is great! I think however for a larger project like this one Chromatic can offer a little more on top of that, namely parallelized / cloud screenshots and an review flow UI. Interested to hear your thoughts once you've given it a go. |
package.json
Outdated
"repo-dirty-check": "node ./scripts/repo-dirty-check" | ||
"repo-dirty-check": "node ./scripts/repo-dirty-check", | ||
"storybook": "start-storybook -p 6006", | ||
"chromatic": "chromatic test --storybook-addon --app-code sm3026v658i" |
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.
If it's not a public key, probably better hide it with the CI parameter
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.
Yeah, see the note on the commit ;)
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.
Hah, 😄
Oh, that's actually pretty cool. I think there's a value in adding this for all the |
Yes, I'll get this going once we sort out #2504 |
f71e104
to
cacfcf5
Compare
Please rebase, so i can better judge this PR, looks all right. |
Different storybook app layers install the `start-storybook` command on top of each other. We won't leave the storybook here, though.
cacfcf5
to
5f65f50
Compare
@ndelangen done. |
.circleci/config.yml
Outdated
- run: | ||
name: "Visually test storybook" | ||
command: | | ||
cd examples/official-storybook; yarn chromatic |
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.
Please add a root-level shortcut script for that
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.
Maybe it should be even made an option in scripts/test.js
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.
Is this something we want to be able to run locally?
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.
I believe so, at least to update the refs
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.
I was under the impression chromatic provided a review system to decide if a change is OK or NOT_OK ?
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.
If the tests are run by each dev, how does chromatic overcome the rendering differences per system?
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.
AFAIU they actually run in cloud even when launched locally
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.
chromatic provided a review system to decide if a change is OK or NOT_OK
That's cool that they do that! And I feel convenient doing that even before submitting a PR
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.
Yeah, you can run it locally and it does take the snapshots in the cloud still.
The only hiccup with this is the CHROMATIC_APP_CODE
environment variable -- it will need to be set for the test to run locally. Any thoughts on how to make that easier for devs (you can find it in the settings page at https://www.chromaticqa.com/settings?appId=5a375b97f4b14f0020b0cda3)
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.
@Hypnosphi -- not sure how to best add it to the scripts/test.js
command; it seems the way that is written a command either needs to be a jest project or a npm test
command for some subdirectory. I'm not sure we want to make it npm test
for examples/official-storybook
though.
Should I change the script to support a full custom command? Perhaps in a separate PR?
# Conflicts: # yarn.lock
Codecov Report
@@ Coverage Diff @@
## master #2505 +/- ##
=======================================
Coverage 32.68% 32.68%
=======================================
Files 398 398
Lines 8838 8838
Branches 953 949 -4
=======================================
Hits 2889 2889
+ Misses 5313 5294 -19
- Partials 636 655 +19
Continue to review full report at Codecov.
|
This is ready to merge when the 3.3 release process is complete. |
How does it affect release process? It doesn't change any external packages |
It shouldn't, but @shilman asked me to hold off merging into |
Merge when ready, if you ask me |
Issue: We didn't have visual regression tests for our stories
Note: this is built on #2504
What I did
Added chromatic to our CI
How to test
Make a UI change, check out the build at https://chromaticqa.com
NOTE: this is not currently accessible to members of thestorybooks
org, just sorting out org permissions.Anyone in the
storybooks
org on GH should be able to access the project here: https://www.chromaticqa.com/builds?appId=5a375b97f4b14f0020b0cda3