Skip to content

Fix integration test failures caused by render overflow errors#6664

Merged
FeodorFitsner merged 2 commits into
flet-0.86from
fix-integration-test-overflows
Jul 9, 2026
Merged

Fix integration test failures caused by render overflow errors#6664
FeodorFitsner merged 2 commits into
flet-0.86from
fix-integration-test-overflows

Conversation

@FeodorFitsner

@FeodorFitsner FeodorFitsner commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Problem

Several macOS integration test suites were failing deterministically (extensions, controls/material, examples/controls/material, examples/controls/core) with:

RuntimeError: Flutter integration test process failed with exit code 1. See the Flutter test output above.

...while all host-side assertions and golden screenshots passed, and "the Flutter test output above" was empty.

Root cause: any FlutterError reported during a frame — typically a benign RenderFlex overflowed — fails the on-device testWidgets body, which the exit-code check from #6623 surfaces as a teardown error. Diagnosis was doubly hard because:

  • CI discarded Flutter process output entirely (DEVNULL unless FLET_TEST_VERBOSE=1), and even locally flutter test never prints the failing exception — only "Test failed. See exception logs above."
  • The module-scoped flet_app fixture blames the last test in the module; the real culprit can be any test in it (grid_view's culprit was test_basic, not test_horizontal; markdown's was test_md_1, not test_md_3).

The five deterministic failures were all layout overflows: grid_view test_basic (200px, page-wide 780×780 grid item), markdown test_md_1 (48px), spinkit test_all_controls_render (867px, 30 spinners), row test_vertical_alignment (9px — caused by the screenshot wrapper's own margins), datatable test_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:

  • FletTestApp captures 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.dart hooks reportTestException to print the exception and stack, and delays tearDownAll by 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_screenshot host the Screenshot control 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 for expand_screenshot=True.

Tests and examples:

  • test_spinkit: render the wrapped row of all spinners inside a scrollable column.
  • data_table/sortable_and_selectable example: page.scroll = AUTO — the example genuinely overflowed by 2px on startup at the default window size (visible as debug stripes with flet run).
  • Regenerated stale client/pubspec.lock (was missing flet_integration_test, wrong screen_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) and test_tabs (expand_screenshot=True path). 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:

  • Add buffered capture and tail-dump of Flutter integration test process output when the process exits with a non-zero code.

Bug Fixes:

  • Prevent layout overflow errors from causing deterministic failures in integration tests by hosting screenshot content and spinner rows in scrollable containers.
  • Fix the sortable-and-selectable data table example overflowing the default window size by enabling automatic page scrolling.

Enhancements:

  • Install a custom exception reporter in the Flutter host test to log failing exceptions and stacks, and delay teardown to ensure logs are flushed.
  • Make screenshot helpers wrap content in a hidden-scrollbar scrollable column when the page itself is not scrollable, keeping captures stable while avoiding overflows.

Build:

  • Regenerate the client pubspec.lock to reflect current dependencies including flet_integration_test and correct screen_brightness versions.

Tests:

  • Adjust the spinkit integration test to render all spinners inside a scrollable column instead of a tall wrapped row to avoid page overflow.

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.
@FeodorFitsner FeodorFitsner merged commit 4e70321 into flet-0.86 Jul 9, 2026
23 of 100 checks passed

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@FeodorFitsner FeodorFitsner deleted the fix-integration-test-overflows branch July 9, 2026 23:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant