@Test public void testCreatePictureFromBufferedImage() throws Exception { assertRegExMatch(testling.takeScreenshot(rootpath.resolve("test-without-format")).toString(), ".*org.sakuli.actions.screenbased.test-without-format.png"); assertTrue(Files.exists(Paths.get(getResource("test-without-format.png", this.getClass())))); assertRegExMatch(testling.takeScreenshot(rootpath.resolve("test-without-format")).toString(), ".*org.sakuli.actions.screenbased.test-without-format.png"); }
static Path createPictureFromBufferedImage(String message, Path folderPath, String screenShotFormat, BufferedImage bufferedImage) throws IOException { LOGGER.info("create screen shot for error \"" + message + "\""); String fileName = TestSuite.GUID_DATE_FORMATE.format(new Date()) + "_" + replaceSpecialCharacters(message) + "." + screenShotFormat; if (fileName.length() > MAX_FILENAME_LENGTH) { fileName = fileName.substring(0, MAX_FILENAME_LENGTH) + "." + screenShotFormat; } Path pictureFile = folderPath.resolve(fileName); return createPictureFromBufferedImage(pictureFile, screenShotFormat, bufferedImage); }
ScreenshotActions { static Path createPictureFromBufferedImage(String message, Path folderPath, String screenShotFormat, BufferedImage bufferedImage) throws IOException { LOGGER.info("create screen shot for error \"" + message + "\""); String fileName = TestSuite.GUID_DATE_FORMATE.format(new Date()) + "_" + replaceSpecialCharacters(message) + "." + screenShotFormat; if (fileName.length() > MAX_FILENAME_LENGTH) { fileName = fileName.substring(0, MAX_FILENAME_LENGTH) + "." + screenShotFormat; } Path pictureFile = folderPath.resolve(fileName); return createPictureFromBufferedImage(pictureFile, screenShotFormat, bufferedImage); } }
ScreenshotActions { static Path createPictureFromBufferedImage(String message, Path folderPath, String screenShotFormat, BufferedImage bufferedImage) throws IOException { LOGGER.info("create screen shot for error \"" + message + "\""); String fileName = TestSuite.GUID_DATE_FORMATE.format(new Date()) + "_" + replaceSpecialCharacters(message) + "." + screenShotFormat; if (fileName.length() > MAX_FILENAME_LENGTH) { fileName = fileName.substring(0, MAX_FILENAME_LENGTH) + "." + screenShotFormat; } Path pictureFile = folderPath.resolve(fileName); return createPictureFromBufferedImage(pictureFile, screenShotFormat, bufferedImage); } @Autowired  ScreenshotActions(Screen screen, ActionProperties props, @Qualifier("baseLoader") BaseActionLoader baseActionLoader); }
ScreenshotActions { static Path createPictureFromBufferedImage(String message, Path folderPath, String screenShotFormat, BufferedImage bufferedImage) throws IOException { LOGGER.info("create screen shot for error \"" + message + "\""); String fileName = TestSuite.GUID_DATE_FORMATE.format(new Date()) + "_" + replaceSpecialCharacters(message) + "." + screenShotFormat; if (fileName.length() > MAX_FILENAME_LENGTH) { fileName = fileName.substring(0, MAX_FILENAME_LENGTH) + "." + screenShotFormat; } Path pictureFile = folderPath.resolve(fileName); return createPictureFromBufferedImage(pictureFile, screenShotFormat, bufferedImage); } @Autowired  ScreenshotActions(Screen screen, ActionProperties props, @Qualifier("baseLoader") BaseActionLoader baseActionLoader); Path takeScreenshot(Path picturePath); Path takeScreenshot(String filename, Rectangle rectangle); Path takeScreenshot(Path picturePath, Rectangle rectangle); Path takeScreenshotWithTimestamp(final String filenamePostfix, final String optFolderPath, final String optFormat, Rectangle optRectangle); Path takeScreenshotWithTimestamp(String message, Path folderPath); Path takeScreenshotWithTimestamp(String message, Path folderPath, String format, Rectangle rectangle); Path takeScreenshotWithTimestampThrowIOException(String message, Path folderPath, String format, Rectangle rectangle); Path resolveTakeScreenshotPath(String filename); }
ScreenshotActions { static Path createPictureFromBufferedImage(String message, Path folderPath, String screenShotFormat, BufferedImage bufferedImage) throws IOException { LOGGER.info("create screen shot for error \"" + message + "\""); String fileName = TestSuite.GUID_DATE_FORMATE.format(new Date()) + "_" + replaceSpecialCharacters(message) + "." + screenShotFormat; if (fileName.length() > MAX_FILENAME_LENGTH) { fileName = fileName.substring(0, MAX_FILENAME_LENGTH) + "." + screenShotFormat; } Path pictureFile = folderPath.resolve(fileName); return createPictureFromBufferedImage(pictureFile, screenShotFormat, bufferedImage); } @Autowired  ScreenshotActions(Screen screen, ActionProperties props, @Qualifier("baseLoader") BaseActionLoader baseActionLoader); Path takeScreenshot(Path picturePath); Path takeScreenshot(String filename, Rectangle rectangle); Path takeScreenshot(Path picturePath, Rectangle rectangle); Path takeScreenshotWithTimestamp(final String filenamePostfix, final String optFolderPath, final String optFormat, Rectangle optRectangle); Path takeScreenshotWithTimestamp(String message, Path folderPath); Path takeScreenshotWithTimestamp(String message, Path folderPath, String format, Rectangle rectangle); Path takeScreenshotWithTimestampThrowIOException(String message, Path folderPath, String format, Rectangle rectangle); Path resolveTakeScreenshotPath(String filename);  }