Sha256: aed18dcb04557d8b4497a2abd7a2e951cbf2658ddda542f00e1990df0ebf6a20

Contents?: true

Size: 1.23 KB

Versions: 10

Compression:

Stored size: 1.23 KB

Contents

require File.expand_path("../watirspec/spec_helper", __FILE__)

describe "ClickableElement" do

  before :each do
    browser.goto(WatirSpec.files + "/non_control_elements.html")
  end

  describe "#click_and_attach" do
    it 'opens a page in a new browser with the same options' do
      b = browser.link(:name, /bad_attribute/).click_and_attach
      b.text.include?("User administration").should be_true # to make sure it is open.
      b.options.should == browser.options
      b.cookies.should == browser.cookies
    end

    it "opens the page in a new browser with the same cookies" do
      browser.add_cookie("localhost", "foo", "bar")
      old_cookies = browser.cookies
      old_cookies.should_not be_empty

      browser.goto(WatirSpec.files + "/non_control_elements.html")
      b = browser.link(:name, /bad_attribute/).click_and_attach

      b.should_not == browser
      b.cookies.should == old_cookies
    end
  end

  describe "#download" do
    it 'returns a click-opened page as io' do
      expected = File.read "#{WatirSpec.files}/forms_with_input_elements.html".sub("file://", '')

      browser.link(:name, /bad_attribute/).download.read.should == expected
      browser.link(:name, /bad_attribute/).should exist
    end
  end

end

Version data entries

10 entries across 10 versions & 4 rubygems

Version Path
celerity_thingista-0.9.3 spec/clickable_element_spec.rb
celerity_thingista-0.9.2 spec/clickable_element_spec.rb
frameworks-capybara-0.2.0.rc6 vendor/bundle/ruby/1.8/gems/celerity-0.9.2/spec/clickable_element_spec.rb
frameworks-capybara-0.2.0.rc5 vendor/bundle/ruby/1.8/gems/celerity-0.9.2/spec/clickable_element_spec.rb
frameworks-capybara-0.2.0.rc4 vendor/bundle/ruby/1.8/gems/celerity-0.9.2/spec/clickable_element_spec.rb
frameworks-capybara-0.2.0.rc3 vendor/bundle/ruby/1.8/gems/celerity-0.9.2/spec/clickable_element_spec.rb
frameworks-capybara-0.2.0.rc2 vendor/bundle/ruby/1.8/gems/celerity-0.9.2/spec/clickable_element_spec.rb
celerity-0.9.2 spec/clickable_element_spec.rb
celerity-0.9.1 spec/clickable_element_spec.rb
no-click-exception-celerity-0.9.0 spec/clickable_element_spec.rb