Im starting with creating Flutter tests and running into a problem with 2 tests that are exactly the same, but only 1 succeeds.
Gist: https://gist.github.com/Mooibroek/bd6c02e5b56e4b03409ee1839a2e0b23
The second one fails with this error:
The following TestFailure object was thrown running a test:
Expected: exactly one matching node in the widget tree
Actual: ?:<zero widgets with widget matching predicate (Closure: (dynamic) => bool) (ignoring
offstage widgets)>
Which: means none were found but one was expected
When the exception was thrown, this was the stack:
#4 main.<anonymous closure> (file:///Users/nicepants/Projects/flutter/generic_flutter/test/register_test.dart:38:5)
<asynchronous suspension>
#5 testWidgets.<anonymous closure>.<anonymous closure> (package:flutter_test/src/widget_tester.dart:108:25)
Line 38 is the line where we assert if the button is found. I added most of the related code in the GIST, let me know if you need more.
Is it in any way possible that there is some hidden state left from the previous test? Or is this not suppose to work.
