purchasesDeviceAppTest function
The test of the purchases of the user of the device that the CLI keeps in
its app_tests/purchases_device, for the apps with the purchases role and
without the auth role, whichever module provides the purchases: the next
start of the app, initPurchases() again, gives the user of the device
the premium access that it bought, which the device keeps with its user
from one launch to the next.
It is a test of the purchases role, for the apps whose purchases belong to the user of the device alone; the test of the purchases of the users of the session (purchasesSessionAppTest) checks the user of the device in the apps with sign-in. It has helpers of its own, since the test of the role need not run in its apps, and no probe for the start check: a purchase would show the sheet of the store on a device.
Implementation
Future<MatrixAppTest> purchasesDeviceAppTest() async => MatrixAppTest(
'${await appTestsDirectoryOf('smf_flutter_cli')}/purchases_device',
appliesTo: (app) {
final roles = app.hook!.presentRoles;
return roles.contains(purchasesRole) && !roles.contains(authRole);
},
roles: {purchasesRole},
);