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

com.version1.webdriver.configuration.SauceLabsConfigurationLoader Maven / Gradle / Ivy

Go to download

A simple Selenium framework offering externalised configuration, a good selection of libraries for supporting test data, simple WebDriver browser binary resolution and an opinionated approach for WebDriver test design.

The newest version!
package com.version1.webdriver.configuration;

import java.io.IOException;

import com.version1.webdriver.configuration.utils.FileLoaderUtils;
import com.version1.webdriver.utils.JsonUtils;

public class SauceLabsConfigurationLoader {

    /**
     *
     * @param targetConfigurationFile
     * @return {@link SauceLabsConfig} loads SauceLabs configuration json from file or classpath
     */
    public SauceLabsConfig load(String targetConfigurationFile) {
        try {
            return JsonUtils.fromFile(
                    FileLoaderUtils.loadFromClasspathOrFileSystem(targetConfigurationFile), SauceLabsConfig.class);
        }
        catch (IOException e) {
            String message = "Unable to load configuration from " + targetConfigurationFile;
            if(e.getMessage().contains("SauceLabsCredentialsException")) {
                message = message + ": SauceLabsCredentialsException encountered.  Provide valid credentials.";
            }
            throw new RuntimeException(message);
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy