test(ensemble): regression cover Page header timer dispose#2230
Draft
cursor[bot] wants to merge 1 commit into
Draft
test(ensemble): regression cover Page header timer dispose#2230cursor[bot] wants to merge 1 commit into
cursor[bot] wants to merge 1 commit into
Conversation
Adds a widget regression test for the fix that cancels periodic titleBarHeight and collapsibleHeader visibility timers and avoids duplicate storage listeners. Verifies unmounting the Page does not leave periodic timers firing setState on disposed state. 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 a focused widget test for
Pagewhen the header uses storage-backedtitleBarHeight(withlistenTitleBarHeightStorage) and a storage-backed collapsible headervisibleexpression. This exercises the production paths fromfix(page): cancel header timers and dedupe storage event listeners(commit2c45e427), which previously had no automated coverage.Related Issue
Regression coverage automation (no filed issue).
Type of Change
What Has Changed
modules/ensemble/test/widget/page_header_timer_dispose_test.dart, which mounts a minimalPagefrom YAML with both periodic header checks enabled, removes it from the tree, pumps past the poll intervals, and asserts no exception (undisposedTimer.periodiccallbacks would typically callsetStateon disposedPageStateand surface asFlutterError).How to Test
melos bootstrap(if dependencies are not linked).cd modules/ensemble && flutter test test/widget/page_header_timer_dispose_test.dartCI note: The automation sandbox did not have the Flutter SDK on
PATH, soflutter testwas not executed here. Please run the command above locally or in CI to confirm.Screenshots / Videos
N/A
Checklist
flutter analyzeand addressed any new warningsflutter testand all tests passRisky behavior now covered
Pagemust not leaveTimer.periodicinstances running for title-bar height fallback polling (100 ms) or collapsible-header visibility polling (150 ms). If those timers are not cancelled indispose, they continue to tick and can invokesetStateafter unmount.Test files added/updated
modules/ensemble/test/widget/page_header_timer_dispose_test.dart(new)Why this reduces regression risk
The fix addressed real lifecycle bugs (leaks and redundant listeners). This test is a minimal, deterministic guard: it drives the exact code paths that start the periodic timers and proves that tearing down the widget does not leave async work that throws during subsequent frame/timer pumps—catching regressions if
disposestops cancelling timers again.