Sha256: e7e1ca58f3b533bb0ddad1ee1b6f58f10cfbf074372cf479ea5f0d180f31a346

Contents?: true

Size: 1.17 KB

Versions: 31

Compression:

Stored size: 1.17 KB

Contents

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

describe "AlertHelper" do
  before do
    browser.goto("file://" + File.expand_path("html/alerts.html", File.dirname(__FILE__)))
  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

31 entries across 31 versions & 1 rubygems

Version Path
watir-webdriver-0.5.0 spec/alert_spec.rb
watir-webdriver-0.4.1 spec/alert_spec.rb
watir-webdriver-0.4.0 spec/alert_spec.rb
watir-webdriver-0.3.9 spec/alert_spec.rb
watir-webdriver-0.3.8 spec/alert_spec.rb
watir-webdriver-0.3.7 spec/alert_spec.rb
watir-webdriver-0.3.6 spec/alert_spec.rb
watir-webdriver-0.3.5 spec/alert_spec.rb
watir-webdriver-0.3.4 spec/alert_spec.rb
watir-webdriver-0.3.3 spec/alert_spec.rb
watir-webdriver-0.3.2 spec/alert_spec.rb
watir-webdriver-0.3.1 spec/alert_spec.rb
watir-webdriver-0.3.0 spec/alert_spec.rb
watir-webdriver-0.2.9 spec/alert_spec.rb
watir-webdriver-0.2.8 spec/alert_spec.rb
watir-webdriver-0.2.7 spec/alert_spec.rb
watir-webdriver-0.2.6 spec/alert_spec.rb
watir-webdriver-0.2.5 spec/alert_spec.rb
watir-webdriver-0.2.4 spec/alert_spec.rb
watir-webdriver-0.2.3 spec/alert_spec.rb