Remove file catcher event listener once file element is determined
This commit is contained in:
parent
6335d16e15
commit
533f1be2ed
|
@ -393,9 +393,10 @@ module Capybara
|
|||
JS
|
||||
|
||||
CAPTURE_FILE_ELEMENT_SCRIPT = <<~'JS'
|
||||
document.addEventListener('click', function(e){
|
||||
document.addEventListener('click', function file_catcher(e){
|
||||
if (e.target.matches("input[type='file']")) {
|
||||
window._capybara_clicked_file_input = e.target;
|
||||
this.removeEventListener('click', file_catcher);
|
||||
e.preventDefault();
|
||||
}
|
||||
})
|
||||
|
|
|
@ -54,8 +54,6 @@ Capybara::SpecHelper.run_specs TestSessions::Safari, SAFARI_DRIVER.to_s, capybar
|
|||
pending 'safaridriver thinks these links are non-interactable for some unknown reason'
|
||||
when /Capybara::Session selenium_safari #attach_file with a block can upload by clicking the file input/
|
||||
skip "safaridriver doesn't allow clicking on file inputs"
|
||||
when /Capybara::Session selenium_safari #attach_file with a block can upload by clicking the label/
|
||||
skip 'hangs tests'
|
||||
when /Capybara::Session selenium_safari #within_frame works if the frame is closed/,
|
||||
/Capybara::Session selenium_safari #switch_to_frame works if the frame is closed/
|
||||
skip 'Safari has a race condition when clicking an element that causes the frame to close. It will sometimes raise a NoSuchFrameError'
|
||||
|
|
Loading…
Reference in New Issue