Problema na execução dos testes
Ao rodar flutter test
, o seguinte erro ocorre:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Warning
──────────────────────────────────────────────────────────────────────────────
Your Flutter application is created using an older version of the Android
embedding. It's being deprecated in favor of Android embedding v2. Follow the
steps at
https://flutter.dev/go/android-project-migration
to migrate your project.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
00:00 +0: loading /Users/joao.vieira/puc/manutencao/front-end/test/widget_test.dart
00:01 +0: loading /Users/joao.vieira/puc/manutencao/front-end/test/widget_test.dart
00:02 +0: loading /Users/joao.vieira/puc/manutencao/front-end/test/widget_test.dart
00:03 +0: loading /Users/joao.vieira/puc/manutencao/front-end/test/widget_test.dart
00:03 +0: Counter increments smoke test
00:04 +0: Counter increments smoke test
00:04 +0: Counter increments smoke test
Pending timers:
Timer (duration: 0:00:05.000000, periodic: false), created:
#0 new FakeTimer._ (package:fake_async/fake_async.dart:284:41)
#1 FakeAsync._createTimer (package:fake_async/fake_async.dart:248:27)
#2 FakeAsync.run.<anonymous closure> (package:fake_async/fake_async.dart:181:19)
#5 _SplashScreenState.startTimer (package:boilerplate/ui/splash/splash.dart:34:12)
#6 _SplashScreenState.initState (package:boilerplate/ui/splash/splash.dart:18:5)
#7 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4632:57)
#8 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4469:5)
... Normal element mounting (166 frames)
#174 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3541:14)
#175 MultiChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:6094:32)
... Normal element mounting (300 frames)
#475 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3541:14)
#476 Element.updateChild (package:flutter/src/widgets/framework.dart:3303:20)
#477 RenderObjectToWidgetElement._rebuild (package:flutter/src/widgets/binding.dart:1182:16)
#478 RenderObjectToWidgetElement.update (package:flutter/src/widgets/binding.dart:1160:5)
#479 RenderObjectToWidgetElement.performRebuild (package:flutter/src/widgets/binding.dart:1174:7)
#480 Element.rebuild (package:flutter/src/widgets/framework.dart:4189:5)
#481 BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2694:33)
#482 AutomatedTestWidgetsFlutterBinding.drawFrame (package:flutter_test/src/binding.dart:1102:19)
#483 RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:319:5)
#484 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1144:15)
#485 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1082:9)
#486 AutomatedTestWidgetsFlutterBinding.pump.<anonymous closure> (package:flutter_test/src/binding.dart:969:9)
#489 TestAsyncUtils.guard (package:flutter_test/src/test_async_utils.dart:72:41)
#490 AutomatedTestWidgetsFlutterBinding.pump (package:flutter_test/src/binding.dart:956:27)
#491 WidgetTester.pumpWidget.<anonymous closure> (package:flutter_test/src/widget_tester.dart:522:22)
#494 TestAsyncUtils.guard (package:flutter_test/src/test_async_utils.dart:72:41)
#495 WidgetTester.pumpWidget (package:flutter_test/src/widget_tester.dart:519:27)
#496 main.<anonymous closure> (file:///Users/joao.vieira/puc/manutencao/front-end/test/widget_test.dart:15:18)
#497 main.<anonymous closure> (file:///Users/joao.vieira/puc/manutencao/front-end/test/widget_test.dart:13:48)
#498 testWidgets.<anonymous closure>.<anonymous closure> (package:flutter_test/src/widget_tester.dart:144:29)
<asynchronous suspension>
<asynchronous suspension>
(elided 7 frames from dart:async and package:stack_trace)
══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞════════════════════════════════════════════════════
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 1241 pos 12: '!timersPending'
When the exception was thrown, this was the stack:
#2 AutomatedTestWidgetsFlutterBinding._verifyInvariants (package:flutter_test/src/binding.dart:1241:12)
#3 TestWidgetsFlutterBinding._runTestBody (package:flutter_test/src/binding.dart:803:7)
<asynchronous suspension>
(elided 2 frames from class _AssertionError)
...
The test description was:
Counter increments smoke test
════════════════════════════════════════════════════════════════════════════════════════════════════
00:04 +0 -1: Counter increments smoke test [E]
Test failed. See exception logs above.
The test description was: Counter increments smoke test
00:04 +0 -1: Some tests failed.