I'm getting FirebaseException
is CAUGHT BY FLUTTER TEST FRAMEWORK, while flutter integration test is being run.!
Can anybody help in understading how to ignore the FirebaseException
in integration test and continue the rest of execution?
I tried below walkaround,
Future<void> restoreFlutterError(Future<void> Function() call) async {
FlutterError.onError = (FlutterErrorDetails data) {
if (data.exception is FirebaseException) {
return;
}
FlutterError.presentError(data);
};
}
And called above method in testWidgets
by
testWidgets('test execution', (tester) async {
await restoreFlutterError(() async {
app.main();
await tester.pumpAndSettle(const Duration(seconds: 10));
});
...
...
});
But getting below error.!
A test overrode FlutterError.onError but either failed 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 FlutterError.onError.
Any helps appreciated.!
I managed to ignore exceptions by modifying FlutterError.onError function. Something like this worked for me:
Later calling it in testWidgets like this, depending on the Exception thrown that you want to ignore: