Sha256: 4b240249b87f8d0f0808f42ca13e8a98ba60040f96903849a4c500394fad4306

Contents?: true

Size: 1.15 KB

Versions: 8

Compression:

Stored size: 1.15 KB

Contents

require File.expand_path("watirspec/spec_helper", File.dirname(__FILE__))
require "watir-webdriver/extensions/alerts"

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

  it "handles an alert()" do
    returned = browser.alert do
      browser.button(:id => "alert").click
    end

    returned.should == "ok"
  end

  it "handles a confirmed confirm()" do
    returned = browser.confirm(true) do
      browser.button(:id => "confirm").click
    end

    returned.should == "set the value"

    browser.button(:id => "confirm").value.should == "true"
  end

  it "handles a cancelled confirm()" do
    returned = browser.confirm(false) do
      browser.button(:id => "confirm").click
    end

    returned.should == "set the value"

    browser.button(:id => "confirm").value.should == "false"
  end

  it "handles a prompt()" do
    returned = browser.prompt("my name") do
      browser.button(:id => "prompt").click
    end

    returned.should == {
      :message       => "enter your name",
      :default_value => "John Doe"
    }

    browser.button(:id => "prompt").value.should == "my name"
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
watir-webdriver-0.5.8 spec/alert_spec.rb
watir-webdriver-0.5.7 spec/alert_spec.rb
watir-webdriver-0.5.6 spec/alert_spec.rb
watir-webdriver-0.5.5 spec/alert_spec.rb
watir-webdriver-0.5.4 spec/alert_spec.rb
watir-webdriver-0.5.3 spec/alert_spec.rb
watir-webdriver-0.5.2 spec/alert_spec.rb
watir-webdriver-0.5.1 spec/alert_spec.rb