-
Notifications
You must be signed in to change notification settings - Fork 9
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
Take snapshots without Percy #407
Conversation
Current unit coverage is 92.1765295887663% |
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.
LGTM! Glad we could finally fix this
customSnapshotsDir, | ||
customSnapshotIdentifier: context.id, | ||
failureThreshold: context.id === 'geolocation--loading' || isMapboxMapStory | ||
? 0.005 |
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.
out of curiosity, does this mean the difference threshold between two snapshots?
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.
exactly, this means that if the image that's currently taken is more than 0.005% pixels different from the image saved in the repo, then it'll fail and trigger a snapshot update
Update the visual regression snapshots to use the Storybook add-on
jest-image-snapshot
rather than Percy. We can now remove Percy from the repo entirely. The workflow now checks snapshots and commits any that have changed. Also, the play functions for stories are fixed so async actions are properly awaited.The loading state for the
Geolocation
component includes animation, so the snapshot doesn't match perfectly each time. To account for this, the threshold for failure for this story is increased to a 0.005% difference in the image rather than an exact match. We also use this threshold forMapboxMap
stories because the map canvas can have slight changes.The
MapboxMap
component takes some time to load. I wasn't able to find a good way to detect the correct time to take a snapshot, so I added a 7500ms wait for these stories to give the map time to load before taking the snapshot. Adding more robust detection logic will be part of another item. This item will also address the snapshot for the loading story forLocationBias
. Right now, we skip taking a snapshot for this story because the snapshot is blank. This is likely because geolocation permissions are disabled for the test runner, so the request for the location is automatically denied.J=BACK-2832
TEST=auto