Skip to content

Commit

Permalink
updated log levels in ScreenShotManager
Browse files Browse the repository at this point in the history
  • Loading branch information
anandbagmar committed Nov 5, 2024
1 parent 1afe3ed commit 9fe1941
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/main/java/com/znsio/teswiz/tools/ScreenShotManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,19 @@ public void takeScreenShot(WebDriver driver, String fileName) {
if(null != driver) {
fileName = normaliseScenarioName(getPrefix() + "-" + fileName);
File destinationFile = createScreenshotFile(directoryPath, fileName);
LOGGER.info(
"The screenshot will be placed here : " + destinationFile.getAbsolutePath());
LOGGER.debug("The screenshot will be placed here : " + destinationFile.getAbsolutePath());
try {
File screenshot = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
LOGGER.info("Original screenshot : " + screenshot.getAbsolutePath());
LOGGER.debug("Original screenshot : " + screenshot.getAbsolutePath());
FileUtils.copyFile(screenshot, destinationFile);
LOGGER.info(
"The screenshot is available here : " + destinationFile.getAbsolutePath());
LOGGER.info("The screenshot is available here : " + destinationFile.getAbsolutePath());
ReportPortalLogger.attachFileInReportPortal(fileName, destinationFile);
} catch(IOException | RuntimeException e) {
LOGGER.info(
"ERROR: Unable to save or upload screenshot: '" + destinationFile.getAbsolutePath() + "' or upload screenshot to ReportPortal\n");
LOGGER.warn("ERROR: Unable to save or upload screenshot: '" + destinationFile.getAbsolutePath() + "' or upload screenshot to ReportPortal\n");
LOGGER.debug(ExceptionUtils.getStackTrace(e));
}
} else {
LOGGER.info("Driver is not instantiated for this test");
LOGGER.warn("Driver is not instantiated for this test");
}
}

Expand Down

0 comments on commit 9fe1941

Please sign in to comment.