<commit_before>require File.expand_path("watirspec/spec_helper", File.dirname(__FILE__))

describe 'Alert API' do
  before do
    browser.goto WatirSpec.url_for("alerts.html", :needs_server => true)
  end

  context 'alert' do
    after do
      browser.alert.close if browser.alert.exists?
    end

    describe '#text' do
      it 'returns text of alert' do
        browser.button(:id => 'alert').click
        browser.alert.text.should == 'ok'
      end
    end

    describe '#exists?' do
      it 'returns false if alert is present' do
        browser.alert.exists?.should be_false
      end

      it 'returns true if alert is present' do
        browser.button(:id => 'alert').click
        browser.alert.exists?.should be_true
      end
    end

    describe '#close' do
      it 'closes alert' do
        browser.button(:id => 'alert').click
        browser.alert.close
        browser.alert.exists?.should be_false
      end
    end
  end

  context 'confirm' do
    after do
      browser.confirm.dismiss if browser.confirm.exists?
    end

    describe '#accept' do
      it 'accepts confirm' do
        browser.button(:id => 'confirm').click
        browser.confirm.accept
        browser.button(:id => "confirm").value.should == "true"<commit_msg>Fixed spec matchers. Ref: https://github.com/watir/watir-webdriver/pull/142#r779504<commit_after>require File.expand_path("watirspec/spec_helper", File.dirname(__FILE__))

describe 'Alert API' do
  before do
    browser.goto WatirSpec.url_for("alerts.html", :needs_server => true)
  end

  context 'alert' do
    after do
      browser.alert.close if browser.alert.exists?
    end

    describe '#text' do
      it 'returns text of alert' do
        browser.button(:id => 'alert').click
        browser.alert.text.should == 'ok'
      end
    end

    describe '#exists?' do
      it 'returns false if alert is present' do
        browser.alert.should_not exist
      end

      it 'returns true if alert is present' do
        browser.button(:id => 'alert').click
        browser.alert.should exist
      end
    end

    describe '#close' do
      it 'closes alert' do
        browser.button(:id => 'alert').click
        browser.alert.close
        browser.alert.should_not exist
      end
    end
  end

  context 'confirm' do
    after do
      browser.confirm.dismiss if browser.confirm.exists?
    end

    describe '#accept' do
      it 'accepts confirm' do
        browser.button(:id => 'confirm').click
        browser.confirm.accept
        browser.button(:id => "confirm").value.should == "true"
{'fraction_non_alphanumeric': 0.10825545171339564, 'fraction_numerical': 0.0035046728971962616, 'mean_word_length': 2.411686586985392, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, 'https://': 1, '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': '6156670', 'n_tokens_mistral': 769, 'n_tokens_neox': 738, 'n_words': 209}