Sha256: 9a7f442834aec8db88e84c2f88474be77a20dc5d0b3f3b89c1eb918a31cebd55

Contents?: true

Size: 1.16 KB

Versions: 5

Compression:

Stored size: 1.16 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 => "John Doe"
    }

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

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
watir-webdriver-0.1.3 spec/alert_spec.rb
watir-webdriver-0.1.2 spec/alert_spec.rb
ayanko-watir-webdriver-0.1.1.1 spec/alert_spec.rb
watir-webdriver-0.1.1 spec/alert_spec.rb
watir-webdriver-0.1.0 spec/alert_spec.rb