When I run the below code in IntelliJ IDE, the image is not displaying in the extent report but the same image is showing in the project folder.
I tried different ways but got the same issue. same is working fine in eclipse
File srcFile = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);//temp directory
String path = System.getProperty("user.dir") + "/screenshot/" + methodName + "_" + System.currentTimeMillis()
+ ".png";
File destination = new File(path);
try {
FileHandler.copy(srcFile, destination);
} catch (IOException e) {
e.printStackTrace();
}
return path;
}
public synchronized void onTestFailure(ITestResult result) {
System.out.println((result.getMethod().getMethodName() + " failed!"));
String methodName = result.getMethod().getMethodName();
test.get().fail("Test failed");
try {
test.get().fail(result.getThrowable(), MediaEntityBuilder.createScreenCaptureFromPath(captureScreenshot(methodName),methodName).build());
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
test.get().getModel().setEndTime(getTime(result.getEndMillis()));
}