Skip to content

Commit

Permalink
fix: Fixed an issue in which tests were slowed down after a failing s…
Browse files Browse the repository at this point in the history
…tep because Serenity continued to try to take screenshots
  • Loading branch information
wakaleo committed Feb 20, 2015
1 parent e20146d commit d7f4cd3
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ public void clearForcedResult() {
}

private void take(final ScreenshotType screenshotType) {
if (currentStepExists() && browserIsOpen()) {
if (shouldTakeScreenshots()) {
try {
Optional<ScreenshotAndHtmlSource> screenshotAndHtmlSource = grabScreenshot();
if (screenshotAndHtmlSource.isPresent()) {
Expand All @@ -559,6 +559,12 @@ private void take(final ScreenshotType screenshotType) {
}
}

private boolean shouldTakeScreenshots() {
return (currentStepExists() && browserIsOpen()
&& !StepEventBus.getEventBus().aStepInTheCurrentTestHasFailed()
&& !StepEventBus.getEventBus().currentTestIsSuspended());
}

private void removeDuplicatedInitalScreenshotsIfPresent() {
if (currentStepHasMoreThanOneScreenshot() && getPreviousStep().isPresent() && getPreviousStep().get().hasScreenshots()) {
ScreenshotAndHtmlSource lastScreenshotOfPreviousStep = lastScreenshotOf(getPreviousStep().get());
Expand Down

0 comments on commit d7f4cd3

Please sign in to comment.