Sha256: fd5b630ec33162c652cb1fec45412d0e9c3e7d2ee6a4208414688467c2d8153c

Contents?: true

Size: 1.44 KB

Versions: 9

Compression:

Stored size: 1.44 KB

Contents

Capybara::SpecHelper.spec '#within_window', :requires => [:windows] do
  before(:each) do
    @session.visit('/within_popups')
  end
  after(:each) do
    @session.within_window("firstPopup") do
      @session.evaluate_script('window.close()')
    end
    @session.within_window("secondPopup") do
      @session.evaluate_script('window.close()')
    end
  end

  it "should find the div in firstPopup" do
    @session.within_window("firstPopup") do
      @session.find("//*[@id='divInPopupOne']").text.should eql 'This is the text of divInPopupOne'
    end
  end
  it "should find the div in secondPopup" do
    @session.within_window("secondPopup") do
      @session.find("//*[@id='divInPopupTwo']").text.should eql 'This is the text of divInPopupTwo'
    end
  end
  it "should find the divs in both popups" do
    @session.within_window("secondPopup") do
      @session.find("//*[@id='divInPopupTwo']").text.should eql 'This is the text of divInPopupTwo'
    end
    @session.within_window("firstPopup") do
      @session.find("//*[@id='divInPopupOne']").text.should eql 'This is the text of divInPopupOne'
    end
  end
  it "should find the div in the main window after finding a div in a popup" do
    @session.within_window("secondPopup") do
      @session.find("//*[@id='divInPopupTwo']").text.should eql 'This is the text of divInPopupTwo'
    end
    @session.find("//*[@id='divInMainWindow']").text.should eql 'This is the text for divInMainWindow'
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
swipe-rails-0.0.5 vendor/bundle/gems/capybara-2.1.0/lib/capybara/spec/session/within_window_spec.rb
capybara-2.1.0 lib/capybara/spec/session/within_window_spec.rb
capybara-2.1.0.rc1 lib/capybara/spec/session/within_window_spec.rb
capybara-2.0.3 lib/capybara/spec/session/within_window_spec.rb
capybara-2.1.0.beta1 lib/capybara/spec/session/within_window_spec.rb
capybara-2.0.2 lib/capybara/spec/session/within_window_spec.rb
capybara-2.0.1 lib/capybara/spec/session/within_window_spec.rb
capybara-2.0.0 lib/capybara/spec/session/within_window_spec.rb
capybara-2.0.0.beta4 lib/capybara/spec/session/within_window_spec.rb