1
0
Fork 0
mirror of https://github.com/teamcapybara/capybara.git synced 2022-11-09 12:08:07 -05:00

Require 'current_url' and 'title' to be for the top level browsing context - Issue #1845

This commit is contained in:
Thomas Walpole 2018-03-16 14:33:52 -07:00
parent 35fa93daa2
commit e479d90d40
2 changed files with 21 additions and 0 deletions

View file

@ -105,4 +105,15 @@ Capybara::SpecHelper.spec '#current_url, #current_path, #current_host' do
expect { @session.current_url }.not_to raise_exception
expect { @session.current_path }.not_to raise_exception
end
context "within iframe", requires: [:frames] do
it "should get the url of the top level browsing context" do
@session.visit('/within_frames')
expect(@session.current_url).to match(/within_frames\z/)
@session.within_frame('frameOne') do
expect(@session.current_url).to match(/within_frames\z/)
end
end
end
end

View file

@ -14,4 +14,14 @@ Capybara::SpecHelper.spec '#title' do
end
after { Capybara.default_selector = :xpath }
end
context "within iframe", requires: [:frames] do
it "should get the title of the top level browsing context" do
@session.visit('/within_frames')
expect(@session.title).to eq('With Frames')
@session.within_frame('frameOne') do
expect(@session.title).to eq('With Frames')
end
end
end
end