Add deterministic SimpleComponent screenshot test#99
Open
EmilioBejasa wants to merge 9 commits intomainfrom
Open
Add deterministic SimpleComponent screenshot test#99EmilioBejasa wants to merge 9 commits intomainfrom
EmilioBejasa wants to merge 9 commits intomainfrom
Conversation
Kicks off loadStory() for all stories immediately in configure(), using _preview.storyStoreValue directly (bypasses _preview.ready() which only resolves when the Storybook UI renders — never in a test run). By the time StoryRenderer mounts, _idToPrepared is already fully populated, so the render effect is synchronous (no await in the hot path). Combined with the JS-driven Promise handshake from the previous experiment, this removes all async work between "set story" and "notify native ready". Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Without an explicit measure/layout pass, Screenshot.snap(surface.view) captures a blank bitmap on Fabric. Mirror what the old arch path already does with ViewHelpers so the view tree is software-rendered and properly sized before capture. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
view.draw(canvas) skips Fabric child views that have hardware display lists, leaving only the root container's white background. Walking the entire view tree and setting LAYER_TYPE_SOFTWARE on every node ensures all content is visible to the software canvas used by Screenshot.snap(). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Documents why waitTwoFrames exists with a regression-guarding assertion test. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The "childCount == 0 before waitTwoFrames" assumption was wrong — Fabric can mount children synchronously before the check runs. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
tdrhq
requested changes
Apr 2, 2026
Comment on lines
+55
to
+70
| instrumentation.runOnMainSync { | ||
| view.setLayerType(View.LAYER_TYPE_SOFTWARE, null) | ||
| wm.addView(view, params) | ||
| surface.start() | ||
| } | ||
|
|
||
| waitTwoFrames() | ||
|
|
||
| instrumentation.runOnMainSync { | ||
| setLayerTypeSoftwareRecursively(view) | ||
| Screenshot.snap(view).setName("simple_component").record() | ||
| } | ||
|
|
||
| instrumentation.runOnMainSync { | ||
| surface.stop() | ||
| wm.removeView(view) |
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
SimpleComponentto the library — a static, stateless<View><Text>Hello</Text></View>with no timers, animations, or random values, so it renders identically every runAppRegistryinindex.jsSimpleComponentScreenshotTestwhich mounts it viaWindowManager+ReactSurface(same approach asBaseStoryScreenshotTest), waits two Choreographer frames for Fabric to flush, then snaps a screenshotThis gives us a known-good deterministic baseline to verify the screenshot pipeline works before testing the more complex stories.
Test plan
screenshotSimpleComponent🤖 Generated with Claude Code