Search in sources :

Example 31 with CustomEventFiringWebDriver

use of com.seleniumtests.driver.CustomEventFiringWebDriver in project seleniumRobot by bhecquet.

the class TestHtmlElement method testTap.

@Test(groups = { "ut" })
public void testTap() throws Exception {
    SeleniumTestsContextManager.getThreadContext().setTestType(TestType.APPIUM_WEB_ANDROID);
    SeleniumTestsContextManager.getThreadContext().setPlatform("android");
    when(WebUIDriver.getWebDriver(anyBoolean())).thenReturn(new CustomEventFiringWebDriver(mobileDriver));
    doNothing().when(el).findElement(anyBoolean(), anyBoolean());
    el.setElement(mobileElement);
    el.tap(2, 2);
    PowerMockito.verifyPrivate(el, atLeastOnce()).invoke("checkForMobile");
}
Also used : CustomEventFiringWebDriver(com.seleniumtests.driver.CustomEventFiringWebDriver) Test(org.testng.annotations.Test) MockitoTest(com.seleniumtests.MockitoTest) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 32 with CustomEventFiringWebDriver

use of com.seleniumtests.driver.CustomEventFiringWebDriver in project seleniumRobot by bhecquet.

the class TestBrowserInfo method testGetChromePid.

@Test(groups = { "it" })
public void testGetChromePid(final ITestContext testNGCtx) {
    initThreadContext(testNGCtx);
    SeleniumTestsContextManager.getThreadContext().setBrowser("*chrome");
    driver = WebUIDriver.getWebDriver(true);
    CustomEventFiringWebDriver efDriver = (CustomEventFiringWebDriver) driver;
    // there should be one PID for the driver server
    List<Long> pids = efDriver.getDriverPids();
    Assert.assertEquals(efDriver.getDriverPids().size(), 1);
    Assert.assertTrue(OSUtilityFactory.getInstance().getProgramNameFromPid((Long) pids.get(0)).contains("chromedriver"));
}
Also used : CustomEventFiringWebDriver(com.seleniumtests.driver.CustomEventFiringWebDriver) GenericDriverTest(com.seleniumtests.GenericDriverTest) Test(org.testng.annotations.Test)

Example 33 with CustomEventFiringWebDriver

use of com.seleniumtests.driver.CustomEventFiringWebDriver in project seleniumRobot by bhecquet.

the class TestBrowserInfo method testGetAllProcess.

@Test(groups = { "it" })
public void testGetAllProcess(final ITestContext testNGCtx) {
    initThreadContext(testNGCtx);
    SeleniumTestsContextManager.getThreadContext().setBrowser("*chrome");
    driver = WebUIDriver.getWebDriver(true);
    CustomEventFiringWebDriver efDriver = (CustomEventFiringWebDriver) driver;
    List<Long> pids = efDriver.getDriverPids();
    List<Long> allPids = efDriver.getBrowserInfo().getAllBrowserSubprocessPids(pids);
    // one pid for driver and at least one for browser (chrome starts several processes)
    Assert.assertTrue(allPids.size() >= 2);
}
Also used : CustomEventFiringWebDriver(com.seleniumtests.driver.CustomEventFiringWebDriver) GenericDriverTest(com.seleniumtests.GenericDriverTest) Test(org.testng.annotations.Test)

Example 34 with CustomEventFiringWebDriver

use of com.seleniumtests.driver.CustomEventFiringWebDriver in project seleniumRobot by bhecquet.

the class TestBrowserInfo method testGetInternetExplorerPid.

@Test(groups = { "it" })
public void testGetInternetExplorerPid(final ITestContext testNGCtx) {
    if (!SystemUtils.IS_OS_WINDOWS) {
        throw new SkipException("This test can only be done on Windows");
    }
    initThreadContext(testNGCtx);
    SeleniumTestsContextManager.getThreadContext().setBrowser("*iexplore");
    driver = WebUIDriver.getWebDriver(true);
    CustomEventFiringWebDriver efDriver = (CustomEventFiringWebDriver) driver;
    // there should be one PID for the driver server
    List<Long> pids = efDriver.getDriverPids();
    Assert.assertEquals(efDriver.getDriverPids().size(), 1);
    Assert.assertTrue(OSUtilityFactory.getInstance().getProgramNameFromPid((Long) pids.get(0)).contains("IEDriverServer"));
}
Also used : CustomEventFiringWebDriver(com.seleniumtests.driver.CustomEventFiringWebDriver) SkipException(org.testng.SkipException) GenericDriverTest(com.seleniumtests.GenericDriverTest) Test(org.testng.annotations.Test)

Example 35 with CustomEventFiringWebDriver

use of com.seleniumtests.driver.CustomEventFiringWebDriver in project seleniumRobot by bhecquet.

the class TestBrowserInfo method testGetFirefoxPid.

@Test(groups = { "it" })
public void testGetFirefoxPid(final ITestContext testNGCtx) {
    initThreadContext(testNGCtx);
    SeleniumTestsContextManager.getThreadContext().setBrowser("*firefox");
    driver = WebUIDriver.getWebDriver(true);
    CustomEventFiringWebDriver efDriver = (CustomEventFiringWebDriver) driver;
    // there should be one PID for the driver server
    List<Long> pids = efDriver.getDriverPids();
    Assert.assertEquals(efDriver.getDriverPids().size(), 1);
    Assert.assertTrue(OSUtilityFactory.getInstance().getProgramNameFromPid((Long) pids.get(0)).contains("geckodriver"));
}
Also used : CustomEventFiringWebDriver(com.seleniumtests.driver.CustomEventFiringWebDriver) GenericDriverTest(com.seleniumtests.GenericDriverTest) Test(org.testng.annotations.Test)

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