All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.serenitybdd.core.environment.WebDriverConfiguredEnvironment Maven / Gradle / Ivy

There is a newer version: 4.2.1
Show newest version
package net.serenitybdd.core.environment;

import net.serenitybdd.core.di.*;
import net.thucydides.core.configuration.*;
import net.thucydides.core.guice.*;
import net.thucydides.core.util.*;
import net.thucydides.core.webdriver.*;

public class WebDriverConfiguredEnvironment {
    private static final ThreadLocal testEnvironmentVariables = new ThreadLocal<>();
    private static final ThreadLocal testConfiguration = new ThreadLocal<>();
    
    public static void setTestEnvironmentVariables(EnvironmentVariables testEnvironment) {
        testEnvironmentVariables.set(testEnvironment);
        testConfiguration.set(new WebDriverConfiguration(testEnvironment));
    }

    public static EnvironmentVariables getEnvironmentVariables() {
        if (testEnvironmentVariables.get() != null) {
            return testEnvironmentVariables.get();
        }
        return Injectors.getInjector().getInstance(EnvironmentVariables.class);
    }

    public static DriverConfiguration getDriverConfiguration() {
        if (testConfiguration.get() != null) {
            return testConfiguration.get();
        }
        return WebDriverInjectors.getInjector().getInstance(DriverConfiguration.class);
    }

    public static void reset() {
        testEnvironmentVariables.remove();
        testConfiguration.remove();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy