Sha256: 0e84f6d076757fde31f334bdb7e80c9fd8c7c59fa6494cd4f9906c534eb605b9

Contents?: true

Size: 1.83 KB

Versions: 4

Compression:

Stored size: 1.83 KB

Contents

Capybara::SpecHelper.spec '#within_frame', :requires => [:frames] do
  before(:each) do
    @session.visit('/within_frames')
  end

  it "should find the div in frameOne" do
    @session.within_frame("frameOne") do
      @session.find("//*[@id='divInFrameOne']").text.should eql 'This is the text of divInFrameOne'
    end
  end
  it "should find the div in FrameTwo" do
    @session.within_frame("frameTwo") do
      @session.find("//*[@id='divInFrameTwo']").text.should eql 'This is the text of divInFrameTwo'
    end
  end
  it "should find the text div in the main window after finding text in frameOne" do
    @session.within_frame("frameOne") do
      @session.find("//*[@id='divInFrameOne']").text.should eql 'This is the text of divInFrameOne'
    end
    @session.find("//*[@id='divInMainWindow']").text.should eql 'This is the text for divInMainWindow'
  end
  it "should find the text div in the main window after finding text in frameTwo" do
    @session.within_frame("frameTwo") do
      @session.find("//*[@id='divInFrameTwo']").text.should eql 'This is the text of divInFrameTwo'
    end
    @session.find("//*[@id='divInMainWindow']").text.should eql 'This is the text for divInMainWindow'
  end
  it "should return the result of executing the block" do
    @session.within_frame("frameOne") { "return value" }.should eql "return value"
  end
  it "should find the div given Element" do
    element = @session.find(:id, 'frameOne')
    @session.within_frame element do
      @session.find("//*[@id='divInFrameOne']").text.should eql 'This is the text of divInFrameOne'
    end
  end
  it "should find multiple nested frames" do
    @session.within_frame 'parentFrame' do
      @session.within_frame 'childFrame' do
        @session.within_frame 'grandchildFrame1' do end
        @session.within_frame 'grandchildFrame2' do end
      end    
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
swipe-rails-0.0.5 vendor/bundle/gems/capybara-2.1.0/lib/capybara/spec/session/within_frame_spec.rb
capybara-2.1.0 lib/capybara/spec/session/within_frame_spec.rb
capybara-2.1.0.rc1 lib/capybara/spec/session/within_frame_spec.rb
capybara-2.1.0.beta1 lib/capybara/spec/session/within_frame_spec.rb