Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allure report hotfix #1490

Merged
merged 9 commits into from
Feb 22, 2024
Merged
3 changes: 2 additions & 1 deletion src/main/java/com/shaft/listeners/TestNGListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -203,11 +203,12 @@ public void onExecutionFinish() {
Thread summaryReportGeneration = Thread.ofVirtual().start(() -> ExecutionSummaryReport.generateExecutionSummaryReport(passedTests.size(), failedTests.size(), skippedTests.size(), executionStartTime, executionEndTime));
Thread.ofVirtual().start(JiraHelper::reportExecutionStatusToJira);
Thread.ofVirtual().start(GoogleTink::encrypt);
Thread.ofVirtual().start(AllureManager::openAllureReportAfterExecution);
Thread.ofVirtual().start(ReportManagerHelper::logEngineClosure);
Thread openAllureReportAfterExecution = Thread.ofVirtual().start(AllureManager::openAllureReportAfterExecution);
try {
summaryReportGeneration.join();
allureArchiveGeneration.join();
openAllureReportAfterExecution.join();
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
Expand Down
14 changes: 10 additions & 4 deletions src/main/java/com/shaft/tools/io/internal/AllureManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public class AllureManager {
+ File.separator + "repository" + File.separator + "allure" + File.separator;
private static String allureResultsFolderPath = "";
private static String allureBinaryPath = "";
private static String allureOutPutDirectory = "";
private static final String allureReportPath = "allure-report";

public static void initializeAllureReportingEnvironment() {
Expand All @@ -39,6 +40,12 @@ public static void initializeAllureReportingEnvironment() {

public static void openAllureReportAfterExecution() {
writeAllureReport();
copyAndOpenAllure();
}

private static void copyAndOpenAllure(){
FileActions.getInstance(true).copyFolder(allureOutPutDirectory, allureReportPath);
FileActions.getInstance(true).deleteFile(allureOutPutDirectory);
String newFileName = renameAllureReport();
openAllureReport(newFileName);
}
Expand Down Expand Up @@ -157,18 +164,17 @@ private static void writeAllureReport() {
String commandToCreateAllureReport;
allureBinaryPath = allureExtractionLocation + "allure-" + SHAFT.Properties.internal.allureVersion()
+ "/bin/allure";
String outputDirectory = System.getProperty("user.dir") + File.separator + "target" + File.separator + allureReportPath;
allureOutPutDirectory = System.getProperty("user.dir") + File.separator + "target" + File.separator + allureReportPath;
if (SystemUtils.IS_OS_WINDOWS) {
commandToCreateAllureReport = allureBinaryPath + ".bat" + " generate --single-file --clean '"
+ allureResultsFolderPath.substring(0, allureResultsFolderPath.length() - 1)
+ "' -o '" + outputDirectory + "'";
+ "' -o '" + allureOutPutDirectory + "'";
} else {
commandToCreateAllureReport = allureBinaryPath + " generate --single-file --clean "
+ allureResultsFolderPath.substring(0, allureResultsFolderPath.length() - 1)
+ " -o " + outputDirectory;
+ " -o " + allureOutPutDirectory;
}
TerminalActions.getInstance(false, false).performTerminalCommand(commandToCreateAllureReport);
FileActions.getInstance(true).copyFolder(outputDirectory, allureReportPath);
}

private static void createAllureReportArchive() {
Expand Down
Loading