title: Flutter - Widget Test throws "None were found" where widgets do exist
body: <p>I tried to test my Flutter app using flutter test like this</p>
  <pre><code>import 'package:flutter/material.dart';
  import 'package:flutter_test/flutter_test.dart';
  import 'package:fnb/ui/page/standard/login.dart' as app;
  
  void main() {
    group(&quot;Login test: &quot;, () {
      testWidgets(&quot;Ensure there are 2 text form, and button widget&quot;,
          (WidgetTester tester) async {
  
        app.LoginPage();
        await tester.pumpAndSettle();
  
        expect(find.byType(TextFormField), findsNWidgets(2));
        expect(find.byKey(Key('Buttonlogin')), findsWidgets);
      });
    });
  }
  </code></pre>
  <p>The result is i got like this:</p>
  <pre><code>The following TestFailure object was thrown running a test:
    Expected: exactly one matching node in the widget tree
    Actual: _WidgetTypeFinder:&lt;zero widgets with type &quot;TextFormField&quot; (ignoring offstage widgets)&gt;
    Which: means none were found but one was expected
  </code></pre>
  <p>But, when i try to open the page that i want to test, there are the existence of these widget like this:</p>
  <p><a href="https://i.stack.imgur.com/5cfOp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5cfOp.png" alt="enter image description here" /></a></p>
  <p>So, whats wrong with my test code?</p>