Sha256: 1502c372bbc6ce95dbbea382cb5eef5ad183e9f891124ebb4d2612c038f11f71

Contents?: true

Size: 1.94 KB

Versions: 3

Compression:

Stored size: 1.94 KB

Contents

# encoding: utf-8
require File.expand_path("../spec_helper", __FILE__)

bug "http://github.com/jarib/watir-webdriver/issues#issue/17", :webdriver do

  describe "<frame> Frames" do

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

    bug "http://github.com/jarib/celerity/issues#issue/25", :celerity do
      describe "with selectors" do
        it "returns the matching elements" do
          browser.frames(:name => "frame1").to_a.should == [browser.frame(:class => "frame1")]
        end
      end
    end
    
    describe "#length" do
      it "returns the correct number of frames" do
        browser.frames.length.should == 2
      end
    end

    describe "#[]" do
      it "returns the frame at the given index" do
        browser.frames[0].id.should == "frame_1"
      end
    end

    describe "#each" do
      it "iterates through frames correctly" do
        count = 0

        browser.frames.each_with_index do |f, index|
          f.id.should ==  browser.frame(:index, index).id
          f.value.should == browser.frame(:index, index).value

          count += 1
        end

        count.should > 0
      end
    end
  end

  describe "<iframe> Frames" do

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

    describe "#length" do
      it "returns the correct number of frames" do
        browser.frames.length.should == 2
      end
    end

    describe "#[]" do
      it "returns the frame at the given index" do
        browser.frames[0].id.should == "frame_1"
      end
    end

    describe "#each" do
      it "iterates through frames correctly" do
        count = 0

        browser.frames.each_with_index do |f, index|
          f.name.should == browser.frame(:index, index).name
          f.id.should ==  browser.frame(:index, index).id
          f.value.should == browser.frame(:index, index).value

          count += 1
        end

        count.should > 0
      end
    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
watir-webdriver-0.1.4 spec/watirspec/frames_spec.rb
watir-webdriver-0.1.3 spec/watirspec/frames_spec.rb
watir-webdriver-0.1.2 spec/watirspec/frames_spec.rb