Search in sources :

Example 1 with DriverTestPageNativeActions

use of com.seleniumtests.it.driver.support.pages.DriverTestPageNativeActions in project seleniumRobot by bhecquet.

the class GenericMultiBrowserTest method exposeTestPage.

@BeforeClass(groups = { "it", "ut", "upload", "ie" })
public void exposeTestPage(final ITestContext testNGCtx) throws Exception {
    // skip following if driver is already defined from an other test
    if (driver != null) {
        return;
    }
    if (browserType == null || !installedBrowsers.contains(browserType)) {
        return;
    }
    localAddress = Inet4Address.getLocalHost().getHostAddress();
    // localAddress = Inet4Address.getByName("localhost").getHostAddress();
    server = new WebServer(localAddress, getPageMapping());
    server.expose();
    logger.info(String.format("exposing server on http://%s:%d", localAddress, server.getServerHost().getPort()));
    initThreadContext(testNGCtx);
    initBeforeMethod();
    try {
        switch(testPageName) {
            case "DriverTestPageWithoutFixedPattern":
                testPageUrl = String.format("http://%s:%d/testWithoutFixedPattern.html", localAddress, server.getServerHost().getPort());
                testPageWithoutPattern = new DriverTestPageWithoutFixedPattern(true, testPageUrl);
                break;
            case "DriverTestPage":
                testPageUrl = String.format("http://%s:%d/test.html", localAddress, server.getServerHost().getPort());
                testPage = new DriverTestPage(true, testPageUrl);
                break;
            case "DriverTestPageNativeActions":
                testPageUrl = String.format("http://%s:%d/test.html", localAddress, server.getServerHost().getPort());
                testPageNativeActions = new DriverTestPageNativeActions(true, testPageUrl);
                break;
            case "DriverTestPageObjectFactory":
                testPageUrl = String.format("http://%s:%d/test.html", localAddress, server.getServerHost().getPort());
                testPageObjectFactory = new DriverTestPageObjectFatory(true, testPageUrl);
                break;
            case "DriverTestAngularFrame":
                testPageUrl = String.format("http://%s:%d/testAngularIFrame.html", localAddress, server.getServerHost().getPort());
                angularFramePage = new DriverTestAngularFrame(true, testPageUrl);
                break;
            case "DriverSubAngularTestPage":
                testPageUrl = String.format("http://%s:%d/angularApp/index.html", localAddress, server.getServerHost().getPort());
                angularPage = new DriverSubAngularTestPage(true, testPageUrl);
                break;
            case "DriverScrollingTestPage":
                testPageUrl = String.format("http://%s:%d/testScrolling.html", localAddress, server.getServerHost().getPort());
                scrollingTestPage = new DriverScrollingTestPage(true, testPageUrl);
                break;
            case "DriverTestPageSalesforceLightning":
                lightningPage = new DriverTestPageSalesforceLightning();
                break;
        }
    } catch (Exception e) {
        logger.error("Error opening page");
        logger.error(WebUIDriver.getWebDriver(true).getPageSource());
        throw e;
    }
    driver = WebUIDriver.getWebDriver(true);
}
Also used : DriverTestPageNativeActions(com.seleniumtests.it.driver.support.pages.DriverTestPageNativeActions) DriverTestPageObjectFatory(com.seleniumtests.it.driver.support.pages.DriverTestPageObjectFatory) DriverSubAngularTestPage(com.seleniumtests.it.driver.support.pages.DriverSubAngularTestPage) DriverTestAngularFrame(com.seleniumtests.it.driver.support.pages.DriverTestAngularFrame) DriverTestPageSalesforceLightning(com.seleniumtests.it.driver.support.pages.DriverTestPageSalesforceLightning) DriverTestPage(com.seleniumtests.it.driver.support.pages.DriverTestPage) DriverTestPageWithoutFixedPattern(com.seleniumtests.it.driver.support.pages.DriverTestPageWithoutFixedPattern) WebServer(com.seleniumtests.it.driver.support.server.WebServer) DriverScrollingTestPage(com.seleniumtests.it.driver.support.pages.DriverScrollingTestPage) SkipException(org.testng.SkipException) WebDriverException(org.openqa.selenium.WebDriverException) IOException(java.io.IOException) AWTException(java.awt.AWTException) BeforeClass(org.testng.annotations.BeforeClass)

Example 2 with DriverTestPageNativeActions

use of com.seleniumtests.it.driver.support.pages.DriverTestPageNativeActions in project seleniumRobot by bhecquet.

the class TestNativeSeleniumActions method testDriverNativeActionsWithFrame2.

@Test(groups = { "it" }, dependsOnMethods = "testDriverNativeActionsWithFrame1")
public void testDriverNativeActionsWithFrame2() throws Exception {
    // create the driver that as been closed in previous test method
    testPageNativeActions = new DriverTestPageNativeActions(true, testPageUrl);
    driver = WebUIDriver.getWebDriver(true);
    SeleniumTestsContextManager.getThreadContext().setOverrideSeleniumNativeAction(true);
    testPageNativeActions.sendKeys().reset();
}
Also used : DriverTestPageNativeActions(com.seleniumtests.it.driver.support.pages.DriverTestPageNativeActions) GenericMultiBrowserTest(com.seleniumtests.it.driver.support.GenericMultiBrowserTest) Test(org.testng.annotations.Test)

Example 3 with DriverTestPageNativeActions

use of com.seleniumtests.it.driver.support.pages.DriverTestPageNativeActions in project seleniumRobot by bhecquet.

the class StubTestClassForDriverTest method testDriverNativeActionsWithoutOverride.

/**
 * check that without selenium override, logging is not done
 * @throws Exception
 */
@Test(groups = "stub")
public void testDriverNativeActionsWithoutOverride() throws Exception {
    SeleniumTestsContextManager.getThreadContext().setOverrideSeleniumNativeAction(false);
    SeleniumTestsContextManager.getThreadContext().setReplayTimeout(1);
    SeleniumTestsContextManager.getThreadContext().setImplicitWaitTimeout(1);
    new DriverTestPageNativeActions(true).sendKeys().reset().select();
}
Also used : DriverTestPageNativeActions(com.seleniumtests.it.driver.support.pages.DriverTestPageNativeActions) Test(org.testng.annotations.Test)

Example 4 with DriverTestPageNativeActions

use of com.seleniumtests.it.driver.support.pages.DriverTestPageNativeActions in project seleniumRobot by bhecquet.

the class TestOverrideSeleniumNativeSearch method initDriver.

@BeforeClass(groups = { "ut" })
public void initDriver(final ITestContext testNGCtx) throws Exception {
    initThreadContext(testNGCtx);
    SeleniumTestsContextManager.getThreadContext().setBrowser("htmlunit");
    testPage = new DriverTestPageNativeActions(true);
    realDriver = WebUIDriver.getWebDriver(true);
}
Also used : DriverTestPageNativeActions(com.seleniumtests.it.driver.support.pages.DriverTestPageNativeActions) BeforeClass(org.testng.annotations.BeforeClass)

Aggregations

DriverTestPageNativeActions (com.seleniumtests.it.driver.support.pages.DriverTestPageNativeActions)4 BeforeClass (org.testng.annotations.BeforeClass)2 Test (org.testng.annotations.Test)2 GenericMultiBrowserTest (com.seleniumtests.it.driver.support.GenericMultiBrowserTest)1 DriverScrollingTestPage (com.seleniumtests.it.driver.support.pages.DriverScrollingTestPage)1 DriverSubAngularTestPage (com.seleniumtests.it.driver.support.pages.DriverSubAngularTestPage)1 DriverTestAngularFrame (com.seleniumtests.it.driver.support.pages.DriverTestAngularFrame)1 DriverTestPage (com.seleniumtests.it.driver.support.pages.DriverTestPage)1 DriverTestPageObjectFatory (com.seleniumtests.it.driver.support.pages.DriverTestPageObjectFatory)1 DriverTestPageSalesforceLightning (com.seleniumtests.it.driver.support.pages.DriverTestPageSalesforceLightning)1 DriverTestPageWithoutFixedPattern (com.seleniumtests.it.driver.support.pages.DriverTestPageWithoutFixedPattern)1 WebServer (com.seleniumtests.it.driver.support.server.WebServer)1 AWTException (java.awt.AWTException)1 IOException (java.io.IOException)1 WebDriverException (org.openqa.selenium.WebDriverException)1 SkipException (org.testng.SkipException)1