Sha256: d681923c1cc4e1db2700332831fff1e1cae0f118d462eaec1c3b88b305277564

Contents?: true

Size: 1.17 KB

Versions: 8

Compression:

Stored size: 1.17 KB

Contents

describe "Watir::IE", :if => WatirSplash::Util.framework == :watir do

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

  context "Watir::Element" do
    context "#save_as" do
      it "saves file with the browser" 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

      it "allows only absolute paths" do
        expect {link(:text => "Download").save_as("download.zip")}.to raise_exception
      end
    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 with non existing files" do
        field = file_field(:id => "upload")
        expect {field.set "upload.zip"}.to raise_exception
      end
    end
  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
watirsplash-2.0.0.rc1 spec/watir_ie_spec.rb
watirsplash-1.4.3 spec/watir_ie_spec.rb
watirsplash-1.4.2 spec/watir_ie_spec.rb
watirsplash-1.4.1 spec/watir_ie_spec.rb
watirsplash-1.4.0 spec/watir_ie_spec.rb
watirsplash-1.3.0 spec/watir_ie_spec.rb
watirsplash-1.2.1 spec/watir_ie_spec.rb
watirsplash-1.2.0 spec/watir_ie_spec.rb