Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI Tests compatible with GoRouter #15

Open
diarmaidlindsay opened this issue Dec 19, 2022 · 0 comments
Open

UI Tests compatible with GoRouter #15

diarmaidlindsay opened this issue Dec 19, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@diarmaidlindsay
Copy link
Collaborator

Currently, when clicking on a Top Anime News Item in a UI Test, the following error occurs :

The following assertion was thrown while handling a gesture:
No GoRouter found in context
'package:go_router/src/router.dart':
Failed assertion: line 297 pos 12: 'inherited != null'

This is because the UI Test renders a specific page by specifying it in the home parameter of the MaterialApp.

await tester.pumpWidget(
    ProviderScope(
      overrides: [
        myAnimeListRepositoryProvider
            .overrideWithValue(_mockMyAnimeListRepository)
      ],
      child: const MaterialApp(
        **home: TopAnimePage()**,
      ),
    ),
  );

However, MaterialApp.goRouter() has no such home field, so a starting page for the UI Test cannot be specified as above.
A way must be investigated to write GoRouter UI Tests, or abandon that idea and just test each screen as a separate entity (which might be best).

@diarmaidlindsay diarmaidlindsay added the enhancement New feature or request label Dec 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant