Search in sources :

Example 1 with Parameter

use of com.qaprosoft.carina.core.foundation.utils.Configuration.Parameter in project carina by qaprosoft.

the class ZafiraConfigurator method getConfiguration.

@Override
public ConfigurationType getConfiguration() {
    ConfigurationType conf = new ConfigurationType();
    for (Parameter parameter : Parameter.values()) {
        conf.getArg().add(buildArgumentType(parameter.getKey(), R.CONFIG.get(parameter.getKey())));
    }
    if (buildArgumentType("platform", R.CONFIG.get("os")).getValue() != null) {
        // TODO: review and fix for 5.2.2.xx implementation
        // add custom arguments from browserStack
        conf.getArg().add(buildArgumentType("platform", R.CONFIG.get("os")));
        conf.getArg().add(buildArgumentType("platform_version", R.CONFIG.get("os_version")));
    }
    long threadId = Thread.currentThread().getId();
    // add custom arguments from current mobile device
    Device device = DevicePool.getDevice();
    if (!device.getName().isEmpty()) {
        String deviceName = device.getName();
        String deviceOs = device.getOs();
        String deviceOsVersion = device.getOsVersion();
        conf.getArg().add(buildArgumentType("device", deviceName));
        conf.getArg().add(buildArgumentType("platform", deviceOs));
        conf.getArg().add(buildArgumentType("platform_version", deviceOsVersion));
        LOGGER.debug("Detected device: '" + deviceName + "'; os: '" + deviceOs + "'; os version: '" + deviceOsVersion + "'");
    } else {
        LOGGER.debug("Unable to detect current device for threadId: " + threadId);
    }
    return conf;
}
Also used : ConfigurationType(com.qaprosoft.zafira.models.dto.config.ConfigurationType) Device(com.qaprosoft.carina.core.foundation.webdriver.device.Device) Parameter(com.qaprosoft.carina.core.foundation.utils.Configuration.Parameter)

Aggregations

Parameter (com.qaprosoft.carina.core.foundation.utils.Configuration.Parameter)1 Device (com.qaprosoft.carina.core.foundation.webdriver.device.Device)1 ConfigurationType (com.qaprosoft.zafira.models.dto.config.ConfigurationType)1