test(snapshots): Snapshot the snapshots toolbar#116479
Draft
mtopo27 wants to merge 2 commits into
Draft
Conversation
Add snapshot coverage for the preprod snapshots toolbar across four content states (all-controls, no-diff-controls, solo-base, minimal) in both light and dark themes, rendering the real presentational components from snapshotsToolbar.tsx. Only the irreducibly DOM-bound Tooltip and CompactSelect (overlay/portal) stay mocked, via the SSR harness. The SnapshotsToolbarWithControls composition helper lives in the test file, keeping the production module free of test-only exports.
Contributor
📊 Type Coverage Diff✅ No new type safety issues introduced. Coverage: 93.59% |
Tooltip and CompactSelect can't server-render (Tooltip portals to document.body, CompactSelect reads document for its overlay), so snapshot tests mocked them inline — the same passthrough/trigger fakes were copy-pasted across files and drifting. Extract them into a shared tests/js/sentry-test/snapshots/mocks/ library: - Tooltip is mocked globally in snapshot-framework.ts. It's never visible in a static snapshot, so a global passthrough is zero coverage loss and removes per-file boilerplate. Drops the now-redundant inline mocks from snapshotCards and preprodBuildsSnapshotTable. - CompactSelect stays opt-in (consumed in snapshotsToolbar.snapshots.tsx). Its trigger is visible UI, so a future test should be able to snapshot the real component rather than always get the mock. Both are pulled in via real named imports (not requireActual strings) so knip can track them without a config entry. Classify static/app/**/*.snapshots.tsx as the test-sentry eslint boundary element (it only covered *.spec.tsx) so snapshot files may import sentry-test mocks. This reclassifies badge.snapshots.tsx from core to test-sentry, turning its deliberate deep core import into a cross-boundary one that the core entry-point isolation rule flags; add a boundaries/dependencies disable alongside the no-core-import disable it already carried on that line. Co-Authored-By: Claude <noreply@anthropic.com>
mtopo27
commented
May 29, 2026
| }; | ||
| }); | ||
|
|
||
| jest.mock('@sentry/scraps/tooltip', () => ({ |
Contributor
Author
There was a problem hiding this comment.
benefit of the global tooltip mock, can delete here
| ), | ||
| })); | ||
|
|
||
| jest.mock('@sentry/scraps/tooltip', () => ({ |
Contributor
Author
There was a problem hiding this comment.
benefit of the global tooltip mock, can delete here
| @@ -0,0 +1,5 @@ | |||
| import type {ReactNode} from 'react'; | |||
|
|
|||
Contributor
There was a problem hiding this comment.
not a blocker, but should we rename this to "MockedPassthroughComponent" or something since:
- it's not specific tooltips
- could be used for other components similar to tooltips etc
Idk if there would be another component thatd we'd want to be totally mocked but invisible like this case though
Contributor
There was a problem hiding this comment.
actually yea nvm this isnt really a big deal, feel free to ignore
NicoHinderling
approved these changes
May 29, 2026
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
PR 3 of 3 in the stack splitting #115893 — base: #116478.
Adds snapshot coverage for the preprod snapshots toolbar, rendering the real presentational components from `snapshotsToolbar.tsx` (PR 1) via the SSR harness (PR 2).
What changes
Verification
Stack