Skip to content

Commit

Permalink
Reverted a change to the screenshot processing as it was causing blan…
Browse files Browse the repository at this point in the history
…k screenshots in the reports
  • Loading branch information
wakaleo committed Jan 11, 2024
1 parent a365f97 commit c7f36b9
Showing 1 changed file with 1 addition and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,6 @@ public void testFinished(final TestOutcome outcome, boolean isInDataDrivenTest,
while (!currentGroupStack.isEmpty()) {
finishGroup();
}
removeUnnecesaryScreenshotsFromOutputDir();
LifecycleRegister.clear();
}

Expand Down Expand Up @@ -913,7 +912,7 @@ public void stepFailed(StepFailure failure) {

recordFailureDetails(failure);
}
removeUnnecesaryScreenshotsFromOutputDir();

// In all cases, mark the step as done with the appropriate result
currentStepDone(failureAnalysis.resultFor(failure));
}
Expand All @@ -929,7 +928,6 @@ public void stepFailed(StepFailure failure, List<ScreenshotAndHtmlSource> screen

recordFailureDetails(failure);
}
removeUnnecesaryScreenshotsFromOutputDir();
// Step marked as done with the appropriate result before
currentStepDone(failureAnalysis.resultFor(failure));
}
Expand Down Expand Up @@ -1175,14 +1173,6 @@ private void removeFirstScreenshotOfCurrentStep() {
getCurrentStep().removeScreenshot(0);
}

private void removeUnnecesaryScreenshotsFromOutputDir() {
usedScreenshots.forEach(usedScreenshot -> allScreenshots =
allScreenshots.stream().filter(scr -> !scr.getScreenshotName().equals(usedScreenshot.getScreenshotName()))
.collect(Collectors.toList()));
allScreenshots.forEach(this::removeScreenshot);
}


private void removeScreenshot(ScreenshotAndHtmlSource screenshot) {
if(screenshot.getScreenshot().delete() && currentStep().isPresent()) {
getCurrentStep().getScreenshots().remove(screenshot);
Expand Down Expand Up @@ -1344,15 +1334,13 @@ public void testIgnored() {
if (!testOutcomeRecorded()) {
return;
}
removeUnnecesaryScreenshotsFromOutputDir();
getCurrentTestOutcome().setAnnotatedResult(IGNORED);
}

public void testSkipped() {
if (!testOutcomeRecorded()) {
return;
}
removeUnnecesaryScreenshotsFromOutputDir();
getCurrentTestOutcome().setAnnotatedResult(SKIPPED);
}

Expand All @@ -1361,15 +1349,13 @@ public void testAborted() {
if (!testOutcomeRecorded()) {
return;
}
removeUnnecesaryScreenshotsFromOutputDir();
getCurrentTestOutcome().setAnnotatedResult(ABORTED);
}

public void testPending() {
if (!testOutcomeRecorded()) {
return;
}
removeUnnecesaryScreenshotsFromOutputDir();
getCurrentTestOutcome().setAnnotatedResult(PENDING);
updateExampleTableIfNecessary(PENDING);
}
Expand Down

0 comments on commit c7f36b9

Please sign in to comment.