Fix integration test failures caused by render overflow errors#6664
Merged
Conversation
Any FlutterError reported during a frame (typically "RenderFlex overflowed") fails the on-device testWidgets body, which the exit-code check surfaces as a teardown error on the last test of the module even though all host-side assertions and goldens pass. Test harness: - FletTestApp now captures Flutter test process output and dumps its tail when the process exits non-zero, so CI failures show the reason. - host_test.dart hooks reportTestException to print the exception and stack (flutter test otherwise never prints it) and delays tearDownAll so end-of-run reports are not lost when the process exits. - Screenshot captures are hosted in a hidden-scrollbar scrollable column, so content taller than the test window scrolls instead of overflowing the page; captures and goldens are unaffected. Tests and examples: - test_spinkit: render all spinners inside a scrollable column. - data_table/sortable_and_selectable example: make the page scrollable; the table is 2px taller than the default 800x600 window and drew an overflow on the first frame. - Regenerate stale client/pubspec.lock. CI: temporarily run only the affected tests; restore the full suite list before merging.
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.
Problem
Several macOS integration test suites were failing deterministically (
extensions,controls/material,examples/controls/material,examples/controls/core) with:...while all host-side assertions and golden screenshots passed, and "the Flutter test output above" was empty.
Root cause: any
FlutterErrorreported during a frame — typically a benignRenderFlex overflowed— fails the on-devicetestWidgetsbody, which the exit-code check from #6623 surfaces as a teardown error. Diagnosis was doubly hard because:DEVNULLunlessFLET_TEST_VERBOSE=1), and even locallyflutter testnever prints the failing exception — only "Test failed. See exception logs above."flet_appfixture blames the last test in the module; the real culprit can be any test in it (grid_view's culprit wastest_basic, nottest_horizontal; markdown's wastest_md_1, nottest_md_3).The five deterministic failures were all layout overflows: grid_view
test_basic(200px, page-wide 780×780 grid item), markdowntest_md_1(48px), spinkittest_all_controls_render(867px, 30 spinners), rowtest_vertical_alignment(9px — caused by the screenshot wrapper's own margins), datatabletest_sortable_and_selectable(2px — the example's table is 582px tall vs 580 available, overflowing on the very first frame at the default 800×600 window).Changes
Test harness — diagnosability:
FletTestAppcaptures Flutter test process output (line-truncated, tail-bounded) and dumps it when the process exits non-zero, so CI failures show the actual reason.host_test.darthooksreportTestExceptionto print the exception and stack, and delaystearDownAllby 2s so end-of-run reports aren't lost in the process-exit race.Test harness — overflow prevention:
assert_control_screenshot/wrap_page_controls_in_screenshothost theScreenshotcontrol in a hidden-scrollbar scrollable column, so content taller than the test window scrolls instead of overflowing. The child sees the same unbounded-height constraints as before, so captures — and all existing goldens — are unaffected. Skipped when the page is already scrollable (an expanded host inside a scrollable page would be flex-in-unbounded) and forexpand_screenshot=True.Tests and examples:
test_spinkit: render the wrapped row of all spinners inside a scrollable column.data_table/sortable_and_selectableexample:page.scroll = AUTO— the example genuinely overflowed by 2px on startup at the default window size (visible as debug stripes withflet run).client/pubspec.lock(was missingflet_integration_test, wrongscreen_brightness).No golden images changed.
Verification
All five previously failing modules pass locally on macOS against unchanged goldens, plus sanity checks for
test_slider::test_handling_events(wrap + absolute-coordinate taps) andtest_tabs(expand_screenshot=Truepath). Full CI matrix was green on this branch with the fixes; the temporarily trimmed matrix used during iteration has been restored.Notes
The intermittent "Flutter process exited early with code 1/79" startup flakes seen in some runs (range_slider, textfield) are a separate issue — the new output capture will reveal their cause the next time they occur.
Summary by Sourcery
Improve integration test reliability by capturing Flutter test output and preventing layout overflows in screenshot hosts and examples.
New Features:
Bug Fixes:
Enhancements:
Build:
Tests: