use of ru.yandex.qatools.ashot.Screenshot in project selenium_java by sergueik.
the class VisualTest method takeScreenshot.
// using ashot
public Screenshot takeScreenshot(WebElement element) {
Screenshot elementScreenShot = new AShot().takeScreenshot(driver, element);
/*Screenshot elementScreenShot = new AShot()
.coordsProvider(new WebDriverCoordsProvider())
.takeScreenshot(driver,element);*/
System.out.println(String.format("Size: Height: %d Width: %d", elementScreenShot.getImage().getHeight(), elementScreenShot.getImage().getWidth()));
return elementScreenShot;
}
use of ru.yandex.qatools.ashot.Screenshot in project selenium_java by sergueik.
the class VisualTest method imageCompareTest.
@Test(enabled = true)
public void imageCompareTest() throws Exception {
// Handle popup
handlePopup(".ui-dialog-titlebar-close");
// Close banner
closeBanner();
WebElement uzmanPhotoSection = driver.findElement(By.cssSelector(".item.uzman>a"));
// Unhide Text which is changing A lot
unhideElement("document.getElementsByClassName('count')[0].style.display='none';");
// Move To Operation
moveToElement(uzmanPhotoSection);
// Wait for 2 second for violet color animation
Thread.sleep(2000);
Screenshot screenShot = takeScreenshot(uzmanPhotoSection);
writeScreenshotToFolder(screenShot);
doComparison(screenShot);
}
use of ru.yandex.qatools.ashot.Screenshot in project ashot by yandex-qatools.
the class CroppersTest method testElementOutsideImageIndentCropper.
@Test
public void testElementOutsideImageIndentCropper() throws Exception {
Screenshot screenshot = new IndentCropper(10).cropScreenshot(IMAGE_A_SMALL, OUTSIDE_IMAGE);
assertThat(screenshot.getImage(), ImageTool.equalImage(loadImage("img/expected/outside_ic.png")));
}
use of ru.yandex.qatools.ashot.Screenshot in project ashot by yandex-qatools.
the class CroppersTest method testElementInsideImageIndentCropperWithFilter.
@Test
public void testElementInsideImageIndentCropperWithFilter() throws Exception {
Screenshot screenshot = new IndentCropper().addIndentFilter(IndentFilerFactory.blur()).addIndentFilter(IndentFilerFactory.monochrome()).cropScreenshot(IMAGE_A_SMALL, INSIDE_IMAGE);
assertThat(screenshot.getImage(), ImageTool.equalImage(loadImage("img/expected/inside_icf.png")));
}
use of ru.yandex.qatools.ashot.Screenshot in project ashot by yandex-qatools.
the class DifferTest method testCoordsToCompareAndIgnoredCombine.
@Test
public void testCoordsToCompareAndIgnoredCombine() throws Exception {
Screenshot a = createScreenshotWithIgnoredAreas(IMAGE_A_SMALL, new HashSet<>(asList(new Coords(60, 60))));
a.setCoordsToCompare(new HashSet<>(asList(new Coords(50, 50, 100, 100))));
Screenshot b = createScreenshotWithIgnoredAreas(IMAGE_B_SMALL, new HashSet<>(asList(new Coords(80, 80))));
b.setCoordsToCompare(new HashSet<>(asList(new Coords(50, 50, 100, 100))));
ImageDiff diff = imageDiffer.makeDiff(a, b);
assertThat(diff.getMarkedImage(), ImageTool.equalImage(loadImage("img/expected/combined_diff.png")));
}
Aggregations