olexale / bdd_widget_test

A BDD-style widget testing library
MIT License
101 stars 30 forks source link

Error in step code packages #15

Closed fredgrott closed 3 years ago

fredgrott commented 3 years ago

First the error output when I run goldens update:

PS D:\fredgrttsstuff\GithubProjects\flutter_test\expert_test_setup> flutter test --update-goldens 00:03 +0: D:\fredgrttsstuff\GithubProjects\flutter_test\expert_test_setup\test\counter_test.dart: Counter Initial counter value is 0 ══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞════════════════════════════════════════════════════ The following TestFailure object was thrown running a test: Expected: exactly one matching node in the widget tree Actual: _TextFinder:<zero widgets with text "0" (ignoring offstage widgets)> Which: means none were found but one was expected

When the exception was thrown, this was the stack:

4 iSeeText (package:bdd_widget_test/step/i_see_text.dart:8:3)

5 main.. (file:///D:/fredgrttsstuff/GithubProjects/flutter_test/expert_test_setup/test/counter_test.dart:24:13)

(elided one frame from package:stack_trace) This was caught by the test expectation on the following line: package:bdd_widget_test/step/i_see_text.dart line 8 The test description was: Initial counter value is 0 ════════════════════════════════════════════════════════════════════════════════════════════════════ 00:03 +0 -1: D:\fredgrttsstuff\GithubProjects\flutter_test\expert_test_setup\test\counter_test.dart: Counter Initial counter value is 0 [E] Test failed. See exception logs above. The test description was: Initial counter value is 0 00:03 +0 -1: D:\fredgrttsstuff\GithubProjects\flutter_test\expert_test_setup\test\counter_test.dart: Counter Add button increments the counter ══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞════════════════════════════════════════════════════ The following assertion was thrown running a test: The finder "zero widgets with icon "IconData(U+0E047)" (ignoring offstage widgets)" (used in a call to "tap()") could not find any matching widgets. When the exception was thrown, this was the stack: #0 WidgetController._getElementPoint (package:flutter_test/src/controller.dart:902:7) #1 WidgetController.getCenter (package:flutter_test/src/controller.dart:841:12) #2 WidgetController.tap (package:flutter_test/src/controller.dart:273:18) #3 iTapIcon (package:bdd_widget_test/step/i_tap_icon.dart:9:16) #4 main.. (file:///D:/fredgrttsstuff/GithubProjects/flutter_test/expert_test_setup/test/counter_test.dart:29:13) (elided one frame from package:stack_trace) The test description was: Add button increments the counter ════════════════════════════════════════════════════════════════════════════════════════════════════ 00:03 +0 -2: D:\fredgrttsstuff\GithubProjects\flutter_test\expert_test_setup\test\counter_test.dart: Counter Add button increments the counter [E] Test failed. See exception logs above. The test description was: Add button increments the counter 00:10 +7 -2: Some tests failed. PS D:\fredgrttsstuff\GithubProjects\flutter_test\expert_test_setup> the rep where the expert-est-setup project is at is https://github.com/fredgrott/flutter_test I did look at both: https://github.com/olexale/bdd_widget_test/blob/master/lib/step/i_tap_icon.dart and https://github.com/olexale/bdd_widget_test/blob/master/lib/step/i_see_text.dart things that might stand out: one has a missing wait in async block and let's see on null saefy String and IconData fields should they have late modfiers? The error report does not mentioned nUll os it might not be that. Any thoughts on what it might be?
olexale commented 3 years ago

Hi @fredgrott,

Thanks for this ticket!

await is missing in i_see_text by design as there is no asynchronous operation in this step.

It seems like you're testing the default counter app, have you watched this video? If yes - could you please share the app so I could take a look?

Regards, Oleksandr

olexale commented 3 years ago

Hi Fred,

I've tried to compile expert-test-setup project from https://github.com/fredgrott/flutter_test but it fails to compile with the following error:

Error: unable to find directory entry in pubspec.yaml: /Users/ole/dev/test/flutter_test/expert_test_setup/images/
lib/my_app_textstyles.dart:49:5: Error: No named parameter with the name 'overflow'.
    overflow: TextOverflow.fade,
    ^^^^^^^^
../../../../fvm/versions/stable/packages/flutter/lib/src/painting/text_style.dart:458:9: Context: Found this candidate, but the arguments don't match.
  const TextStyle({
        ^^^^^^^^^
lib/my_app_textstyles.dart:66:5: Error: No named parameter with the name 'overflow'.
    overflow: TextOverflow.fade,
    ^^^^^^^^
../../../../fvm/versions/stable/packages/flutter/lib/src/painting/text_style.dart:458:9: Context: Found this candidate, but the arguments don't match.
  const TextStyle({

        ^^^^^^^^^
lib/my_app_textstyles.dart:83:5: Error: No named parameter with the name 'overflow'.
    overflow: TextOverflow.fade,

    ^^^^^^^^
../../../../fvm/versions/stable/packages/flutter/lib/src/painting/text_style.dart:458:9: Context: Found this candidate, but the arguments don't match.
  const TextStyle({

        ^^^^^^^^^
lib/my_app_textstyles.dart:100:5: Error: No named parameter with the name 'overflow'.

    overflow: TextOverflow.fade,
    ^^^^^^^^
../../../../fvm/versions/stable/packages/flutter/lib/src/painting/text_style.dart:458:9: Context: Found this candidate, but the arguments don't match.
  const TextStyle({

        ^^^^^^^^^
lib/my_app_textstyles.dart:117:5: Error: No named parameter with the name 'overflow'.
    overflow: TextOverflow.fade,
    ^^^^^^^^
../../../../fvm/versions/stable/packages/flutter/lib/src/painting/text_style.dart:458:9: Context: Found this candidate, but the arguments don't match.
  const TextStyle({
        ^^^^^^^^^
lib/my_app_textstyles.dart:134:5: Error: No named parameter with the name 'overflow'.
    overflow: TextOverflow.fade,
    ^^^^^^^^
../../../../fvm/versions/stable/packages/flutter/lib/src/painting/text_style.dart:458:9: Context: Found this candidate, but the arguments don't match.
  const TextStyle({
        ^^^^^^^^^
lib/my_app_textstyles.dart:151:5: Error: No named parameter with the name 'overflow'.
    overflow: TextOverflow.fade,
    ^^^^^^^^
../../../../fvm/versions/stable/packages/flutter/lib/src/painting/text_style.dart:458:9: Context: Found this candidate, but the arguments don't match.
  const TextStyle({

        ^^^^^^^^^
lib/my_app_textstyles.dart:168:5: Error: No named parameter with the name 'overflow'.
    overflow: TextOverflow.fade,

    ^^^^^^^^
../../../../fvm/versions/stable/packages/flutter/lib/src/painting/text_style.dart:458:9: Context: Found this candidate, but the arguments don't match.
  const TextStyle({
        ^^^^^^^^^
lib/my_app_textstyles.dart:184:5: Error: No named parameter with the name 'overflow'.
    overflow: TextOverflow.fade,
    ^^^^^^^^
../../../../fvm/versions/stable/packages/flutter/lib/src/painting/text_style.dart:458:9: Context: Found this candidate, but the arguments don't match.
  const TextStyle({
        ^^^^^^^^^
lib/my_app_textstyles.dart:201:5: Error: No named parameter with the name 'overflow'.
    overflow: TextOverflow.fade,
    ^^^^^^^^
../../../../fvm/versions/stable/packages/flutter/lib/src/painting/text_style.dart:458:9: Context: Found this candidate, but the arguments don't match.
  const TextStyle({
        ^^^^^^^^^
lib/my_app_textstyles.dart:218:5: Error: No named parameter with the name 'overflow'.
    overflow: TextOverflow.fade,
    ^^^^^^^^
../../../../fvm/versions/stable/packages/flutter/lib/src/painting/text_style.dart:458:9: Context: Found this candidate, but the arguments don't match.
  const TextStyle({
        ^^^^^^^^^
lib/my_app_textstyles.dart:235:5: Error: No named parameter with the name 'overflow'.
    overflow: TextOverflow.fade,
    ^^^^^^^^
../../../../fvm/versions/stable/packages/flutter/lib/src/painting/text_style.dart:458:9: Context: Found this candidate, but the arguments don't match.
  const TextStyle({
        ^^^^^^^^^
lib/my_app_textstyles.dart:252:5: Error: No named parameter with the name 'overflow'.
    overflow: TextOverflow.fade,
    ^^^^^^^^
../../../../fvm/versions/stable/packages/flutter/lib/src/painting/text_style.dart:458:9: Context: Found this candidate, but the arguments don't match.
  const TextStyle({
        ^^^^^^^^^
Failed to load "/Users/ole/dev/test/flutter_test/expert_test_setup/test/counter_test.dart": Compilation failed for testPath=/Users/ole/dev/test/flutter_test/expert_test_setup/test/counter_test.dart
dart:async/stream_controller.dart 561:44                       _StreamController.addError
dart:async/stream_controller.dart 830:13                       _StreamSinkWrapper.addError
_GuaranteeSink._addError
_GuaranteeSink.addError
package:flutter_tools/src/test/flutter_platform.dart 466:37    FlutterPlatform._startTest
===== asynchronous gap ===========================
dart:async/zone.dart 1286:19                                   _CustomZone.registerUnaryCallback
dart:async-patch/async_patch.dart 45:22                        _asyncThenWrapperHelper
package:flutter_tools/src/test/flutter_platform.dart 378:36    FlutterPlatform.loadChannel
package:flutter_tools/src/test/flutter_platform.dart 342:44    FlutterPlatform.load
Loader.loadFile.<fn>
===== asynchronous gap ===========================
dart:async/zone.dart 1286:19                                   _CustomZone.registerUnaryCallback
dart:async-patch/async_patch.dart 45:22                        _asyncThenWrapperHelper
package:test_core/src/runner/loader.dart                       Loader.loadFile.<fn>
new LoadSuite.<fn>.<fn>
new LoadSuite.<fn>.<fn>
new LoadSuite.<fn>
Invoker.waitForOutstandingCallbacks.<fn>
Invoker.waitForOutstandingCallbacks.<fn>
dart:async/zone.dart 1354:13                                   _rootRun
dart:async/zone.dart 1258:19                                   _CustomZone.run
dart:async/zone.dart 1789:10                                   _runZoned
dart:async/zone.dart 1711:10                                   runZoned
Invoker.waitForOutstandingCallbacks
Invoker._onRun.<fn>.<fn>.<fn>
===== asynchronous gap ===========================
dart:async/zone.dart 1286:19                                   _CustomZone.registerUnaryCallback
dart:async-patch/async_patch.dart 45:22                        _asyncThenWrapperHelper
package:test_api/src/backend/invoker.dart                      Invoker._onRun.<fn>.<fn>.<fn>
dart:async/zone.dart 1354:13                                   _rootRun
dart:async/zone.dart 1258:19                                   _CustomZone.run
dart:async/zone.dart 1789:10                                   _runZoned
dart:async/zone.dart 1711:10                                   runZoned
Invoker._onRun.<fn>.<fn>
dart:async/zone.dart 1354:13                                   _rootRun
dart:async/zone.dart 1258:19                                   _CustomZone.run
dart:async/zone.dart 1789:10                                   _runZoned
dart:async/zone.dart 1711:10                                   runZoned
Invoker.guard
Invoker._guardIfGuarded
Invoker._onRun.<fn>
Chain.capture.<fn>
dart:async/zone.dart 1354:13                                   _rootRun
dart:async/zone.dart 1258:19                                   _CustomZone.run
dart:async/zone.dart 1789:10                                   _runZoned
dart:async/zone.dart 1711:10                                   runZoned
Chain.capture
Invoker._onRun
LiveTestController.run
dart:async/future.dart 198:37                                  new Future.microtask.<fn>
dart:async/zone.dart 1346:47                                   _rootRun
dart:async/zone.dart 1258:19                                   _CustomZone.run
dart:async/zone.dart 1162:7                                    _CustomZone.runGuarded
dart:async/zone.dart 1202:23                                   _CustomZone.bindCallbackGuarded.<fn>
dart:async/zone.dart 1354:13                                   _rootRun
dart:async/zone.dart 1258:19                                   _CustomZone.run
dart:async/zone.dart 1162:7                                    _CustomZone.runGuarded
dart:async/zone.dart 1202:23                                   _CustomZone.bindCallbackGuarded.<fn>
dart:async/schedule_microtask.dart 40:21                       _microtaskLoop
dart:async/schedule_microtask.dart 49:5                        _startMicrotaskLoop
dart:isolate-patch/isolate_patch.dart 120:13                   _runPendingImmediateCallback
dart:isolate-patch/isolate_patch.dart 185:5                    _RawReceivePortImpl._handleMessage

✖ loading /Users/ole/dev/test/flutter_test/expert_test_setup/test/counter_test.dart
Exited (1)

Have you fixed your problem? Is there anything I can help you with?

Best, Oleksandr

olexale commented 3 years ago

Hi Fred,

I hope you already fixed the problem hence I'm closing the issue. Feel free to reopen the ticket if the problem is still there.

Best, Oleksandr