Search in sources :

Example 6 with CustomEventFiringWebDriver

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);
}
Also used : CustomEventFiringWebDriver(com.seleniumtests.driver.CustomEventFiringWebDriver) Point(org.openqa.selenium.Point) Test(org.testng.annotations.Test) MockitoTest(com.seleniumtests.MockitoTest) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 7 with CustomEventFiringWebDriver

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();
}
Also used : CustomEventFiringWebDriver(com.seleniumtests.driver.CustomEventFiringWebDriver) DriverExceptionListener(com.seleniumtests.driver.DriverExceptionListener) Test(org.testng.annotations.Test) MockitoTest(com.seleniumtests.MockitoTest) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 8 with CustomEventFiringWebDriver

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);
}
Also used : CustomEventFiringWebDriver(com.seleniumtests.driver.CustomEventFiringWebDriver) Dimension(org.openqa.selenium.Dimension) Test(org.testng.annotations.Test) MockitoTest(com.seleniumtests.MockitoTest) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 9 with CustomEventFiringWebDriver

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);
}
Also used : CustomEventFiringWebDriver(com.seleniumtests.driver.CustomEventFiringWebDriver) Point(org.openqa.selenium.Point) Test(org.testng.annotations.Test) MockitoTest(com.seleniumtests.MockitoTest) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 10 with CustomEventFiringWebDriver

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);
}
Also used : CustomEventFiringWebDriver(com.seleniumtests.driver.CustomEventFiringWebDriver) Dimension(org.openqa.selenium.Dimension) Test(org.testng.annotations.Test) MockitoTest(com.seleniumtests.MockitoTest) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Aggregations

CustomEventFiringWebDriver (com.seleniumtests.driver.CustomEventFiringWebDriver)77 Test (org.testng.annotations.Test)53 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)36 MockitoTest (com.seleniumtests.MockitoTest)35 Dimension (org.openqa.selenium.Dimension)26 WebDriver (org.openqa.selenium.WebDriver)14 GenericDriverTest (com.seleniumtests.GenericDriverTest)12 Point (org.openqa.selenium.Point)12 GenericTest (com.seleniumtests.GenericTest)10 ScenarioException (com.seleniumtests.customexception.ScenarioException)9 WebDriverException (org.openqa.selenium.WebDriverException)7 BeforeMethod (org.testng.annotations.BeforeMethod)7 DriverExceptionListener (com.seleniumtests.driver.DriverExceptionListener)6 SkipException (org.testng.SkipException)6 NLWebDriver (com.neotys.selenium.proxies.NLWebDriver)5 File (java.io.File)5 IOException (java.io.IOException)5 Rectangle (org.openqa.selenium.Rectangle)5 WebElement (org.openqa.selenium.WebElement)5 BrowserInfo (com.seleniumtests.browserfactory.BrowserInfo)4