2

I tried to create a test for my flutter app with integration_test. There is some error when i tried to run the test. Here's the error on the terminal:

'package:flutter_test/src/binding.dart': Failed assertion: line 810 pos 14: '_pendingExceptionDetails != null': A test overrode FlutterError.onError but either fail ed to return it to its original state, or had unexpected additional errors that it could not handle. Typically, this is caused by using expect() before restoring Flut terError.onError.

Here's my code :

void main() {
  testWidgets('Test_Login_Using_Robo', (tester) async {
    app.main();
    await tester.pump();
    await tester.pumpAndSettle(const Duration(seconds: 5));
    final phoneNumberLoginTextField = find.byKey(const Key('phoneNumberTextField'));
    await tester.tap(phoneNumberLoginTextField);
    expect(phoneNumberLoginTextField, findsOneWidget);
    await tester.enterText(phoneNumberLoginTextField, '82220099611');

    await tester.tap(find.byKey(const Key('loginButton')));

    ///Wait user for loggin in
    await tester.pumpAndSettle(const Duration(seconds: 5));

    ///We Expect to see the otp Screen
    expect(find.byType(OTPControllerScreen), findsOneWidget);
  });
}

Which part is resulting this error ? how to fix this ? thanks before

Kim San
  • 575
  • 7
  • 22

0 Answers0