Open egonm12 opened 7 months ago
This happens because showDialog
is looking up for the root Navigator created by the MaterialApp
.
I think this test scenario it's not a test case for a mocked navigation, where you are navigating between two routes. You can cover these scenarios best with integration tests or using a concrete Navigator.
But if you really want to try, provide a Navigator above MaterialApp and replace it in tests, or, receive a Navigator as parameter in the MyFloatingActionButton
, and pass the mock during tests.
Thanks @robsonsilv4 for taking the time to reply, @egonm12 did the reply help solve your issue?
Describe the bug When I open a dialog with
showDialog
and I pop it,verify
tells me it never called.pop
while it did.To Reproduce
Reproducible example: https://github.com/egonm12/flutter_mockingjay/tree/main
Expected behavior
All tests pass