loadAppTarget static method
Reads definitions.local from ensemble/ensemble-config.yaml.
Implementation
static Future<EnsembleTestAppTarget> loadAppTarget() async {
if (!EnsembleConfigService.isInitialized) {
await EnsembleConfigService.initialize();
}
final definitions = EnsembleConfigService.config['definitions'];
if (definitions is! Map) {
throw EnsembleTestFailure(
'ensemble/ensemble-config.yaml must define "definitions"',
);
}
final local = definitions['local'];
if (local is! Map) {
throw EnsembleTestFailure(
'Declarative tests require definitions.local in ensemble-config.yaml '
'(path, appHome, i18n.path)',
);
}
final path = local['path']?.toString();
final appHome = local['appHome']?.toString();
if (path == null || path.isEmpty || appHome == null || appHome.isEmpty) {
throw EnsembleTestFailure(
'definitions.local.path and definitions.local.appHome are required',
);
}
String? i18nPath;
final i18n = local['i18n'];
if (i18n is Map && i18n['path'] != null) {
i18nPath = i18n['path'].toString();
}
return EnsembleTestAppTarget(
appPath: EnsembleTestHarness.normalizeAppPath(path),
appHome: appHome,
i18nPath: i18nPath,
);
}