2016-03-07 19:52:19 -05:00
|
|
|
# frozen_string_literal: true
|
2013-02-06 14:36:55 -05:00
|
|
|
|
2018-02-28 19:11:41 -05:00
|
|
|
Capybara::SpecHelper.spec '#title' do
|
2018-07-10 17:18:39 -04:00
|
|
|
it 'should get the title of the page' do
|
2013-02-06 14:36:55 -05:00
|
|
|
@session.visit('/with_title')
|
2013-11-14 12:43:36 -05:00
|
|
|
expect(@session.title).to eq('Test Title')
|
2013-02-06 14:36:55 -05:00
|
|
|
end
|
|
|
|
|
2018-07-10 17:18:39 -04:00
|
|
|
context 'with css as default selector' do
|
2013-02-06 14:36:55 -05:00
|
|
|
before { Capybara.default_selector = :css }
|
2018-06-19 16:57:42 -04:00
|
|
|
|
2018-08-27 12:34:33 -04:00
|
|
|
after { Capybara.default_selector = :xpath }
|
|
|
|
|
2018-07-10 17:18:39 -04:00
|
|
|
it 'should get the title of the page' do
|
2013-02-06 14:36:55 -05:00
|
|
|
@session.visit('/with_title')
|
2013-11-14 12:43:36 -05:00
|
|
|
expect(@session.title).to eq('Test Title')
|
2013-02-06 14:36:55 -05:00
|
|
|
end
|
|
|
|
end
|
2018-03-16 17:33:52 -04:00
|
|
|
|
2018-07-10 17:18:39 -04:00
|
|
|
context 'within iframe', requires: [:frames] do
|
|
|
|
it 'should get the title of the top level browsing context' do
|
2018-03-16 17:33:52 -04:00
|
|
|
@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
|
2016-03-07 19:52:19 -05:00
|
|
|
end
|