Repository navigation
Fix flet test failing when the app under test starts slowly - #6995
Open
ndonkoHenri wants to merge 4 commits into
Open
ndonkoHenri wants to merge 4 commits into
ndonkoHenri wants to merge 4 commits into
Conversation
The device-mode test driver pumped a fixed 20 frames (~2 s) after starting the app, then connected the remote tester. When the embedded Python app took longer to start, as on the first run after a build (antivirus scanning the new bundle on Windows), the test ran against a blank window. Pump until FletBackend reports the first page loaded instead, with a 2-minute timeout, and fail with the app's startup error if it reports one. Fixes #6993
ndonkoHenri
requested review from
FeodorFitsner
and
a balanced review from Copilot
October 23, 2026 21:52
Deploying flet-website-v2 with
|
| Latest commit: |
99ff465
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://7658766d.flet-website-v2.pages.dev |
| Branch Preview URL: | https://fix-flet-test-wait-for-app-6.flet-website-v2.pages.dev |
1 task done
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.
Fixes #6993.
On desktop (and mobile),
flet testruns the app inside the Flutter test host on its embedded Python.runFletDeviceTeststarted the app, pumped a fixed 20 frames (~2 s), then connected the remote tester. When the app took longer than that to start, the test ran against a blank window. The first run after a build is that slow case, especially on Windows where antivirus scans the new bundle, so a freshly created project failed its own sample test.The driver now pumps until Python sends a test-only
test_readypage flag aftermain()finishes its initial updates (or after the first yield of a generator handler). Registration clearsisLoadingbeforemain()runs, so registration alone does not unblock the tester. Empty apps also signal readiness. The driver times out after 2 minutes with a clear message and fails with the app's startup error if the backend reports one.Testing
Automated follow-up validation after merging the current
flet-1.1.0target:Full device builds were not rerun for the readiness follow-up. Original manual validation of the initial driver change:
Reproduced on Flet 1.0.5 with the
flet createcounter project, then ran the same project against the patched driver (via[tool.flet.flutter.pubspec.dev_dependencies]):time.sleep(5)at the top ofmain.pyassert 0 == 1)The
time.sleep(5)variant makes the race reproducible on any OS.flutter analyzeonflet_integration_testis clean.Summary by Sourcery
Ensure device-mode Flet tests synchronize with application startup before executing remote test commands.
Bug Fixes:
flet testwait for the app’s first page to finish initializing before connecting the remote tester, preventing failures for slow-starting applications.Enhancements:
Tests: