generateE2E method
Future<void>
generateE2E(
{ - required PubspecData pubspecData,
- required String className,
- int? index,
})
Implementation
Future<void> generateE2E({
required PubspecData pubspecData,
required String className,
int? index,
}) async {
try {
final dartServerRepository = DartServerRepository();
await dartServerRepository.initialize();
final libDirectory = Directory(PathUtils.libPath);
final integrationTestDirectory = Directory(PathUtils.integrationTestPath);
final testRunInfo = GenerateRunInfo.newRun();
await dartServerRepository.addFilesToRoot(
[libDirectory.absolute.path, integrationTestDirectory.absolute.path]);
FileSystemEntity file = File(PathUtils.flowsPath);
if (!file.existsSync()) {
wtLog.error(
'Welltested.dart file not found at ${file.path}.\n Please read our docs to learn more.',
);
return;
}
AnalysisContextCollection collection = AnalysisContextCollection(
includedPaths: [
PathUtils.integrationTestPath,
File(PathUtils.flowsPath).absolute.path,
],
resourceProvider: PhysicalResourceProvider.INSTANCE,
);
await processIntegrationRequest(file, collection, pubspecData,
className: className,
dartServerRepository: dartServerRepository,
index: index,
testRunInfo: testRunInfo);
dartServerRepository.dispose();
} catch (e, stackTrace) {
wtTelemetry.trackError(
severity: Severity.error, error: e, stackTrace: stackTrace);
wtLog.warning("Error generating integration tests");
wtLog.log(e.toString());
}
}