Open maliwalm opened 7 years ago
Are you saving the snapshots relative to the report? And, when moving the report, are you also moving all the artifacts(images, files etc) along?
I am saving the Report in folder //Reports & Screenshots on //Reports//Screenshot
Below is the AfterMethod of TestNG
@AfterMethod
protected void AfterMethod(ITestResult result) throws IOException
{
log.info(" : TestBase - AfterMethod called");
if (result.getStatus() == ITestResult.FAILURE)
{
String screenShotPath = Util.captureScreenshot(eventDriver, "Failure");
test.get().fail(result.getThrowable());
test.get().fail(MarkupHelper.createLabel(result.getName() + "Test case FAILED" , ExtentColor.RED));
test.get().fail("Snapshot below: " + test.get().addScreenCaptureFromPath(screenShotPath));
}
else if (result.getStatus() == ITestResult.SKIP)
test.get().skip(result.getThrowable());
else
test.get().pass("Test passed");
if(eventDriver!=null)
eventDriver.quit();
}
public static String captureScreenshot(WebDriver driver,String screenshotName)
{
log.info(" : CaptureScreeshot Method Called");
try
{
TakesScreenshot ts=(TakesScreenshot)driver;
File source=ts.getScreenshotAs(OutputType.FILE);
String dest = System.getProperty(("user.dir"))+ "\Reports\ScreenShots\"+screenshotName+ "_" + Util.generateUniqueName() + ".png";
File destination = new File(dest);
FileUtils.copyFile(source, destination);
return dest;
}
catch (Exception ex)
{
log.error(ex.getMessage());
ex.printStackTrace();
return ex.getMessage();
}
}
This is a Browser specific issue which is working fine on Chrome but failing on Firefox
I am using the latest version of both the browsers - Chrome - Version 58.0.3029.110 (64-bit) Firefox - 53.0.2 (64-bit)
Summary
Unable to View Screenshot on Extent Report 3 (JAVA) on Firefox
Expected Behavior
User should be able to View Screenshot on Extent report irrespective of Browser.
Current Behavior
1 User is able to view the screenshot for other can't Note - both the users are using the same code set
Sample
calling in beforeSuite of TestNG extent = ExtentManager.getInstance();
public class ExtentManager {
}
Environment Details
Browser version mentioned in comments
Screenshots
report file attached