use of com.seleniumtests.driver.CustomEventFiringWebDriver in project seleniumRobot by bhecquet.
the class TestCustomEventFiringWebDriver method testNullJavascriptReplyForScrollPosition.
/**
* check that if an error occurs during javascript invocation, window size is returned (issue #161)
*/
@Test(groups = { "ut" })
public void testNullJavascriptReplyForScrollPosition() {
Point point = ((CustomEventFiringWebDriver) eventDriver).getScrollPosition();
// check we get the default position: (0,0)
Assert.assertEquals(point.x, 0);
Assert.assertEquals(point.y, 0);
}
use of com.seleniumtests.driver.CustomEventFiringWebDriver in project seleniumRobot by bhecquet.
the class TestCustomEventFiringWebDriver method testScrollPositionNonWebTest.
/**
* For non web test, dimension is returned from driver call, not javascript
*/
@Test(groups = { "ut" }, expectedExceptions = WebDriverException.class)
public void testScrollPositionNonWebTest() {
eventDriver = spy(new CustomEventFiringWebDriver(driver, null, null, false, DriverMode.LOCAL, null, null).register(new DriverExceptionListener()));
when(driver.executeScript(anyString())).thenReturn(Arrays.asList(120L, 80L));
((CustomEventFiringWebDriver) eventDriver).getScrollPosition();
}
use of com.seleniumtests.driver.CustomEventFiringWebDriver in project seleniumRobot by bhecquet.
the class TestCustomEventFiringWebDriver method testViewPortDimensionWithoutScrollbarWithZoomFactor.
/**
* issue #165: Check case where browser is not at 100% zoom and so, double reply is returned
*/
@Test(groups = { "ut" })
public void testViewPortDimensionWithoutScrollbarWithZoomFactor() {
when(driver.executeScript(anyString(), eq(true))).thenReturn(120.5).thenReturn(80.67);
Dimension dim = ((CustomEventFiringWebDriver) eventDriver).getViewPortDimensionWithoutScrollbar();
// check we get the window dimension
Assert.assertEquals(dim.height, 80);
Assert.assertEquals(dim.width, 120);
}
use of com.seleniumtests.driver.CustomEventFiringWebDriver in project seleniumRobot by bhecquet.
the class TestCustomEventFiringWebDriver method testScrollPosition.
/**
* Check standard web case where dimension comes from javascript call
*/
@Test(groups = { "ut" })
public void testScrollPosition() {
when(driver.executeScript(anyString())).thenReturn(Arrays.asList(120L, 80L));
Point point = ((CustomEventFiringWebDriver) eventDriver).getScrollPosition();
// check we get the scroll position
Assert.assertEquals(point.x, 120);
Assert.assertEquals(point.y, 80);
}
use of com.seleniumtests.driver.CustomEventFiringWebDriver in project seleniumRobot by bhecquet.
the class TestCustomEventFiringWebDriver method testContentDimensionWithZoomFactor.
/**
* issue #165: Check case where browser is not at 100% zoom and so, double reply is returned
*/
@Test(groups = { "ut" })
public void testContentDimensionWithZoomFactor() {
when(driver.executeScript(anyString(), eq(true))).thenReturn(Arrays.asList(120.5, 80.67));
Dimension dim = ((CustomEventFiringWebDriver) eventDriver).getContentDimension();
// check we get the window dimension
Assert.assertEquals(dim.height, 80);
Assert.assertEquals(dim.width, 120);
}
Aggregations