Repository navigation
test(cv): wait for the loaded Kalshi Event header before reading its title - #38947
Merged
Merged
Conversation
…title Co-authored-by: ramon.acitores <ramon.acitores@consensys.net>
|
matallui
approved these changes
Nov 5, 2026
Merged
8 of 10 tasks
cursor
Bot
deleted the
fix/cv-predict-entry-kalshi-event-title-remount
branch
November 5, 2026 13:06
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.



Description
Stabilizes
Predict entry actions › through the registered Predict root router (Kalshi rollout) › opens the Kalshi Event on the PredictNext Event screen(app/components/UI/PredictNext/navigation/entry/PredictEntryActions.view.test.tsx, Component view tests shard 5). It failed 3 times in 28 completed shard-5 jobs onmainsince the test landed (2026-11-04 19:00 UTC to 2026-11-05 09:00 UTC, about 11%), and passed on the commits between and after those failures.Failure signature
Unable to find node on an unmounted component.atexpect(await view.findByTestId(PredictEventScreenTestIds.TITLE)).toHaveTextContent(KALSHI_EVENT.title).Tests: 1 failed, 302 passed, 303 total):7dd410b5c18bf39d1f26f6342bFlake proof (classification:
probable_flaky)19dc0b680a(shard 5 completed; only other files failed), 0b8e43f3f3, 4e026c8d66 and c94577c7ed.Root cause (category:
stale_element)PredictEventScreenrenders the header title in two different trees:EventScreenLayout→EventScreenChrome, withtitle={titleSnapshot}.EventScreenChrome, withtitle={event.title}.The root element type changes, so React remounts the whole
VIEW/TITLEsubtree whenuseEventresolves. The intent passestitleSnapshot: KALSHI_EVENT.title, so the loading title already has the expected text.findByTestId(TITLE)can therefore resolve on the loading-phase node. If the Event read lands in the gap beforetoHaveTextContentruns, that node is detached and the matcher throwsUnable to find node on an unmounted component. Whether the load lands in that gap depends on runner timing, which is why the test fails on busy CI shards and passes locally.The same mechanism also made the old assertion a false green: with
configurePredictNextEvent(KALSHI_EVENT)removed, the original test still passed, because the loading title already showed the snapshot.Fix
The test now awaits
PredictEventScreenTestIds.STANDARD_HEADER, which only renders on the loaded branch. It then reads the title with a freshgetByTestId. This matches the existing pattern inPredictEventScreen.view.test.tsx(renders all standard Event header fields from the immutable Event). The assertion now targets the loaded Event's title, so it cannot read a node that is about to unmount. No retries, sleeps, or longer timeouts were added, and the expected title and the Home-absence check are unchanged.Scope: test-only, one test in one file.
Validation
yarn jest -c jest.config.view.js app/components/UI/PredictNext/navigation/entry/PredictEntryActions.view.test.tsx -t "opens the Kalshi Event on the PredictNext Event screen" --runInBand --silent --coverage=false. 10 of 10 passed.--randomize(seed2048902482): 21 of 21 passed."Jets at Bills". The test failed withexpect(element).toHaveTextContent()at line 334. Reverted, and the re-run passed.configurePredictNextEvent(KALSHI_EVENT). The test failed withUnable to find an element with testID: predict-next-event-standard-header. The original test passed with the same mutation. Reverted.yarn lint:tsc: 0 errors.Test layer placement
Scope:
app/components/UI/PredictNext/navigation/entry/PredictEntryActions.view.test.tsxMode: Implement (applied)
Inventory
resolvePredictIntent.test.tscovers intent resolution to PredictNext routes.PredictEntryActions.view.test.tsxcovers entry actions through route probes and the registered Predict root router.Tasks
App code
Residual / follow-ups
Jira: N/A. Report: N/A.
Mobile-testing self-check
app/components/UI/PredictNext/navigation/entry/PredictEntryActions.view.test.tsxbeforeEachjest.clearAllMocks(); this case changes no mock implementation)Changelog
CHANGELOG entry: null
Related issues
Refs: N/A. This is a CV flakiness stabilization.
Manual testing steps
This change only affects a component view test. Validate it with
yarn jest -c jest.config.view.js app/components/UI/PredictNext/navigation/entry/PredictEntryActions.view.test.tsx --runInBand. The expected result is 21 of 21 passing.Screenshots/Recordings
N/A. This is a non-visual, test-only fix. Failed CI jobs: 126807056810, 126882319418, 126884669621.
Before
N/A
After
N/A
Pre-merge author checklist
Performance checks (if applicable)
trace()for usage andaddTokenfor an exampleFor performance guidelines and tooling, see the Performance Guide.
Pre-merge reviewer checklist
Note
Low Risk
Test-only change to assertion timing; no production or runtime behavior affected.
Overview
Stabilizes the Predict entry actions component view test that opens a Kalshi Event through the registered Predict root router.
The test no longer waits on
PredictEventScreenTestIds.VIEWand thenfindByTestId(TITLE), which could attach to the loading-phase title node that unmounts whenPredictEventScreenswitches to the loaded header tree. It now awaitsSTANDARD_HEADER(loaded branch only), then reads the title with a synchronousgetByTestId(TITLE), matching the pattern inPredictEventScreen.view.test.tsx. A short comment documents the remount behavior. Test-only; no app code changes.Reviewed by Cursor Bugbot for commit 11b6ab9. Bugbot is set up for automated code reviews on this repo. Configure here.