Sha256: d608387814bbffa7d0c33b0c1a9a783c86104e95698af9a5d4492d6327bb1786

Contents?: true

Size: 1.04 KB

Versions: 3

Compression:

Stored size: 1.04 KB

Contents

describe WatirSplash::Browser do

  before :all do
    # close the browser opened in environment.rb
    WatirSplash::Browser.current.close
  end

  it "opens up the browser" do
    browser = WatirSplash::Browser.new
    browser.should exist
    browser.should respond_to(:title)
  end

  it "stores the current browser" do
    browser = WatirSplash::Browser.new
    browser.should == WatirSplash::Browser.current
  end

  it "detects JavaScript errors" do
    browser = WatirSplash::Browser.new
    browser.goto "http://dl.dropbox.com/u/2731643/WatirSplash/test.html"
    browser.execute_script("window.originalOnErrorExecuted").should_not be_true

    expect {
      browser.link(:id => "errorLink").click
    }.to raise_error(WatirSplash::JavaScriptError, /JavaScript error:.*unexistingVar/)
    browser.execute_script("window.originalOnErrorExecuted").should be_true    

    expect {
      browser.link(:id => "toggle").click
    }.not_to raise_error
  end

  after :each do
    WatirSplash::Browser.current.close
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
watirsplash-2.3.2 spec/browser_spec.rb
watirsplash-2.3.1 spec/browser_spec.rb
watirsplash-2.3.0 spec/browser_spec.rb