/**
*
* @param comparator an image comparator.
*/
public void verifyImage(Comparator comparator) {
ZKSelenium zkSelenium = (ZKSelenium) getCurrent();
String browserName = zkSelenium.getBrowserName();
ConfigHelper configHelper = ConfigHelper.getInstance();
String resultDirStr = configHelper.getImageDest() + File.separator + format.format(new java.util.Date());
String baseDirStr = configHelper.getImageSrc();
if (resultDirStr == null || "".equals(resultDirStr.trim()) ||
baseDirStr == null || "".equals(baseDirStr.trim())) {
verifyTrue("Incorrect setting of images' outputing path. Please check config.properties.", false);
return;
}
try {
File resultDir = new File(resultDirStr);
File baseDir = new File(baseDirStr);
if (!baseDir.exists()) {
baseDir.mkdir();
}
if (!resultDir.exists()) {
resultDir.mkdir();
}
String title = this.getEval("document.title");
byte[] imgByteArr = Base64.decode(zkSelenium.getCmdProcessor().getString("captureEntirePageScreenshotToString", new String[] {title, browserName}));
BufferedImage testBuffImg = ImageIO.read(new ByteArrayInputStream(imgByteArr));
final String postfix = "_" + recordCount++ + ".png";
if (configHelper.isComparable()) {
File basef = new File(baseDir + File.separator + caseID, caseID + "_" + browserName + postfix);