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:
parent
fdf0095a67
commit
63197387f9
4 changed files with 9 additions and 9 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -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?
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 - '\
|
||||
|
|
Loading…
Reference in a new issue