assertNavigatedTo method

void assertNavigatedTo(
  1. RouteView route
)

Assert that the app navigated to the given route.

Pumps remaining frames to allow navigation animations to complete, then checks Nylo.getCurrentRouteName matches the route path.

Example:

await tester.tap(find.text('Profile'));
tester.assertNavigatedTo(ProfilePage.path);

Implementation

void assertNavigatedTo(RouteView route) {
  final currentRoute = Nylo.getCurrentRouteName();
  expect(
    currentRoute,
    route.$1,
    reason:
        'Expected to navigate to "${route.$1}" but current route is "$currentRoute"',
  );
}