use of com.seleniumtests.uipage.htmlelements.ScreenZone in project seleniumRobot by bhecquet.
the class TestScreenZone method testPictureVisible.
@Test(groups = { "ut" })
public void testPictureVisible() 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(""));
when(imageDetector.getDetectedRectangle()).thenReturn(new Rectangle(10, 10, 100, 50));
when(imageDetector.getSizeRatio()).thenReturn(1.0);
Assert.assertTrue(picElement.isElementPresent(2000));
verify(picElement).findElement();
}
use of com.seleniumtests.uipage.htmlelements.ScreenZone in project seleniumRobot by bhecquet.
the class TestScreenZone method testDoubleClick.
@Test(groups = { "ut" })
public void testDoubleClick() {
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.doubleClickAt(0, 0);
verify(picElement).moveAndDoubleClick(35, 60);
}
use of com.seleniumtests.uipage.htmlelements.ScreenZone in project seleniumRobot by bhecquet.
the class TestScreenZone method testSendKeys.
@Test(groups = { "ut" })
public void testSendKeys() {
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.sendKeys(0, 0, KeyEvent.VK_0);
verify(picElement).moveAndLeftClick(35, 60);
}
use of com.seleniumtests.uipage.htmlelements.ScreenZone in project seleniumRobot by bhecquet.
the class TestScreenZone method testPictureNotVisibleWithReplay.
@Test(groups = { "ut" })
public void testPictureNotVisibleWithReplay() 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(350));
verify(picElement, times(2)).findElement();
}
Aggregations