test(ensemble): Page header storage timer dispose regression tests#2237
Draft
cursor[bot] wants to merge 1 commit into
Draft
test(ensemble): Page header storage timer dispose regression tests#2237cursor[bot] wants to merge 1 commit into
cursor[bot] wants to merge 1 commit into
Conversation
Widget tests mount Page with storage-bound titleBarHeight and collapsible visibility, remove the widget, then advance fake clock past multiple poll intervals. Ensures dispose cancels periodic timers so no setState runs after dispose (regression guard for page header lifecycle fix). Co-authored-by: Sharjeel Yunus <sharjeelyunus@users.noreply.github.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.
Description
Adds widget regression tests for
Pagelifecycle when the header uses storage-driventitleBarHeight(withlistenTitleBarHeightStorage) or a storage-drivencollapsibleHeader.visibleexpression. These code paths start periodicTimers andStreamSubscriptions; the recentfix(page)change ensures they are cancelled indispose. The tests mount a minimalPage, tear it down, advance the fake clock past multiple poll intervals, and assert no post-dispose exceptions (for examplesetState()called after dispose).Related Issue
N/A (coverage automation for recently merged
fix(page): cancel header timers and dedupe storage event listeners).Type of Change
What Has Changed
modules/ensemble/test/widget/page_storage_timer_dispose_test.dartwith twotestWidgetscases covering title-bar height polling and collapsible-header visibility polling after widget removal.Risky behavior now covered
PageStatewhenlistenTitleBarHeightStorageis enabled withtitleBarHeightreferencingensemble.storage.*(100 ms poll fallback).collapsibleHeader.enabledis true andvisiblereferences storage (150 ms poll).Test files added/updated
modules/ensemble/test/widget/page_storage_timer_dispose_test.dartWhy these tests materially reduce regression risk
They fail loudly if
disposeever stops cancelling those timers: the periodic callbacks would still run after unmount and can triggersetStateon a defunct element, causing flaky production crashes and hard-to-debug CI noise. The assertions use deterministicpump/pumpWidgetonly (no network, no wall-clock).How to Test
From
modules/ensemble:flutter test test/widget/page_storage_timer_dispose_test.dartValidation note
The automation environment did not have the Flutter SDK on
PATH, soflutter testwas not executed here. Please run the command above locally or in CI to confirm.Checklist
flutter analyzeand addressed any new warningsflutter testand all tests pass (not run in this environment — see above)Screenshots / Videos
N/A