public void takeScreenshot() {
getBaseStepListener().takeScreenshot();
}
goes to
public void takeScreenshot() {
take(MANDATORY_SCREENSHOT);
}
goes to
private void take(final ScreenshotType screenshotType) {
take(screenshotType, UNDEFINED);
}
goes to
private void take(final ScreenshotType screenshotType, TestResult result) {
if (shouldTakeScreenshots()) {...
goes to
private boolean shouldTakeScreenshots() {
return (currentStepExists() && browserIsOpen() && ...
goes to
private boolean currentStepExists() {
return !currentStepStack.isEmpty();
}
and obviously and silently fails to make a screenshot. currentStepStack is of course empty, because no @Step was declared in the first place. It seems, the mandatory screenshot isn't as mandatory as I thought.
My wish would be to make us able to use Serenity.takeScreenshot(). Either by removing currentStepExists() in the 5-fold logical expression in shouldTakeScreenshots(), or by making another check, if @Step(s) is null/empty, and then associating the screenshot to the @Test method in the report.
Silently failing a 5-fold logical expression with no logging trace is a bit weird, as there are other people having problems to get screenshots in their reports.
https://groups.google.com/forum/#!topic/thucydides-users/SfiihhcUzCc
Making it possible to force screenshots at will would give at least a better-than-blind option. It would be even nicer, if something like Serenity.takeScreenshot("Here I log in") would exist, to put a string to the forced screenshot in the report. Forcing a screenshot, even between two @Step isn't as handy as knowing WHY the screenshot has been forced.
if(mischief){ Serenity.takeScreenshot("mischief has happened"); pulldown();
}
Or is there another way to have screenshots be taken without using a Step library?
Greetings
PS: All plugins and dependancies are at their latest release version in the pom.xml, except for serenity-junit, as it puts all passed and pending tests to :/ pending in version 1.1.24. Therefore, we use 1.1.21