purchasesSettingAppTest function
The test of the entry that restores purchases on the settings screen,
which the template of the purchases role contributes, that the CLI keeps
in its app_tests/purchases_setting, for the apps with the purchases
role and the settings screen role, whichever modules provide them. Over
a service of purchases of the test that scripts what a provider answers:
- the settings screen shows the entry once, with its title and no result before a restore, in each language of the app;
- a tap restores once, and the entry shows what the restore found: that the premium access is back, that there was nothing to restore, or that the restore failed, for every reason of a failure and for an error of another kind, with the words of the provider below it in debug mode; a screen reader reads the result as it comes;
- while a restore is on its way, the entry shows a spinner and no result of an earlier restore, and a second tap restores nothing more;
- on a small phone with a large text size, the title and a long failure stay in the row of the entry, in full.
The test knows only the two roles. The matrix writes the type of the widget of the entry for it into purchasesSettingFile, 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 purchases role (purchasesRoleAppTest), which runs in every app that this test runs in. It has no probe for the start check: a restore could ask for the store account on a device, and the walk of the routes goes to the settings screen there.
Implementation
Future<MatrixAppTest> purchasesSettingAppTest() async => MatrixAppTest(
'${await appTestsDirectoryOf('smf_flutter_cli')}/purchases_setting',
appliesTo: (app) => app.hook!.presentRoles
.containsAll(const [purchasesRole, settingsScreenRole]),
generatedFiles: _purchasesSettingOf,
roles: {purchasesRole},
);