Add isolated component screenshot tests for all story variants#105
Open
EmilioBejasa wants to merge 5 commits intomainfrom
Open
Add isolated component screenshot tests for all story variants#105EmilioBejasa wants to merge 5 commits intomainfrom
EmilioBejasa wants to merge 5 commits intomainfrom
Conversation
…tion Removes dependency on MainApplication by constructing ReactHostImpl directly in the test with dev support and packager access disabled. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Replace ViewHelpers.setupView with WindowManager.TYPE_APPLICATION_OVERLAY so Fabric's Choreographer can fire mutations against a real Window - Add reactHost.onHostResume(null) so Fabric commits its render tree (without RESUMED lifecycle state, all mutations are silently dropped) - Wait for ReactMarkerConstants.CONTENT_APPEARED before snapping screenshot - Set software layer type so Screenshot.snap() can capture via draw(canvas) - Grant SYSTEM_ALERT_WINDOW permission required for overlay window type Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Prevents checkered (transparent) background in captured screenshots. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replaces the TYPE_APPLICATION_OVERLAY window (which required SYSTEM_ALERT_WINDOW permission) with WindowAttachment.dispatchAttach, which fakes window attachment via reflection without a real window. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- ReactHostFixture: shared singleton ReactHostImpl so DefaultComponentsRegistry.register is only called once per process - ComponentSurfaceTest: parameterized over 25 story variants (Button, Header, MyFeature, SwitchFeature, TimerFeature, CoinFlipFeature) matching story prop states - IsolatedTest: simplified to delegate to ReactHostFixture.screenshotComponent - Uses ReactMarker.CONTENT_APPEARED to reliably wait for React render - Uses ContextThemeWrapper(AppTheme) so Android widgets (Switch) get styled drawables - Registers all story variant components in index.js Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
tdrhq
requested changes
Apr 7, 2026
|
|
||
| var detacher: WindowAttachment.Detacher? = null | ||
|
|
||
| try { |
Contributor
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.
Summary
ReactHostFixturesingleton soDefaultComponentsRegistry.register(a JNI native call) is only invoked once per processComponentSurfaceTestparameterized over 25 story variants across all 6 components, matching the exact prop states from.stories.tsxfilesIsolatedTestto delegate to the shared fixtureReactMarker.CONTENT_APPEAREDto reliably wait for React to render (fixes timeout issue withviewTreeObserver)ContextThemeWrapper(AppTheme)so Android widgets likeSwitchget their styled drawables (fixes NPE crash)index.jsTest plan
app:recordDebugAndroidTestScreenshotTest)🤖 Generated with Claude Code