flavorsAppTest function
The test of the flavor of a running app that the CLI keeps in its
app_tests/flavors, for the apps that among accepts, or all of them,
whichever module provides the app entry: appFlavor of Flutter is the
default flavor that the role names (AppEntryRole.defaultFlavor), since
flutter test is a command without --flavor.
Only a run of the flutter tool shows what such a command builds, so the
rules of the role leave that value to this test, and a provider that names
another flavor of the role fails it.
Its probe, which the start check runs on a device, compares appFlavor
with the flavor that the build asked for, which a build tells it with a
value of the build (startFlavorDefine) and is the default flavor without
one. So the debug start of CI shows the default flavor on a device, on each
version of Flutter of the nightly run, and its release start the one in
startReleaseBuildArguments. The id and the name of the app on a device
are native, so no running app shows them.
The test knows only the role, and has no mocks. The matrix fills in the flavor and the name of the value.
Implementation
Future<MatrixAppTest> flavorsAppTest({
bool Function(MatrixApp app)? among,
}) async =>
MatrixAppTest(
'${await appTestsDirectoryOf('smf_flutter_cli')}/flavors',
appliesTo: among ?? (_) => true,
values: (_) => {
'default_flavor': AppEntryRole.defaultFlavor.name,
'flavor_define': startFlavorDefine,
},
roles: {appEntryRole},
startProbe: const MatrixStartProbe(
'integration_test/flavors/probe.dart',
'probeFlavor',
),
);