Refactor BaseStoryScreenshotTest to use single activity#75
Draft
EmilioBejasa wants to merge 9 commits intoload-story-event-emitterfrom
Draft
Refactor BaseStoryScreenshotTest to use single activity#75EmilioBejasa wants to merge 9 commits intoload-story-event-emitterfrom
EmilioBejasa wants to merge 9 commits intoload-story-event-emitterfrom
Conversation
52ea702 to
fa4abd8
Compare
Instead of launching a new ActivityScenario per story, launch once and loop through stories using StorybookRegistry.loadStory() events. ActivityScenario is now opened and closed once per test run. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Uses scenario.onActivity { it.loadStory(storyName) } to trigger story
switching, removing the need for a static loadStory on StorybookRegistry.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
fa4abd8 to
a9cce63
Compare
…Manager reactInstanceManager throws IllegalStateException on new arch because there is no ReactNativeHost. Use ReactApplication.reactHost to get the current ReactContext instead. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…events Two bugs: - storyNameToId crashed on '__bootstrap__' (no '/') with TypeError on name.toLowerCase(). Bootstrap story only needs to register stories, not render anything, so bail out early when storyName has no '/'. - loadStory event listener only logged; it never updated the displayed story. Add currentStoryName state, update it on the event, and reset loading so renderStory re-runs and notifyStoryReady fires. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
notifyStoryReady() was called synchronously in a useEffect, which runs after React commits on the JS thread but before native view mutations are flushed to the main thread. Wrapping in requestAnimationFrame ensures the frame is painted before the screenshot is taken. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
After awaitStoryReady(), React Native's native view mutations may still be pending on the UI thread. waitForIdleSync() ensures the UI thread has flushed all pending operations before the screenshot is taken. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
waitForIdleSync() drains the message queue but view drawing is driven by VSYNC via Choreographer, not the queue. Screenshots were capturing a blank frame because drawing hadn't happened yet. waitForNextDraw() uses OnDrawListener to block until the next frame is actually painted. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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
ActivityScenariofor the entire test run instead of one per storyStorybookRegistry.loadStory()events instead of relaunching the activityscreenshotStory()andbootstrapManifest()helper methodsTest plan
🤖 Generated with Claude Code