Search in sources :

Example 1 with Application

use of com.github.noraui.application.Application in project NoraUi by NoraUi.

the class Context method initializeRobot.

public synchronized void initializeRobot(Class<?> clazz) throws TechnicalException {
    logger.info("Context > initializeRobot() with " + clazz.getCanonicalName());
    // set browser: chrome,firefox or ie
    browser = getProperty(BROWSER_KEY, applicationProperties);
    // set Webdriver file: src/test/resources/drivers/...
    initializeWebdriversProperties(Thread.currentThread().getContextClassLoader());
    // wait delay until web element is displayed.
    timeout = setIntProperty(TIMEOUT_KEY, applicationProperties);
    // set version of selectors used to deliver several versions
    selectorsVersion = getProperty(SELECTORS_VERSION, applicationProperties);
    // proxies configuration
    proxy = new Proxy();
    proxy.setAutodetect(true);
    final String httpProxy = getProperty(HTTP_PROXY, applicationProperties);
    if (httpProxy != null && !"".equals(httpProxy)) {
        proxy.setAutodetect(false);
        proxy.setHttpProxy(httpProxy);
    }
    final String httpsProxy = getProperty(HTTPS_PROXY, applicationProperties);
    if (httpsProxy != null && !"".equals(httpsProxy)) {
        proxy.setAutodetect(false);
        proxy.setSslProxy(httpsProxy);
    }
    final String noProxy = getProperty(NO_PROXY, applicationProperties);
    if (noProxy != null && !"".equals(noProxy)) {
        proxy.setAutodetect(false);
        proxy.setNoProxy(noProxy);
    }
    // authentication mode configuration
    Auth.setAuthenticationType(getProperty(AUTH_TYPE, applicationProperties));
    // stacktrace configuration
    displayStackTrace = "true".equals(getProperty(DISPLAY_STACK_TRACE, applicationProperties));
    // enable browser headless mode ?
    isHeadless = "true".equals(getProperty(HEADLESS, applicationProperties));
    // init driver callbacks
    exceptionCallbacks.put(Callbacks.RESTART_WEB_DRIVER, STEPS_BROWSER_STEPS_CLASS_QUALIFIED_NAME, RESTART_WEB_DRIVER_METHOD_NAME);
    exceptionCallbacks.put(Callbacks.CLOSE_WINDOW_AND_SWITCH_TO_DEMO_HOME, STEPS_BROWSER_STEPS_CLASS_QUALIFIED_NAME, GO_TO_URL_METHOD_NAME, DEMO_HOME);
    exceptionCallbacks.put(Callbacks.CLOSE_WINDOW_AND_SWITCH_TO_LOGOGAME_HOME, STEPS_BROWSER_STEPS_CLASS_QUALIFIED_NAME, GO_TO_URL_METHOD_NAME, LOGOGAME_HOME);
    exceptionCallbacks.put(Callbacks.CLOSE_WINDOW_AND_SWITCH_TO_COUNTRIES_HOME, STEPS_BROWSER_STEPS_CLASS_QUALIFIED_NAME, GO_TO_URL_METHOD_NAME, COUNTRIES_HOME);
    // init applications
    initApplicationDom(clazz.getClassLoader(), selectorsVersion, DEMO_KEY);
    applications.put(DEMO_KEY, new Application(DEMO_HOME, getProperty(DEMO_KEY, applicationProperties) + "/index.html"));
    initApplicationDom(clazz.getClassLoader(), selectorsVersion, LOGOGAME_KEY);
    applications.put(LOGOGAME_KEY, new Application(LOGOGAME_HOME, getProperty(LOGOGAME_KEY, applicationProperties) + "/index.html"));
    initApplicationDom(clazz.getClassLoader(), selectorsVersion, COUNTRIES_KEY);
    applications.put(COUNTRIES_KEY, new Application(COUNTRIES_HOME, getProperty(COUNTRIES_KEY, applicationProperties) + "/index.html"));
    // read and init all cucumber methods
    cucumberMethods = Step.getAllCucumberMethods(clazz);
}
Also used : Proxy(org.openqa.selenium.Proxy) Application(com.github.noraui.application.Application)

Aggregations

Application (com.github.noraui.application.Application)1 Proxy (org.openqa.selenium.Proxy)1