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 - '\