aboutsummaryrefslogtreecommitdiffstats
path: root/vid-automation/src/main/java/vid/automation/test/utils/TestConfigurationHelper.java
blob: 0b2978ddadf232270f7d86f29b7085b924e73048 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package vid.automation.test.utils;

import vid.automation.test.infra.FeaturesTogglingConfiguration;

public class TestConfigurationHelper {

    private TestConfigurationHelper(){}

    public static org.onap.sdc.ci.tests.datatypes.Configuration getEnvConfiguration() {

        try {
            String envUrl = System.getProperty("ENV_URL");
            boolean isCustomLogin = Boolean.parseBoolean(System.getProperty("CUSTOM_LOGIN"));

            org.onap.sdc.ci.tests.datatypes.Configuration configuration = new org.onap.sdc.ci.tests.datatypes.Configuration(envUrl, isCustomLogin);

            String geckoDriverPath = System.getProperty("GECKO_PATH");
            if(geckoDriverPath == null){
                throw new RuntimeException("Missing path to gecko driver." +
                        " Make sure to provide path to the gecko driver executable with -DGECKO_PATH=<path>");
            }

            configuration.setGeckoDriverPath(geckoDriverPath);
            FeaturesTogglingConfiguration.initializeFeatureManager();
            return configuration;

        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }
}