1
0
Fork 0
mirror of https://github.com/teamcapybara/capybara.git synced 2022-11-09 12:08:07 -05:00
This commit is contained in:
Thomas Walpole 2018-06-06 13:21:33 -07:00
parent c85d0a1e8b
commit 19471038ce
3 changed files with 25 additions and 0 deletions

View file

@ -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

View file

@ -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

View file

@ -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