use of com.seleniumtests.driver.CustomEventFiringWebDriver in project seleniumRobot by bhecquet.
the class TestCustomEventFiringWebDriver method testQuitInError.
/**
* Check that even if error is raised when driver is quit, killing process is done
*/
@Test(groups = { "ut" })
public void testQuitInError() {
when(browserInfo.getAllBrowserSubprocessPids(new ArrayList<>())).thenReturn(Arrays.asList(1000L));
doThrow(new WebDriverException("some error")).when(driver).quit();
try {
((CustomEventFiringWebDriver) eventDriver).quit();
} catch (WebDriverException e) {
}
verify(osUtility).killProcess("1000", true);
}
use of com.seleniumtests.driver.CustomEventFiringWebDriver in project seleniumRobot by bhecquet.
the class TestCustomEventFiringWebDriver method testContentDimensionNotGet2.
@Test(groups = { "ut" })
public void testContentDimensionNotGet2() {
when(driver.executeScript(anyString(), eq(true))).thenReturn(Arrays.asList(0, 100)).thenReturn(Arrays.asList(120, 80));
Dimension dim = ((CustomEventFiringWebDriver) eventDriver).getContentDimension();
verify(driver).switchTo();
// 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 testContentDimensionNotGet.
/**
* issue #238: sometimes, when trying to capture screenshot, if browser context do not correspond to driver context
* (we have switched to an iframe but never went back whereas displayed page is different), getContentDimension returns (0,0) which prevent screenshot from
* being stored
*/
@Test(groups = { "ut" })
public void testContentDimensionNotGet() {
when(driver.executeScript(anyString(), eq(true))).thenReturn(Arrays.asList(100, 0)).thenReturn(Arrays.asList(120, 80));
Dimension dim = ((CustomEventFiringWebDriver) eventDriver).getContentDimension();
verify(driver).switchTo();
// 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 testScrollPositionWithZoomFactor.
/**
* issue #165: Check case where browser is not at 100% zoom and so, double reply is returned
*/
@Test(groups = { "ut" })
public void testScrollPositionWithZoomFactor() {
when(driver.executeScript(anyString())).thenReturn(Arrays.asList(120.5, 80.67));
Point point = ((CustomEventFiringWebDriver) eventDriver).getScrollPosition();
// check we get the window dimension
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 testContentDimensionNonWebTest.
/**
* For non web test, dimension is returned from driver call, not javascript
*/
@Test(groups = { "ut" })
public void testContentDimensionNonWebTest() {
eventDriver = spy(new CustomEventFiringWebDriver(driver, null, null, false, DriverMode.LOCAL, null, null).register(new DriverExceptionListener()));
when(driver.executeScript(anyString())).thenReturn(Arrays.asList(120L, 80L));
Dimension dim = ((CustomEventFiringWebDriver) eventDriver).getContentDimension();
// check we get the window dimension
Assert.assertEquals(dim.height, 100);
Assert.assertEquals(dim.width, 100);
}
Aggregations