<commit_before>path = require 'path'
webdriver = require 'selenium-webdriver'
chai = require 'chai'
chaiWebdriver = require '..'

driver = new webdriver.Builder()
  .withCapabilities(webdriver.Capabilities.phantomjs())
  .build()

chai.use chaiWebdriver(driver)
{expect} = chai

before (done) ->
  url = "file://#{path.join __dirname, 'test.html'}"
  driver.get(url).then -> done()

after (done) ->
  driver.quit().then -> done()

describe '#text', ->

  it 'verifies that an element has exact text', (done) ->
    expect('h1').dom.to.have.text "The following text is an excerpt from Finnegan's Wake by <NAME>", done

  it 'verifies that an element does not have exact text', (done) ->
    expect('h1').dom.not.to.have.text "Wake", done

  it 'verifies that an element contains text', (done) ->
    expect('h1').dom.to.contain.text "Finnegan", done

  it 'verifies that an element does not contain text', (done) ->
    expect('h1').dom.not.to.contain.text "Bibimbap", done

describe '#visible', ->

  it 'verifies that an element is visible', (done) ->
    expect('.does-exist').dom.to.be.visible done

  it 'verifies that a non-existing element is not visible', (done) ->
    expect('.does-not-exist').dom.not.to.be.visible done

  it 'verifies that a hidden element is not visible', (done) ->
    expect('.exists-but-hidden').dom.not.to.be.visible done

describe '#count', ->

  it 'verifies that an element appears thrice', (done) ->
    expect('input').dom.to.have.count 3, done

  it 'verifies that a non-existing element has a count of 0', (done) ->
    expect('.does-not-exist').dom.to.have.count 0, done

describe '#style', ->

  it 'verifies that an element has a red background', (done) ->
    expect('.red-bg').dom.to.have.style 'background-color', 'rgba(255, 0, 0, 1)', done
  
  it 'verifies that an element does not have a red background', (done) ->
    expect('.green-text').dom.to.have.style 'background-color', 'rgba(0, 0, 0, 0)', done

describe '#value', ->

  it 'verifies that a text field has a specific value', (done) ->
    expect('.does-exist').dom.to.have.value 'People put stuff here', done

  it 'verifies that a text field does not have a specific value', (done) ->
    expect('.does-exist').dom.not.to.have.value 'Beep boop', done

describe '#disabled', ->
  it 'verifies that an input is disabled', (done) ->
    expect('.i-am-disabled').dom.to.be.disabled done

  it 'verifies that an input is not disabled', (done) ->
    expect('.does-exist').dom.not.to.be.disabled done

<commit_msg>disable timeouts while waiting for webdriver to load the initial page<commit_after>path = require 'path'
webdriver = require 'selenium-webdriver'
chai = require 'chai'
chaiWebdriver = require '..'

driver = new webdriver.Builder()
  .withCapabilities(webdriver.Capabilities.phantomjs())
  .build()

chai.use chaiWebdriver(driver)
{expect} = chai

before (done) ->
  @timeout 0 # this may take a while in CI
  url = "file://#{path.join __dirname, 'test.html'}"
  driver.get(url).then -> done()

after (done) ->
  driver.quit().then -> done()

describe '#text', ->

  it 'verifies that an element has exact text', (done) ->
    expect('h1').dom.to.have.text "The following text is an excerpt from Finnegan's Wake by <NAME>", done

  it 'verifies that an element does not have exact text', (done) ->
    expect('h1').dom.not.to.have.text "Wake", done

  it 'verifies that an element contains text', (done) ->
    expect('h1').dom.to.contain.text "Finnegan", done

  it 'verifies that an element does not contain text', (done) ->
    expect('h1').dom.not.to.contain.text "Bibimbap", done

describe '#visible', ->

  it 'verifies that an element is visible', (done) ->
    expect('.does-exist').dom.to.be.visible done

  it 'verifies that a non-existing element is not visible', (done) ->
    expect('.does-not-exist').dom.not.to.be.visible done

  it 'verifies that a hidden element is not visible', (done) ->
    expect('.exists-but-hidden').dom.not.to.be.visible done

describe '#count', ->

  it 'verifies that an element appears thrice', (done) ->
    expect('input').dom.to.have.count 3, done

  it 'verifies that a non-existing element has a count of 0', (done) ->
    expect('.does-not-exist').dom.to.have.count 0, done

describe '#style', ->

  it 'verifies that an element has a red background', (done) ->
    expect('.red-bg').dom.to.have.style 'background-color', 'rgba(255, 0, 0, 1)', done
  
  it 'verifies that an element does not have a red background', (done) ->
    expect('.green-text').dom.to.have.style 'background-color', 'rgba(0, 0, 0, 0)', done

describe '#value', ->

  it 'verifies that a text field has a specific value', (done) ->
    expect('.does-exist').dom.to.have.value 'People put stuff here', done

  it 'verifies that a text field does not have a specific value', (done) ->
    expect('.does-exist').dom.not.to.have.value 'Beep boop', done

describe '#disabled', ->
  it 'verifies that an input is disabled', (done) ->
    expect('.i-am-disabled').dom.to.be.disabled done

  it 'verifies that an input is not disabled', (done) ->
    expect('.does-exist').dom.not.to.be.disabled done


{'fraction_non_alphanumeric': 0.1624780829924021, 'fraction_numerical': 0.006818624586012079, 'mean_word_length': 3.5635555555555554, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 55, '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': '1643579', 'n_tokens_mistral': 1722, 'n_tokens_neox': 1644, 'n_words': 529}