I'm using Junit, cucumber framework for executing my test scripts. The setup and execution of code takes place on VDI.
Here is the below code, I'm using for attaching the screenshot in the Apphooks-
@AfterStep
public void addScreenshot(Scenario scenario){
final byte[] screenshot = ((TakesScreenshot) driver).getScreenshotAs(OutputType.BYTES);
scenario.attach(screenshot, "image/png", "image");
}
Below is my extent.properties file content-
#extent.properties
extent.reporter.spark.start=true
extent.reporter.spark.out=target/MyReports/Spark.html
#Screenshot
screenshot.dir=target/MyReports/Screenshots/
screenshot.rel.path=../Screenshots/
#Adding folder name and non repeating pattern
basefolder.name=target/MyReports
basefolder.datetimepattern=d-MMM-YY HH-mm-ss
Screenshots are getting generated in the screenshot folder with the default names like embedded1, embedded2 etc.
But the screenshots in the extent report is showing as a small blank box below my test step. Why so?
I don't think Output.BYTES needs a path to be explicitly given to attach the screenshots in the report.