Sha256: 5d24c72682887ff9e71ee2caecf1544e9fc2a60dad8bccb74e0d087b03434ccd

Contents?: true

Size: 1.73 KB

Versions: 1

Compression:

Stored size: 1.73 KB

Contents

require "spec"

describe Watir::IE do

  before :each do
    goto "http://dl.dropbox.com/u/2731643/WatirSplash/test.html"
  end

  it "uses currentStyle method to show computed style" do
    t = table(:id => "normal")
    normal_cell = t[1][1]
    normal_cell.text.should == "1"
    normal_cell.style.color.should == "#000000"

    red_cell = t.cell(:class => "reddish")
    red_cell.text.should == "9"
    red_cell.style.color.should == "red"
  end

  it "has #save_as method for Watir::Element" do
    begin
      file_path = link(:text => "Download").save_as(File.path("download.zip"))
      File.read(file_path).should == "this is a 'zip' file!"
    ensure
      FileUtils.rm file_path rescue nil
    end
  end

  context Watir::FileField do
    context "#set" do
      it "sets the file to upload with the browser" do
        field = file_field(:id => "upload")
        file_path = File.expand_path(__FILE__)
        field.set file_path
        wait_until(5) {field.value =~ /#{File.basename(__FILE__)}/}
      end

      it "doesn't allow to use FileField#set with non existing file" do
        field = file_field(:id => "upload")
        lambda {field.set "upload.zip"}.should raise_exception
      end
    end
  end

  it "has wait_until" do
    lambda {wait_until(0.5) {sleep 0.1; true}}.should_not raise_exception
    lambda {wait_until(0.5) {sleep 0.1; false}}.should raise_exception(Watir::WaitHelper::TimeoutError)
  end

  it "closes the browser even when Watir::IE#run_error_checks throws an exception" do
    @browser.add_checker lambda {raise "let's fail IE#wait in IE#close"}
    @browser.should exist
    lambda {@browser.close}.should_not raise_exception
    @browser.should_not exist
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
watirsplash-0.2.14 spec/watir_ie_spec.rb