<commit_before>package org.jtalks.tests.jcommune.webdriver;

import org.jtalks.tests.jcommune.webdriver.page.Pages;
import org.openqa.selenium.Platform;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.testng.annotations.AfterSuite;
import org.testng.annotations.BeforeSuite;
import org.testng.annotations.Parameters;

import java.net.MalformedURLException;
import java.net.URL;
import java.util.concurrent.TimeUnit;

public class JCommuneSeleniumTest {
    public static WebDriver driver = null;
    public static final String JCOMMUNE_CONTEXT_PATH = "/jcommune";
    private static final int SELENIUM_TIMEOUT = 10;
    public static String webdriverType;

    /**
     * Method  execute before execute Test. This method getting  driver for connect Remote Selenium Server. All values
     * are stored in testng.xml file.
     *
     * @param webDriverUrl  selenium server URL, will be used by default if no SELENIUM_URL env var is set (like in
     *                      case with SauceLabs integration on Jenkins)
     */
    @BeforeSuite(alwaysRun = true)
    @Parameters({"webDriverUrl", "appUrl"})
    public void init(String webDriverUrl, String appUrl) throws Exception {
        webdriverType = getBrowser();
        initDriver(webDriverUrl);
        Pages.createAllPages(driver);
    }

    private void initDriver(String defaultSeleniumServerUrl) throws MalformedURLException {
        DesiredCapabilities capabilities = new DesiredCapabilities(getBrowser(),
                getBrowserVersion(), getOs());
        driver = new RemoteWebDriver(new URL(getSeleniumUrl(defaultSeleniumServerUrl)), capabilities);
        driver.manage().timeouts().implicitlyWait(SELENIUM_TIMEOUT, TimeUnit.SECONDS);
    }

    private Platform getOs() {
        String os = System.getenv("SELENIUM_PLATFORM") == null ? "" : System.getenv("SELENIUM_PLATFORM");
        if (os.isEmpty()) {
            return Platform.ANY;
        }
        return Platform.valueOf(os);<commit_msg>Changed the way the platform is chosen - got rid of enums since the names on SauceLabs differ from standard enums<commit_after>package org.jtalks.tests.jcommune.webdriver;

import org.jtalks.tests.jcommune.webdriver.page.Pages;
import org.openqa.selenium.Platform;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.testng.annotations.AfterSuite;
import org.testng.annotations.BeforeSuite;
import org.testng.annotations.Parameters;

import java.net.MalformedURLException;
import java.net.URL;
import java.util.concurrent.TimeUnit;

public class JCommuneSeleniumTest {
    public static WebDriver driver = null;
    public static final String JCOMMUNE_CONTEXT_PATH = "/jcommune";
    private static final int SELENIUM_TIMEOUT = 10;
    public static String webdriverType;

    /**
     * Method  execute before execute Test. This method getting  driver for connect Remote Selenium Server. All values
     * are stored in testng.xml file.
     *
     * @param webDriverUrl  selenium server URL, will be used by default if no SELENIUM_URL env var is set (like in
     *                      case with SauceLabs integration on Jenkins)
     */
    @BeforeSuite(alwaysRun = true)
    @Parameters({"webDriverUrl", "appUrl"})
    public void init(String webDriverUrl, String appUrl) throws Exception {
        webdriverType = getBrowser();
        initDriver(webDriverUrl);
        Pages.createAllPages(driver);
    }

    private void initDriver(String defaultSeleniumServerUrl) throws MalformedURLException {
        DesiredCapabilities capabilities = new DesiredCapabilities();
        capabilities.setCapability(CapabilityType.PLATFORM, getOs());
        capabilities.setBrowserName(getBrowser());
        capabilities.setVersion(getBrowserVersion());
        driver = new RemoteWebDriver(new URL(getSeleniumUrl(defaultSeleniumServerUrl)), capabilities);
        driver.manage().timeouts().implicitlyWait(SELENIUM_TIMEOUT, TimeUnit.SECONDS);
    }

    private String getOs() {
        String os = System.getenv("SELENIUM_PLATFORM") == null ? "" : System.getenv("SELENIUM_PLATFORM");
        if (os.isEmpty()) {
            return Platform.ANY.toString();
        }
        return os;
{'fraction_non_alphanumeric': 0.08794197642792384, 'fraction_numerical': 0.0009066183136899365, 'mean_word_length': 3.765658747300216, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '2566891', 'n_tokens_mistral': 1271, 'n_tokens_neox': 1242, 'n_words': 308}