Unexpected null result from Navigator.pop in patrolTest after upgrading to 3.19.0
Hi Patrol team,
First of all, thank you for creating such an amazing tool!
I’ve encountered an issue after upgrading Patrol from version 3.13.1 to 3.19.0. In one of my test cases, I open a screen and expect a result from the Navigator.pop method. However, in the Patrol test, the result is null, whereas everything works as expected when running the app normally.
My question is: does navigation inside a patrolTest behave differently compared to usual app execution? Are there any known differences or areas I should investigate to resolve this issue?
══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞═════════════════
The following _TypeError was thrown running a test:
type 'Null' is not a subtype of type 'bool' in type cast
When the exception was thrown, this was the stack:
#0 ModuleNavigator._pushReservationCreationScreen (package:host/app/di/module_navigator.dart:153:19)
Future<bool> _pushReservationCreationScreen(
ReservationCreationInput input,
) async {
final result = await _navigationStack.push(
_reservationCreationScreen(input),
fullscreenDialog: true,
);
return result as bool;
}
Thanks in advance for your help!
Hi @mozhaiskyi, did you try to set some static wait before navigation? Or try to change FramePolicy? My guess is that patrol do actions too fast and app throws some exception 🤔 Can you also attach test body?
Hi @mozhaiskyi ! Sorry for late response. It doesn't look like issue connected to patrol in any way - patrol just runs your app's code without any changes, so navigation works the same as it does in the app ran without patrol.
Make sure to debug your app's code - maybe more things changed than patrol version.
Closing issue as not related to patrol. In case you think the issue is valid, you can reopen the issue or open new one - please provide a project where we can reproduce the error.