Package com.vaadin.testbench.screenshot
Class ImageFileUtil
- java.lang.Object
-
- com.vaadin.testbench.screenshot.ImageFileUtil
-
public class ImageFileUtil extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classImageFileUtil.ImageFileUtilImpl
-
Constructor Summary
Constructors Constructor Description ImageFileUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidcreateScreenshotDirectoriesIfNeeded()Creates all directories used to store screenshots unless they already exist.static FilegetErrorScreenshotFile(String errorImageFileName)static List<String>getReferenceImageFileNames(String referenceImageFileName, org.openqa.selenium.Capabilities capabilities)Returns the relative file names of reference images.static FilegetReferenceScreenshotFile(String referenceImageFileName)static StringgetScreenshotErrorDirectory()Returns the directory used for screenshot error images.static StringgetScreenshotReferenceDirectory()Returns the directory used for screenshot references.static BufferedImagereadReferenceImage(String referenceImageFileName)Reads the given reference image into a BufferedImage
-
-
-
Method Detail
-
getScreenshotReferenceDirectory
public static String getScreenshotReferenceDirectory()
Returns the directory used for screenshot references.- Returns:
- The screenshot reference directory, ending in a slash.
-
getScreenshotErrorDirectory
public static String getScreenshotErrorDirectory()
Returns the directory used for screenshot error images.- Returns:
- The screenshot error directory, ending in a slash.
-
createScreenshotDirectoriesIfNeeded
public static void createScreenshotDirectoriesIfNeeded()
Creates all directories used to store screenshots unless they already exist.
-
readReferenceImage
public static BufferedImage readReferenceImage(String referenceImageFileName) throws IOException
Reads the given reference image into a BufferedImage- Parameters:
referenceImageFileName- The name of the reference image file.- Returns:
- a BufferedImage containing the reference image.
- Throws:
IOException- if an error occurs during reading.
-
getReferenceScreenshotFile
public static File getReferenceScreenshotFile(String referenceImageFileName)
-
getReferenceImageFileNames
public static List<String> getReferenceImageFileNames(String referenceImageFileName, org.openqa.selenium.Capabilities capabilities)
Returns the relative file names of reference images. The actual image file for a relative file name can be retrieved withgetReferenceScreenshotFile(String).- Parameters:
referenceImageFileName- id part of the reference image file namecapabilities- used to compute the full name of the alternative references- Returns:
- file names of reference images
-
-