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

Move common file input click emulation behavior into module

This commit is contained in:
Thomas Walpole 2019-08-31 13:23:44 -07:00
parent fdf0095a67
commit 63197387f9
4 changed files with 9 additions and 9 deletions

View file

@ -3,7 +3,7 @@ Release date: Unreleased
### Added
* Allow clicking on file input when using the block version of `attach_file` with Chrome
* Allow clicking on file input when using the block version of `attach_file` with Chrome and Firefox
* Spatial filters (`left_of`, `right_of`, `above`, `below`, `near`)
* rack_test driver now supports clicking on details elements to open/close them

View file

@ -2,6 +2,14 @@
class Capybara::Selenium::Node
module FileInputClickEmulation
def click(keys = [], **options)
super
rescue Selenium::WebDriver::Error::InvalidArgumentError
return emulate_click if attaching_file? && visible_file_field?
raise
end
private
def visible_file_field?

View file

@ -36,10 +36,6 @@ class Capybara::Selenium::ChromeNode < Capybara::Selenium::Node
def click(*)
super
rescue Selenium::WebDriver::Error::InvalidArgumentError
return emulate_click if attaching_file? && visible_file_field?
raise
rescue ::Selenium::WebDriver::Error::ElementClickInterceptedError
raise
rescue ::Selenium::WebDriver::Error::WebDriverError => e

View file

@ -9,10 +9,6 @@ class Capybara::Selenium::FirefoxNode < Capybara::Selenium::Node
def click(keys = [], **options)
super
rescue Selenium::WebDriver::Error::InvalidArgumentError
return emulate_click if attaching_file? && visible_file_field?
raise
rescue ::Selenium::WebDriver::Error::ElementNotInteractableError
if tag_name == 'tr'
warn 'You are attempting to click a table row which has issues in geckodriver/marionette - '\