<commit_before>package com.github.webdriverextensions;

import java.util.List;
import java.util.concurrent.TimeUnit;
import static com.github.webdriverextensions.Bot.*;
import com.github.webdriverextensions.generator.GeneratedWebRepository;
import com.github.webdriverextensions.junitrunner.WebDriverRunner;
import com.github.webdriverextensions.junitrunner.annotations.*;
import org.junit.Assert;
import static org.hamcrest.Matchers.*;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.openqa.selenium.Platform;

@RunWith(WebDriverRunner.class)
@Chrome
@Firefox
@InternetExplorer
@Edge
@Safari
@PhantomJS
@HtmlUnit
public class BotTest extends GeneratedWebRepository {

    @Before
    public void before() {
        open(botTestPage.url);
    }

    /* Click */
    @Test
    public void clickTest() {
        click(botTestPage.checkbox2);
        assertIsChecked(botTestPage.checkbox2);
    }

    /* Type */
    @Test
    public void typeTest() {
        clear(botTestPage.textInput);
        type("text", botTestPage.textInput);
        assertValueEquals("text", botTestPage.textInput);
        clear(botTestPage.textInput);
        type(42.0, botTestPage.textInput);
        assertValueEquals(42.0, botTestPage.textInput);
    }

    /* Clear */
    @Test
    public void clearTest() {
        clear(botTestPage.textInput);
        assertValueEquals("", botTestPage.textInput);
        clearAndType("text", botTestPage.textInput);
        assertValueEquals("text", botTestPage.textInput);
        clearAndType(42.0, botTestPage.textInput);
        assertValueEquals(42.0, botTestPage.textInput);
    }

    /* Press Keys */
    @Test
    public void pressKeysTest() {
        clear(botTestPage.textInput);
        pressKeys(botTestPage.textInput, "t");
        assertValueEquals("t", botTestPage.textInput);
        pressKeys(botTestPage.textInput, "e");
        assertValueEquals("te", botTestPage.textInput);
        pressKeys(botTestPage.textInput, "x");
        assertValueEquals("tex", botTestPage.textInput);
        pressKeys(botTestPage.textInput, "t");
        assertValueEquals("text", botTestPage.textInput);
    }

    /* Select/Deselect */
    @Test
    @IgnoreSafari // Fails to select on click in Safari
    public void selectDeselectTest() {
        select(botTestPage.multipleSelectOption2);
        assertIsSelected(botTestPage.multipleSelectOption2);
        deselect(botTestPage.multipleSelectOption1);
        assertIsDeselected(botTestPage.multipleSelectOption1);
    }

    /* Check/Uncheck */
    @Test
    public void checkUncheckTest() {
        check(botTestPage.checkbox2);
        assertIsChecked(botTestPage.checkbox2);
        uncheck(botTestPage.checkbox1);
        assertIsUnchecked(botTestPage.checkbox1);
    }

    /* Open */
    @Test
    @IgnoreSafari // throws UnsupportedCommandException from RemoteWebElement.isDisplayed() for some reason
    public void openTest() {
        debug(driver().getPageSource());
        open(botTestPage);
        assertIsOpen(botTestPage);
    }

    /* Wait For */
    @Test
    @IgnoreSafari // throws UnsupportedCommandException from RemoteWebElement.isDisplayed() for some reason
    public void waitForTest() {
        waitForElementToDisplay(botTestPage.firstAppendedSpan);
        assertIsDisplayed(botTestPage.firstAppendedSpan);
        assertIsNotDisplayed(botTestPage.secondAppendedSpan, 0);
        waitFor(0.8);
        waitFor(0.2 / 24 / 60 / 60, TimeUnit.DAYS);
        waitFor(0.2 / 60 / 60, TimeUnit.HOURS);
        waitFor(0.2 / 60, TimeUnit.MINUTES);
        waitFor(0.2, TimeUnit.SECONDS);
        waitFor(0.2 * 1000, TimeUnit.MILLISECONDS);
        waitFor(0.2 * 1000 * 1000, TimeUnit.MICROSECONDS);
        assertIsDisplayed(botTestPage.firstAppendedSpan);
        assertIsDisplayed(botTestPage.secondAppendedSpan);
    }

    @Test
    @IgnoreSafari // throws UnsupportedCommandException from RemoteWebElement.isDisplayed() for some reason
    public void waitForElementsToDisplayTest() {
        waitForElementsToDisplay(botTestPage.appendedSpans);
        assertIsDisplayed(botTestPage.firstAppendedSpan);
        assertIsNotDisplayed(botTestPage.secondAppendedSpan);
    }

    /* Debug */
    @Test
    public void debugTest() {
        debug("Text to debug");
        debug(botTestPage.attributesSpan);
        debug(botTestPage.selectAllOption);
        debug(botTestPage.body);
    }

    /* Is Open */
    @Test
    @IgnoreSafari // throws UnsupportedCommandException from RemoteWebElement.isDisplayed() for some reason
    public void isOpenTest() {
        assertIsOpen(botTestPage);
        assertIsNotOpen(webDriverExtensionSite);
    }

    /* Is Display */
    @Test
    @IgnoreSafari // throws UnsupportedCommandException from RemoteWebElement.isDisplayed() for some reason
    @IgnoreHtmlUnit(platform = Platform.LINUX) // Ignore html unit tests on linux platforms since it seems to fail for some reson in drone.io
    public void isDisplayedTest() {
        assertIsDisplayed(botTestPage.textSpan);
        assertIsDisplayed(botTestPage.firstAppendedSpan, 2);
        assertIsNotDisplayed(botTestPage.secondAppendedSpan);
        assertIsDisplayed(botTestPage.secondAppendedSpan, 2);
    }

    /* Size */
    @Test
    public void sizeTest() {
        assertSizeEquals(3, botTestPage.selectAllOption);
        assertSizeNotEquals(0, botTestPage.selectAllOption);
        assertSizeLessThan(4, botTestPage.selectAllOption);
        assertSizeLessThanOrEquals(3, botTestPage.selectAllOption);
        assertSizeGreaterThan(2, botTestPage.selectAllOption);
        assertSizeGreaterThanOrEquals(3, botTestPage.selectAllOption);
    }

    /* Url */
    @Test
    public void urlTest() {
        if (browserIsHtmlUnit()) {
            assertCurrentUrlEquals(botTestPage.url.replace("file:///", "file:/"));
        } else {<commit_msg>Updated test to ignore firefox on linux<commit_after>package com.github.webdriverextensions;

import java.util.List;
import java.util.concurrent.TimeUnit;
import static com.github.webdriverextensions.Bot.*;
import com.github.webdriverextensions.generator.GeneratedWebRepository;
import com.github.webdriverextensions.junitrunner.WebDriverRunner;
import com.github.webdriverextensions.junitrunner.annotations.*;
import org.junit.Assert;
import static org.hamcrest.Matchers.*;
import static org.openqa.selenium.Platform.LINUX;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.openqa.selenium.Platform;

@RunWith(WebDriverRunner.class)
@Chrome
@Firefox
@IgnoreFirefox(platform = LINUX) // Ignore on linux since travic ci seems to fail with current version of geckodriver
@InternetExplorer
@Edge
@Safari
@PhantomJS
@HtmlUnit
public class BotTest extends GeneratedWebRepository {

    @Before
    public void before() {
        open(botTestPage.url);
    }

    /* Click */
    @Test
    public void clickTest() {
        click(botTestPage.checkbox2);
        assertIsChecked(botTestPage.checkbox2);
    }

    /* Type */
    @Test
    public void typeTest() {
        clear(botTestPage.textInput);
        type("text", botTestPage.textInput);
        assertValueEquals("text", botTestPage.textInput);
        clear(botTestPage.textInput);
        type(42.0, botTestPage.textInput);
        assertValueEquals(42.0, botTestPage.textInput);
    }

    /* Clear */
    @Test
    public void clearTest() {
        clear(botTestPage.textInput);
        assertValueEquals("", botTestPage.textInput);
        clearAndType("text", botTestPage.textInput);
        assertValueEquals("text", botTestPage.textInput);
        clearAndType(42.0, botTestPage.textInput);
        assertValueEquals(42.0, botTestPage.textInput);
    }

    /* Press Keys */
    @Test
    public void pressKeysTest() {
        clear(botTestPage.textInput);
        pressKeys(botTestPage.textInput, "t");
        assertValueEquals("t", botTestPage.textInput);
        pressKeys(botTestPage.textInput, "e");
        assertValueEquals("te", botTestPage.textInput);
        pressKeys(botTestPage.textInput, "x");
        assertValueEquals("tex", botTestPage.textInput);
        pressKeys(botTestPage.textInput, "t");
        assertValueEquals("text", botTestPage.textInput);
    }

    /* Select/Deselect */
    @Test
    @IgnoreSafari // Fails to select on click in Safari
    public void selectDeselectTest() {
        select(botTestPage.multipleSelectOption2);
        assertIsSelected(botTestPage.multipleSelectOption2);
        deselect(botTestPage.multipleSelectOption1);
        assertIsDeselected(botTestPage.multipleSelectOption1);
    }

    /* Check/Uncheck */
    @Test
    public void checkUncheckTest() {
        check(botTestPage.checkbox2);
        assertIsChecked(botTestPage.checkbox2);
        uncheck(botTestPage.checkbox1);
        assertIsUnchecked(botTestPage.checkbox1);
    }

    /* Open */
    @Test
    @IgnoreSafari // throws UnsupportedCommandException from RemoteWebElement.isDisplayed() for some reason
    public void openTest() {
        debug(driver().getPageSource());
        open(botTestPage);
        assertIsOpen(botTestPage);
    }

    /* Wait For */
    @Test
    @IgnoreSafari // throws UnsupportedCommandException from RemoteWebElement.isDisplayed() for some reason
    public void waitForTest() {
        waitForElementToDisplay(botTestPage.firstAppendedSpan);
        assertIsDisplayed(botTestPage.firstAppendedSpan);
        assertIsNotDisplayed(botTestPage.secondAppendedSpan, 0);
        waitFor(0.8);
        waitFor(0.2 / 24 / 60 / 60, TimeUnit.DAYS);
        waitFor(0.2 / 60 / 60, TimeUnit.HOURS);
        waitFor(0.2 / 60, TimeUnit.MINUTES);
        waitFor(0.2, TimeUnit.SECONDS);
        waitFor(0.2 * 1000, TimeUnit.MILLISECONDS);
        waitFor(0.2 * 1000 * 1000, TimeUnit.MICROSECONDS);
        assertIsDisplayed(botTestPage.firstAppendedSpan);
        assertIsDisplayed(botTestPage.secondAppendedSpan);
    }

    @Test
    @IgnoreSafari // throws UnsupportedCommandException from RemoteWebElement.isDisplayed() for some reason
    public void waitForElementsToDisplayTest() {
        waitForElementsToDisplay(botTestPage.appendedSpans);
        assertIsDisplayed(botTestPage.firstAppendedSpan);
        assertIsNotDisplayed(botTestPage.secondAppendedSpan);
    }

    /* Debug */
    @Test
    public void debugTest() {
        debug("Text to debug");
        debug(botTestPage.attributesSpan);
        debug(botTestPage.selectAllOption);
        debug(botTestPage.body);
    }

    /* Is Open */
    @Test
    @IgnoreSafari // throws UnsupportedCommandException from RemoteWebElement.isDisplayed() for some reason
    public void isOpenTest() {
        assertIsOpen(botTestPage);
        assertIsNotOpen(webDriverExtensionSite);
    }

    /* Is Display */
    @Test
    @IgnoreSafari // throws UnsupportedCommandException from RemoteWebElement.isDisplayed() for some reason
    @IgnoreHtmlUnit(platform = LINUX) // Ignore html unit tests on linux platforms since it seems to fail for some reson in drone.io
    public void isDisplayedTest() {
        assertIsDisplayed(botTestPage.textSpan);
        assertIsDisplayed(botTestPage.firstAppendedSpan, 2);
        assertIsNotDisplayed(botTestPage.secondAppendedSpan);
        assertIsDisplayed(botTestPage.secondAppendedSpan, 2);
    }

    /* Size */
    @Test
    public void sizeTest() {
        assertSizeEquals(3, botTestPage.selectAllOption);
        assertSizeNotEquals(0, botTestPage.selectAllOption);
        assertSizeLessThan(4, botTestPage.selectAllOption);
        assertSizeLessThanOrEquals(3, botTestPage.selectAllOption);
        assertSizeGreaterThan(2, botTestPage.selectAllOption);
        assertSizeGreaterThanOrEquals(3, botTestPage.selectAllOption);
    }

    /* Url */
    @Test
    public void urlTest() {
        if (browserIsHtmlUnit()) {
            assertCurrentUrlEquals(botTestPage.url.replace("file:///", "file:/"));
        } else {
{'fraction_non_alphanumeric': 0.10210561497326204, 'fraction_numerical': 0.011530748663101604, 'mean_word_length': 3.2992097701149423, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, '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': '1214961', 'n_tokens_mistral': 3581, 'n_tokens_neox': 3492, 'n_words': 623}