Sha256: f2d1a59d518beb94d225e17b6a7c43064b955c99ccf7cf611a0524a5b851b7d4

Contents?: true

Size: 1.17 KB

Versions: 3

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
        lambda {link(:text => "Download").save_as("download.zip")}.should 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")
        lambda {field.set "upload.zip"}.should raise_exception
      end
    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
watirsplash-1.1.2 spec/watir_ie_spec.rb
watirsplash-1.1.1 spec/watir_ie_spec.rb
watirsplash-1.1.0 spec/watir_ie_spec.rb