macosui / macos_ui

Flutter widgets and themes implementing the current macOS design language.
https://macosui.github.io/macos_ui/#/
MIT License
1.82k stars 178 forks source link

53 tests fail with message “A Timer is still pending even after the widget tree was disposed.” #376

Closed Adrian-Samoticha closed 1 year ago

Adrian-Samoticha commented 1 year ago

Description

53 tests fail in the current dev branch, however, it appears that they all run into the same issue, which is that some timer isn't being canceled when the widget that created it is disposed:

The following assertion was thrown running a test:
A Timer is still pending even after the widget tree was disposed.
'package:flutter_test/src/binding.dart':
Failed assertion: line 1450 pos 12: '!timersPending'

When the exception was thrown, this was the stack:
#2      AutomatedTestWidgetsFlutterBinding._verifyInvariants (package:flutter_test/src/binding.dart:1450:12)
#3      TestWidgetsFlutterBinding._runTestBody (package:flutter_test/src/binding.dart:952:7)
<asynchronous suspension>
(elided 2 frames from class _AssertionError)

Steps To Reproduce

  1. Run all tests inside the project
  2. Find that only 89/142 tests have passed, while those that didn't all show the same error message.
Code sample n/a

Expected behavior

All tests pass.

Screenshots

Screenshot 2023-03-02 at 12 53 32

Logs

Logs n/a ``` Analyzing example... No issues found! (ran in 1.0s) ``` ``` [✓] Flutter (Channel stable, 3.7.5, on macOS 13.1 22C65 darwin-arm64, locale en-US) • Flutter version 3.7.5 on channel stable at /Users/adriansamoticha/flutter/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision c07f788888 (8 days ago), 2023-02-22 17:52:33 -0600 • Engine revision 0f359063c4 • Dart version 2.19.2 • DevTools version 2.20.1 [✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0) • Android SDK at /Users/adriansamoticha/Library/Android/sdk • Platform android-31, build-tools 31.0.0 • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 14.2) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 14C18 • CocoaPods version 1.11.3 [✗] Chrome - develop for the web (Cannot find Chrome executable at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome) ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable. [✓] Android Studio (version 2020.3) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165) [✓] VS Code (version 1.75.1) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.58.0 [✓] Connected device (1 available) • macOS (desktop) • macos • darwin-arm64 • macOS 13.1 22C65 darwin-arm64 [✓] HTTP Host Availability • All required HTTP hosts are available ! Doctor found issues in 1 category. ```
Adrian-Samoticha commented 1 year ago

I have noticed that I was on the wrong branch when I ran the tests (I was on my own dev branch). I will attempt to fix the error before submitting my PR.