<commit_before>package at.willhaben.willtest.browserstack.rule;

import at.willhaben.willtest.rule.AbstractSeleniumProvider;
import at.willhaben.willtest.util.Environment;
import org.junit.runner.Description;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;

import java.net.MalformedURLException;
import java.net.URL;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;

/**
 * {@link at.willhaben.willtest.config.SeleniumProvider} implementation to run tests on BrowserStack. It is
 * basically a normal selenium hub connection with some special properties
 */
//TODO: more options for selected OS and Browser, Multiple env run (see: https://github.com/browserstack/junit-browserstack)
public class BrowserstackSeleniumProvider extends
        AbstractSeleniumProvider<BrowserstackSeleniumProvider, RemoteWebDriver> {

    private static final String BROWSERSTACK_HUB_SYSTEM_PROPERTY_KEY = "browserstack.hub";
    private static final String BROWSERSTACK_HUB_LOCAL_SYSTEM_PROPERTY_KEY = "browserstack.local";
    private static final String BROWSERSTACK_PLATFORM = "platforms";
    private static final String BROWSERSTACK_PLATFORM_VERSION = "platform.versions";
    private static final String BROWSERSTACK_BROWSER = "browsers";
    private static final String BROWSERSTACK_BROWSER_VERSION = "browser.verions";
    private static final String BROWSERSTACK_DISPLAY_RESOLUTION = "display.resolution";

    private final DateTimeFormatter BUILD_DATE_FORMAT = DateTimeFormatter.ofPattern("yyyy.MM.dd");

    private List<BrowserstackEnvironment> environments;

    @Override
    protected DesiredCapabilities createDesiredCapabilities(Description description) {
        DesiredCapabilities desiredCapabilities = super.createDesiredCapabilities(description);
        desiredCapabilities.setCapability("build", BUILD_DATE_FORMAT.format(ZonedDateTime.now()));
        desiredCapabilities.setCapability("name", getTestName(description));
        desiredCapabilities.setCapability(BROWSERSTACK_HUB_LOCAL_SYSTEM_PROPERTY_KEY,
                Boolean.parseBoolean(<commit_msg>fix typo<commit_after>package at.willhaben.willtest.browserstack.rule;

import at.willhaben.willtest.rule.AbstractSeleniumProvider;
import at.willhaben.willtest.util.Environment;
import org.junit.runner.Description;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;

import java.net.MalformedURLException;
import java.net.URL;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;

/**
 * {@link at.willhaben.willtest.config.SeleniumProvider} implementation to run tests on BrowserStack. It is
 * basically a normal selenium hub connection with some special properties
 */
//TODO: more options for selected OS and Browser, Multiple env run (see: https://github.com/browserstack/junit-browserstack)
public class BrowserstackSeleniumProvider extends
        AbstractSeleniumProvider<BrowserstackSeleniumProvider, RemoteWebDriver> {

    private static final String BROWSERSTACK_HUB_SYSTEM_PROPERTY_KEY = "browserstack.hub";
    private static final String BROWSERSTACK_HUB_LOCAL_SYSTEM_PROPERTY_KEY = "browserstack.local";
    private static final String BROWSERSTACK_PLATFORM = "platforms";
    private static final String BROWSERSTACK_PLATFORM_VERSION = "platform.versions";
    private static final String BROWSERSTACK_BROWSER = "browsers";
    private static final String BROWSERSTACK_BROWSER_VERSION = "browser.versions";
    private static final String BROWSERSTACK_DISPLAY_RESOLUTION = "display.resolution";

    private final DateTimeFormatter BUILD_DATE_FORMAT = DateTimeFormatter.ofPattern("yyyy.MM.dd");

    private List<BrowserstackEnvironment> environments;

    @Override
    protected DesiredCapabilities createDesiredCapabilities(Description description) {
        DesiredCapabilities desiredCapabilities = super.createDesiredCapabilities(description);
        desiredCapabilities.setCapability("build", BUILD_DATE_FORMAT.format(ZonedDateTime.now()));
        desiredCapabilities.setCapability("name", getTestName(description));
        desiredCapabilities.setCapability(BROWSERSTACK_HUB_LOCAL_SYSTEM_PROPERTY_KEY,
                Boolean.parseBoolean(
{'fraction_non_alphanumeric': 0.07468879668049792, 'fraction_numerical': 0.0, 'mean_word_length': 5.909235668789809, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2898558', 'n_tokens_mistral': 1222, 'n_tokens_neox': 1180, 'n_words': 250}