1

How do I mock firebase_auth methods in my integration tests?

I am getting the following error:

MissingPluginException(No implementation found for method Auth#registerIdTokenListener on channel plugins.flutter.io/firebase_auth)

The integration test currenlty doesn't do much:

void main() async {

  IntegrationTestWidgetsFlutterBinding.ensureInitialized();

  setupFirebaseAuthMocks();
  await Firebase.initializeApp();
  MockFirebaseAuth(signedIn: false);

  app.main();

}

setupFirebaseAuthMocks(); method I got form this solution: https://stackoverflow.com/a/64730015/6266336

It helped to overcome similiar issue but with Firebase#initializeCore method.

Diana
  • 935
  • 10
  • 31
  • 2
    Stop and re-run your application once. – Diwyansh Jan 14 '22 at 11:59
  • Make sure you're using the latest version of the package from pub.dev and restart your application with a fresh install. Let me know if it still doesn't works – Muhammad Hussain Jan 14 '22 at 12:04
  • @Diwyansh, i am running just the test, will the re-run of the application have any influence on that? – Diana Jan 14 '22 at 12:08
  • There are some dependencies that complies there code when installing the app if you add such a dependency and just restart the app then it will throw No implementation error – Diwyansh Jan 14 '22 at 12:19
  • @MuhammadHussain, I have upgraded firebase_auth to the current version and started the app. But as i mentioned before, the error doesn't occur while running the app, but when running the test.... – Diana Jan 14 '22 at 12:27
  • Did you find the solution for this? – ammu Aug 31 '22 at 19:35

0 Answers0