Search in sources :

Example 1 with DriverTestPageObjectFatory

use of com.seleniumtests.it.driver.support.pages.DriverTestPageObjectFatory 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 DriverTestPageObjectFatory

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

the class TestOverridePageObjectFactory method initDriver.

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

Aggregations

DriverTestPageObjectFatory (com.seleniumtests.it.driver.support.pages.DriverTestPageObjectFatory)2 BeforeClass (org.testng.annotations.BeforeClass)2 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 DriverTestPageNativeActions (com.seleniumtests.it.driver.support.pages.DriverTestPageNativeActions)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