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

No longer automatically handle the repost prompt for FF

This commit is contained in:
Thomas Walpole 2018-02-15 14:34:06 -08:00
parent 65bc1449aa
commit 6458ed55ed
4 changed files with 23 additions and 5 deletions

View file

@ -51,10 +51,7 @@ class Capybara::Selenium::Driver < Capybara::Driver::Base
end
def refresh
accept_modal(nil, wait: 0.1) do
browser.navigate.refresh
end
rescue Capybara::ModalNotFound
browser.navigate.refresh
end
def go_back

View file

@ -17,6 +17,7 @@ Capybara::SpecHelper.spec '#refresh' do
end
it "it reposts" do
skip "Firefox insists on prompting without providing a way to suppress" if marionette?(@session)
@session.visit('/form')
@session.select('Sweden', from: 'form_region')
@session.click_button('awesome')

View file

@ -106,7 +106,7 @@ module Capybara
end
def marionette?(session)
session.driver.respond_to?(:marionette?, true) && session.driver.send(:marionette?)
session.respond_to?(:driver) && session.driver.respond_to?(:marionette?, true) && session.driver.send(:marionette?)
end
end
end

View file

@ -123,5 +123,25 @@ RSpec.describe Capybara::Selenium::Driver do
end
end
end
context "#refresh" do
def extract_results(session)
expect(session).to have_xpath("//pre[@id='results']")
YAML.load Nokogiri::HTML(session.body).xpath("//pre[@id='results']").first.inner_html.lstrip
end
it "can repost by accepting confirm" do
@session = TestSessions::SeleniumMarionette
@session.visit('/form')
@session.select('Sweden', from: 'form_region')
@session.click_button('awesome')
expect {
@session.accept_confirm(wait: 0.1) do
@session.refresh
sleep 2
end
}.to change{ extract_results(@session)['post_count'] }.by(1)
end
end
end