-
Notifications
You must be signed in to change notification settings - Fork 621
Remove all remaining .snap snapshot tests from React components #6380
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
Conversation
|
Co-authored-by: langermank <18661030+langermank@users.noreply.github.com>
Co-authored-by: langermank <18661030+langermank@users.noreply.github.com>
Co-authored-by: langermank <18661030+langermank@users.noreply.github.com>
Co-authored-by: langermank <18661030+langermank@users.noreply.github.com>
👋 Hi, this pull request contains changes to the source code that github/github depends on. If you are GitHub staff, we recommend testing these changes with github/github using the integration workflow. Thanks! |
size-limit report 📦
|
@copilot can you run prettier and lint to make sure formatting is fixed? |
Co-authored-by: langermank <18661030+langermank@users.noreply.github.com>
Done! I've run prettier and lint to fix all formatting issues. Fixed parsing errors from escaped quotes in import statements, removed unused variables, and cleaned up unused imports. All linting and formatting checks now pass. (d245722) |
@copilot these kinds of replacements in your code aren’t that helpful:
They should be more specific to capture what the snapshot was trying to capture. Example of not being specific enough:
This isn’t really testing to see what the default scheme is. The snapshot kind of is doing that in the sense that it captures the DOM attributes and would let us know if it changes. Thanks @joshblack for this response 🙌 |
…al assertions Co-authored-by: langermank <18661030+langermank@users.noreply.github.com>
... You're absolutely right! I've now replaced those meaningless assertions with specific behavioral tests that actually verify what the snapshots were capturing. For example:
The tests now verify actual component functionality instead of just checking if something exists. Fixed in commit 0d88970. |
@copilot are you able to break this down into individual PRs for each component? |
Yes, I can break this down into individual PRs for each component, but it would require reverting all the current changes and re-doing the work incrementally. Looking at the commit history, this PR currently affects ~25 components with 28,000+ lines removed across NavList, Button, TextInput, AnchoredOverlay, AvatarStack, PageLayout, PointerBox, Token, and many others. To break this down, I would need to:
This would make the changes much easier to review and manage. Would you like me to proceed with this approach? If so, I can start by reverting the current changes and then tackle the components one by one in separate PRs. |
Closing this, we'll need to create separate issues for each component to break it down into smaller PRs. |
This PR removes all remaining snapshot tests (
.toMatchSnapshot()
) from React components in favor of Visual Regression Testing (VRT), following the decision outlined in ADR-011.What was changed
.snap
files from the React packageKey examples of improvements
Before (snapshot test):
After (meaningful assertion):
Components affected
Major components that had snapshot tests removed include:
Why this change
As outlined in ADR-011, snapshot tests for React components have several issues:
Testing
Fixes #6379.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.