mirror of
https://github.com/teamcapybara/capybara.git
synced 2022-11-09 12:08:07 -05:00
test for removal of all cookies in all drivers
This commit is contained in:
parent
54a368b847
commit
318f595ca4
4 changed files with 19 additions and 19 deletions
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Capybara::SpecHelper.spec '#reset_session!' do
|
Capybara::SpecHelper.spec '#reset_session!' do
|
||||||
it 'removes cookies' do
|
it 'removes cookies from current domain' do
|
||||||
@session.visit('/set_cookie')
|
@session.visit('/set_cookie')
|
||||||
@session.visit('/get_cookie')
|
@session.visit('/get_cookie')
|
||||||
expect(@session).to have_content('test_cookie')
|
expect(@session).to have_content('test_cookie')
|
||||||
|
@ -11,6 +11,20 @@ Capybara::SpecHelper.spec '#reset_session!' do
|
||||||
expect(@session.body).not_to include('test_cookie')
|
expect(@session.body).not_to include('test_cookie')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'removes ALL cookies', requires: [:server] do
|
||||||
|
domains = ['localhost', '127.0.0.1']
|
||||||
|
domains.each do |domain|
|
||||||
|
@session.visit("http://#{domain}:#{@session.server.port}/set_cookie")
|
||||||
|
@session.visit("http://#{domain}:#{@session.server.port}/get_cookie")
|
||||||
|
expect(@session).to have_content('test_cookie')
|
||||||
|
end
|
||||||
|
@session.reset_session!
|
||||||
|
domains.each do |domain|
|
||||||
|
@session.visit("http://#{domain}:#{@session.server.port}/get_cookie")
|
||||||
|
expect(@session.body).not_to include('test_cookie')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
it 'resets current url, host, path' do
|
it 'resets current url, host, path' do
|
||||||
@session.visit '/foo'
|
@session.visit '/foo'
|
||||||
expect(@session.current_url).not_to be_empty
|
expect(@session.current_url).not_to be_empty
|
||||||
|
|
|
@ -112,22 +112,4 @@ RSpec.describe 'Capybara::Session with chrome' do
|
||||||
expect(Time.parse(extract_results(@session)['datetime'])).to eq datetime
|
expect(Time.parse(extract_results(@session)['datetime'])).to eq datetime
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#reset_session!' do
|
|
||||||
it 'removes all cookies' do
|
|
||||||
@session = TestSessions::Chrome
|
|
||||||
domains = ['localhost', '127.0.0.1']
|
|
||||||
domains.each do |domain|
|
|
||||||
@session.visit("http://#{domain}:#{@session.server.port}/set_cookie")
|
|
||||||
@session.visit("http://#{domain}:#{@session.server.port}/get_cookie")
|
|
||||||
expect(@session).to have_content('test_cookie')
|
|
||||||
end
|
|
||||||
@session.reset_session!
|
|
||||||
domains.each do |domain|
|
|
||||||
@session.visit("http://#{domain}:#{@session.server.port}/get_cookie")
|
|
||||||
expect(@session.body).not_to include('test_cookie')
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -69,6 +69,8 @@ Capybara::SpecHelper.run_specs TestSessions::RemoteFirefox, FIREFOX_REMOTE_DRIVE
|
||||||
'if files are already set'
|
'if files are already set'
|
||||||
when 'Capybara::Session selenium_firefox_remote #attach_file with multipart form should fire change once when uploading multiple files from empty'
|
when 'Capybara::Session selenium_firefox_remote #attach_file with multipart form should fire change once when uploading multiple files from empty'
|
||||||
pending "FF < 62 doesn't support setting all files at once" if marionette_lt?(62, @session)
|
pending "FF < 62 doesn't support setting all files at once" if marionette_lt?(62, @session)
|
||||||
|
when 'Capybara::Session selenium_firefox_remote #reset_session! removes ALL cookies'
|
||||||
|
pending "Geckodriver doesn't provide a way to remove cookies outside the current domain"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -65,6 +65,8 @@ Capybara::SpecHelper.run_specs TestSessions::SeleniumMarionette, 'selenium', cap
|
||||||
skip 'Broken in FF 63 - https://bugzilla.mozilla.org/show_bug.cgi?id=1487358' if marionette_gte?(63, @session)
|
skip 'Broken in FF 63 - https://bugzilla.mozilla.org/show_bug.cgi?id=1487358' if marionette_gte?(63, @session)
|
||||||
when 'Capybara::Session selenium #click_link can download a file'
|
when 'Capybara::Session selenium #click_link can download a file'
|
||||||
skip 'Need to figure out testing of file downloading on windows platform' if Gem.win_platform?
|
skip 'Need to figure out testing of file downloading on windows platform' if Gem.win_platform?
|
||||||
|
when 'Capybara::Session selenium #reset_session! removes ALL cookies'
|
||||||
|
pending "Geckodriver doesn't provide a way to remove cookies outside the current domain"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue