notificationsSettingAppTest function
The test of the entry of the notifications on the settings screen, which
the template of the notifications role contributes, that the CLI keeps in
its app_tests/notifications_setting, for the apps with the
notifications role and the settings screen role, whichever modules
provide them:
- the settings screen shows the entry once, with its title and whether the app may show notifications, Off or On, in each language of the app; a tap on a first launch asks for the permission through the provider, whose mocks grant it, and the entry shows On; and on a small phone with a large text size, once the list of the screen scrolled to the entry, the state is below the title, and the texts stay in the row of the entry;
- over a service of the test that scripts what a provider answers: a tap asks the user while the app has not asked, once, and the entry shows what the user answered; once the app asked, or while it may show notifications, a tap opens the settings of the system and asks nothing; and the entry follows what the user changed there once the user comes back to the app.
The test knows only the two roles. The matrix writes the type of the widget of the entry for it into notificationsSettingFile, from the entries of the settings screen role of the app, with the texts of the entry in each language of the app, from the localization role. It opens the settings screen with the helper of the tests of the settings screen role, and takes the service of the test from the files of the test of the notifications role, which runs in every app that this test runs in. It has no probe for the start check: a tap would show the question of the system on a device, and the walk of the routes goes to the settings screen there.
Implementation
Future<MatrixAppTest> notificationsSettingAppTest() async => MatrixAppTest(
'${await appTestsDirectoryOf('smf_flutter_cli')}/notifications_setting',
appliesTo: (app) => app.hook!.presentRoles
.containsAll({notificationsRole, settingsScreenRole}),
generatedFiles: _notificationsSettingOf,
roles: {notificationsRole},
);