use of com.seleniumtests.uipage.htmlelements.ScreenZone in project seleniumRobot by bhecquet.
the class TestScreenZone method testDoubleClickAtCoordinates.
/**
* Clic at given coordinate on screen without picture reference
*/
@Test(groups = { "it" })
public void testDoubleClickAtCoordinates() {
try {
// search zone to click
DriverTestPageWithoutFixedPattern.googleForDesktop.findElement();
Rectangle rectangle = DriverTestPageWithoutFixedPattern.googleForDesktop.getDetectedObjectRectangle();
// clic with a new ScreenZone
new ScreenZone("image").doubleClickAt(rectangle.x + 10, rectangle.y + 10);
} catch (ImageSearchException e) {
throw new SkipException("Image not found, we may be on screenless slave", e);
}
Assert.assertEquals(DriverTestPageWithoutFixedPattern.textElement.getValue(), "double click image");
}
use of com.seleniumtests.uipage.htmlelements.ScreenZone in project seleniumRobot by bhecquet.
the class TestScreenZone method testClickAtCoordinates.
/**
* Clic at given coordinate on screen without picture reference
*/
@Test(groups = { "it" })
public void testClickAtCoordinates() {
try {
// search zone to click
DriverTestPageWithoutFixedPattern.googleForDesktop.findElement();
Rectangle rectangle = DriverTestPageWithoutFixedPattern.googleForDesktop.getDetectedObjectRectangle();
// clic with a new ScreenZone
new ScreenZone("image").clickAt(rectangle.x + 10, rectangle.y + 10);
} catch (ImageSearchException e) {
throw new SkipException("Image not found, we may be on screenless slave", e);
}
Assert.assertEquals(DriverTestPageWithoutFixedPattern.textElement.getValue(), "image");
}
use of com.seleniumtests.uipage.htmlelements.ScreenZone in project seleniumRobot by bhecquet.
the class TestScreenZone method testRightClick.
@Test(groups = { "ut" })
public void testRightClick() {
ScreenZone picElement = spy(screenZone);
picElement.setObjectPictureFile(new File(""));
PowerMockito.mockStatic(CustomEventFiringWebDriver.class);
PowerMockito.mockStatic(WebUIDriver.class);
when(WebUIDriver.getWebDriver(anyBoolean())).thenReturn(driver);
when(driver.getBrowserInfo()).thenReturn(browserInfo);
when(browserInfo.getBrowser()).thenReturn(BrowserType.FIREFOX);
doReturn(screenshotUtil).when(picElement).getScreenshotUtil();
when(screenshotUtil.capture(SnapshotTarget.SCREEN, File.class, true)).thenReturn(new File(""));
when(imageDetector.getDetectedRectangle()).thenReturn(new Rectangle(10, 10, 100, 50));
when(imageDetector.getSizeRatio()).thenReturn(1.0);
picElement.rightClickAt(0, 0);
verify(picElement).moveAndRightClick(35, 60);
}
use of com.seleniumtests.uipage.htmlelements.ScreenZone in project seleniumRobot by bhecquet.
the class TestScreenZone method testClick.
@Test(groups = { "ut" })
public void testClick() {
ScreenZone picElement = spy(screenZone);
picElement.setObjectPictureFile(new File(""));
PowerMockito.mockStatic(CustomEventFiringWebDriver.class);
PowerMockito.mockStatic(WebUIDriver.class);
when(WebUIDriver.getWebDriver(anyBoolean())).thenReturn(driver);
when(driver.getBrowserInfo()).thenReturn(browserInfo);
when(browserInfo.getBrowser()).thenReturn(BrowserType.FIREFOX);
doReturn(screenshotUtil).when(picElement).getScreenshotUtil();
when(screenshotUtil.capture(SnapshotTarget.SCREEN, File.class, true)).thenReturn(new File(""));
when(imageDetector.getDetectedRectangle()).thenReturn(new Rectangle(10, 10, 100, 50));
when(imageDetector.getSizeRatio()).thenReturn(1.0);
picElement.click();
verify(picElement).moveAndLeftClick(35, 60);
}
use of com.seleniumtests.uipage.htmlelements.ScreenZone in project seleniumRobot by bhecquet.
the class TestScreenZone method testPictureNotVisible.
@Test(groups = { "ut" })
public void testPictureNotVisible() throws AWTException {
ScreenZone picElement = spy(screenZone);
picElement.setObjectPictureFile(new File(""));
doReturn(screenshotUtil).when(picElement).getScreenshotUtil();
when(screenshotUtil.capture(SnapshotTarget.SCREEN, File.class, true)).thenReturn(new File(""));
doThrow(ImageSearchException.class).when(imageDetector).detectExactZoneWithScale();
Assert.assertFalse(picElement.isElementPresent());
verify(picElement).findElement();
}
Aggregations