title: Integration testing using Flutter Driver for OTPTextField widget in flutter
body: <p>I am trying to do integration testing using flutter driver. I am using await driver.enterText(find.byType('OTPTextField')) to enter the otp using flutter driver. But it's stuck at that screen and does nothing and the test fails after termination error. The OTPTextField widget kind of has a different UI than normal text field. I am not sure whether enterText function will work in this or not. If not, what are some alternatives?</p>
  <p>Here is my code for <a href="https://pub.dev/packages/otp_text_field" rel="nofollow noreferrer">OTPTextField</a> widget:</p>
  <pre><code>OTPTextField(
                  key: const Key('otpvalue'),
                  length: 6,
                  textFieldAlignment: MainAxisAlignment.spaceAround,
                  fieldWidth: 30,
                  fieldStyle: FieldStyle.underline,
                  width: MediaQuery.of(context).size.width / 2,
                  style: TextStyle(
                      fontSize: 17,
                      color: Colors.black,
                      fontWeight: FontWeight.bold),
                  onCompleted: (pin) async {
                    print(&quot;Completed: &quot; + pin);
                    print(_user.status);
                    if (_user.status == Status.VerifyingOTP ||
                        _user.status == Status.VerifiedOTP) {
                      Navigator.of(context).push(
                          MaterialPageRoute(builder: (_) =&gt; LoaderScreen()));
                        return;
                    }
                    if (widget.isSignup) {
                      if (await _user.signUpWithPhoneNumber(
                        pin.toString(),
                        context,
                        email: widget.emailId,
                        firstName: widget.firstName,
                        lastName: widget.lastName,
                      )) {
                        Navigator.of(context).pushReplacement(
                            MaterialPageRoute(
                                builder: (context) =&gt; OtpVerified()));
                      } else {
                        Navigator.of(context).push(
                            MaterialPageRoute(
                                builder: (context) =&gt; LoaderScreen()));
                      }
                    } else {
                      if (await _user.signInWithPhoneNumber(
                          pin.toString(), context, _user.language, _user.country)) {
                        Navigator.of(context).pushReplacement(
                            MaterialPageRoute(
                                builder: (context) =&gt; OtpVerified()));
                      } else {
                        Navigator.of(context).push(
                            MaterialPageRoute(
                                builder: (context) =&gt; LoaderScreen()));
                      }
                    }
                  },
                ),
  </code></pre>
  <p>And here is the code for integration testing what I tried for this widget.</p>
  <pre><code>test('enter otp', () async {
   SerializableFinder enterotp = find.byValueKey('otpvalue');
    await driver.tap(enterotp);
    await driver.enterText('123456');
    expect(await driver.getText(enterotp), &quot;123456&quot;);
  });
  </code></pre>