fix(test): filter _zOrderIndex overlay assertion in E2E error handler
OverlayPortalController.hide() asserts _zOrderIndex != null before clearing it. In headless tests without navigation animations, rapid screen dismissal can trigger hide() twice (once on focus loss, once on widget unmount) — a Flutter framework race that overlay.dart itself notes should not happen during rebuilds. Filter it alongside the existing DEFUNCT/DISPOSED suppressions. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
a4cbe35b0f
commit
4e5b523ccc
@@ -153,11 +153,16 @@ void main() {
|
||||
|
||||
// Override the crash handler that app.main() just installed with a
|
||||
// filter that forwards non-spurious errors to the binding's recorder.
|
||||
// On Android/Linux, keyboard-dismiss or teardown can produce
|
||||
// DEFUNCT/DISPOSED layout errors; discard those silently.
|
||||
FlutterError.onError = (details) {
|
||||
final msg = details.toString();
|
||||
// DEFUNCT/DISPOSED: keyboard-dismiss or teardown layout errors on
|
||||
// Android/Linux that have no effect on real functionality.
|
||||
if (msg.contains('DEFUNCT') || msg.contains('DISPOSED')) return;
|
||||
// _zOrderIndex: OverlayPortalController.hide() is called twice during
|
||||
// rapid navigation in tests (once on focus loss, once on widget unmount).
|
||||
// overlay.dart itself notes this should not happen during rebuilds;
|
||||
// it's a Flutter framework race that only reproduces in headless tests.
|
||||
if (msg.contains('_zOrderIndex')) return;
|
||||
bindingError?.call(details);
|
||||
};
|
||||
addTearDown(() => FlutterError.onError = bindingError);
|
||||
|
||||
Reference in New Issue
Block a user