use of com.seleniumtests.util.imaging.ImageDetector in project seleniumRobot by bhecquet.
the class TestImageDetector method searchNonCorrespondingPicture.
/**
* Search an image inside an other one but no corresponding zone should be found
* @throws IOException
*/
@Test(groups = { "ut" }, expectedExceptions = ImageSearchException.class, enabled = false)
public void searchNonCorrespondingPicture() throws IOException {
ImageDetector detector = new ImageDetector(createFileFromResource("tu/images/p9.png"), createFileFromResource("tu/images/creditMutuelLogo.png"));
detector.detectCorrespondingZone();
}
use of com.seleniumtests.util.imaging.ImageDetector in project seleniumRobot by bhecquet.
the class TestImageDetector method searchWithBlackPicture.
/**
* Search an image inside an other one but no corresponding zone should be found
* @throws IOException
*/
@Test(groups = { "ut" }, expectedExceptions = ImageSearchException.class, enabled = false)
public void searchWithBlackPicture() throws IOException {
ImageDetector detector = new ImageDetector(createFileFromResource("tu/images/blackScreen.png"), createFileFromResource("tu/images/creditMutuelLogo.png"));
detector.detectCorrespondingZone();
}
use of com.seleniumtests.util.imaging.ImageDetector in project seleniumRobot by bhecquet.
the class TestImageDetector method searchExactPictureNoScaling.
@Test(groups = { "ut" })
public void searchExactPictureNoScaling() throws IOException {
ImageDetector detector = new ImageDetector(createFileFromResource("tu/images/p9.png"), createFileFromResource("tu/images/vosAlertes.png"));
detector.detectExactZoneWithoutScale();
Rectangle detectedRectangle = detector.getDetectedRectangle();
Assert.assertEquals(detectedRectangle, new Rectangle(575, 137, 30, 108));
}
use of com.seleniumtests.util.imaging.ImageDetector in project seleniumRobot by bhecquet.
the class TestImageDetector method searchPicturesByTemplate2.
@Test(groups = { "ut" })
public void searchPicturesByTemplate2() throws IOException {
ImageDetector detector = new ImageDetector(createFileFromResource("tu/images/infolidays.png"), createFileFromResource("tu/images/bouton_enregistrer2.png"), 0.06);
detector.detectExactZoneWithScale();
Assert.assertEquals(detector.getDetectedRectangle(), new Rectangle(69, 1609, 185, 1299));
Assert.assertEquals(detector.getSizeRatio(), 1.2, 0.05);
}
use of com.seleniumtests.util.imaging.ImageDetector in project seleniumRobot by bhecquet.
the class TestBrowserSnapshot method testCaptureAllPage.
/**
* Check we can rebuild the whole page from partial captures
* This is useful for chrome as snapshot is only taken from visible display
* For firefox, nothing to do
* @throws IOException
*/
@Test(groups = { "it" })
public void testCaptureAllPage() throws IOException {
driver.manage().window().setSize(new Dimension(400, 300));
WaitHelper.waitForSeconds(1);
String topFilePath = generateCaptureFilePath();
FileUtility.writeImage(topFilePath, new ScreenshotUtil(driver).capturePage(0, 0));
// get full picture
File image = new ScreenshotUtil(driver).capture(SnapshotTarget.PAGE, File.class);
String bottomFilePath = generateCaptureFilePath();
FileUtility.writeImage(bottomFilePath, new ScreenshotUtil(driver).capturePage(0, 0));
// exception thrown if nothing found
ImageDetector detectorTop = new ImageDetector(image, new File(topFilePath), 0.001);
detectorTop.detectExactZoneWithScale();
}
Aggregations