I am using following code to attach the snapshot in json
import cucumber.api.java.After;
@After
public void tearDown(Scenario scenario) {
if (scenario.isFailed()) {
final byte[] screenshot = ((TakesScreenshot) driver)
.getScreenshotAs(OutputType.BYTES);
scenario.embed(screenshot, "image/png"); //stick it in the report
}
}
and to generate I am using following code:
reportBuilder = new ReportBuilder(jsonReports, reportDirectory, "", buildNumber, buildProject, skippedFails, undefinedFails, flashCharts, runWithJenkins, false, "", false);
But somehow I am getting snapshots attached twice and sometimes they do not work, When i click on snapshot 1 it opens snapshot 2 and vice-versa.