-
Notifications
You must be signed in to change notification settings - Fork 351
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
[Chromatic] Disable snapshots globally, only keep regression stories #1911
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@khanacademy/perseus": patch | ||
--- | ||
|
||
[Chromatic] Disable snapshots globally, only keep regression stories |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import * as React from "react"; | ||
import {color} from "@khanacademy/wonder-blocks-tokens"; | ||
import {RenderStateRoot} from "@khanacademy/wonder-blocks-core"; | ||
import {Dependencies} from "@khanacademy/perseus"; | ||
|
@@ -23,7 +23,14 @@ | |
(Story) => ( | ||
<RenderStateRoot> | ||
<DependenciesContext.Provider value={storybookDependenciesV2}> | ||
<Story /> | ||
{/* Most of our components have an expectation to be | ||
rendered inside of a .framework-perseus container. | ||
We want to make sure we can include it here, since it | ||
can also affect the styling. | ||
*/} | ||
<div className="framework-perseus"> | ||
<Story /> | ||
</div> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. NOTE: This is causing some trivial snapshot updates within the UI tests for the regression stories. |
||
</DependenciesContext.Provider> | ||
</RenderStateRoot> | ||
), | ||
|
@@ -59,6 +66,12 @@ | |
value, | ||
})), | ||
}, | ||
// Disabling Chromatic snapshots across all stories, since we have | ||
// a limited snapshot budget. Set this explicitly to false on | ||
// stories that we want snapshots for in their respective files. | ||
chromatic: { | ||
disableSnapshot: true, | ||
}, | ||
}, | ||
}; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
So I think the issue is that
onlyStoryFiles
is an option inside thechromatic.config.json
file, the option is here: https://www.chromatic.com/docs/configure/#optionsThere 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.
Ah, that's good to know!
I think we're gonna enable a few key stories other than the regression stories soon, so I think it would still be worth removing this from the .yml file.
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.
It seems like this is working as designed. This setting is documented as being supported in the GitHub Action:
On an example PR I checked, it seems like it is obeying the setting:
It captured only 27 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.
@jeremywiebe It does say "captured 27 snapshots" on all the PRs. I checked a bunch of older unrelated Perseus PRs to check this, and it's true that that messaging is consistent. However, the PRs would also show other snapshots that aren't part of these 27 in the "UI test" check. It also says there are 130 tests on the chromatic dashboard for other PRs when there should only be 27:
I'd like to move away from using the
onlyStoryFiles: "**/*regression.stories.tsx"
because I think there's a disconnect somewhere that isn't super obvious.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'm going to retract my last comment. Just for a confidence check, I put up another PR that would have had a ton of UI test updates if my assertion was correct. It only reported changes in the regression stories, so I think my statements before this were all false, and I just don't know what "tests" means on the chromatic dashboard.
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.
@jeremywiebe we can still continue with this PR if we want to enable other stories to have snapshots later, rather than just limiting to regression stories.