mirror of
https://github.com/teamcapybara/capybara.git
synced 2022-11-09 12:08:07 -05:00
Workaround marionette/geckodriver issue #1228 - https://github.com/mozilla/geckodriver/issues/1228
This commit is contained in:
parent
c85d0a1e8b
commit
19471038ce
3 changed files with 25 additions and 0 deletions
|
@ -91,6 +91,13 @@ class Capybara::Selenium::Node < Capybara::Driver::Node
|
|||
e.message =~ /Other element would receive the click/
|
||||
scroll_to_center
|
||||
end
|
||||
|
||||
if e.is_a?(::Selenium::WebDriver::Error::ElementNotInteractableError) && driver.firefox? && (tag_name == "tr")
|
||||
warn "You are attempting to click a table row which has issues in geckodriver/marionette - see https://github.com/mozilla/geckodriver/issues/1228. " \
|
||||
"Your test should probably be clicking on a table cell like a user would. Clicking the first cell in the row instead."
|
||||
return find_css('th:first-child,td:first-child')[0].click
|
||||
end
|
||||
|
||||
raise e
|
||||
end
|
||||
|
||||
|
|
|
@ -145,3 +145,16 @@ RSpec.describe Capybara::Selenium::Driver do
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
RSpec.describe Capybara::Selenium::Node do
|
||||
context "#click" do
|
||||
it "warns when attempting on a table row" do
|
||||
session = TestSessions::SeleniumMarionette
|
||||
session.visit('/tables')
|
||||
tr = session.find(:css, '#agent_table tr:first-child')
|
||||
allow(tr.base).to receive(:warn)
|
||||
tr.click
|
||||
expect(tr.base).to have_received(:warn).with /Clicking the first cell in the row instead/
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -247,6 +247,11 @@ RSpec.shared_examples "Capybara::Session" do |session, mode|
|
|||
session.find(:link, 'Go to root').click
|
||||
expect(session).to have_current_path('/')
|
||||
end
|
||||
|
||||
it "should be able to click a table row" do
|
||||
session.visit('/tables')
|
||||
expect { session.find(:css, '#agent_table tr:first-child').click }.not_to raise_error
|
||||
end
|
||||
end
|
||||
|
||||
context "Windows" do
|
||||
|
|
Loading…
Reference in a new issue