EdgeChrome can't click on file inputs

This commit is contained in:
Thomas Walpole 2019-08-02 10:23:58 -07:00
parent 4c3bbc473d
commit 724e245b6e
2 changed files with 16 additions and 18 deletions

View File

@ -36,14 +36,16 @@ class Capybara::Selenium::EdgeNode < Capybara::Selenium::Node
html5_drop(*args)
end
# def click(*)
# super
# rescue ::Selenium::WebDriver::Error::WebDriverError => e
# # chromedriver 74 (at least on mac) raises the wrong error for this
# raise ::Selenium::WebDriver::Error::ElementClickInterceptedError, e.message if e.message.match?(/element click intercepted/)
#
# raise
# end
def click(*)
super
rescue Selenium::WebDriver::Error::InvalidArgumentError => e
tag_name, type = attrs(:tagName, :type).map { |val| val&.downcase }
if tag_name == 'input' && type == 'file'
raise Selenium::WebDriver::Error::InvalidArgumentError, "EdgeChrome can't click on file inputs.\n#{e.message}"
end
raise
end
def disabled?
return super unless chrome_edge?

View File

@ -7,7 +7,7 @@ require 'shared_selenium_node'
require 'rspec/shared_spec_matchers'
# unless ENV['CI']
# Selenium::WebDriver::Edge::Service.driver_path = '/usr/local/bin/msedgedriver'
# Selenium::WebDriver::Edge::Service.driver_path = '/usr/local/bin/msedgedriver'
# end
if ::Selenium::WebDriver::Platform.mac?
@ -30,17 +30,13 @@ end
skipped_tests = %i[response_headers status_code trigger]
Capybara::SpecHelper.log_selenium_driver_version(Selenium::WebDriver::Edge) if ENV['CI']
Capybara::SpecHelper.log_selenium_driver_version(Selenium::WebDriver::EdgeChrome) if ENV['CI']
Capybara::SpecHelper.run_specs TestSessions::SeleniumEdge, 'selenium', capybara_skip: skipped_tests do |example|
# case example.metadata[:description]
# when /#refresh it reposts$/
# skip 'Edge insists on prompting without providing a way to suppress'
# when /should be able to open non-http url/
# skip 'Crashes'
# when /when Capybara.always_include_port is true/
# skip 'Crashes'
# end
case example.metadata[:full_description]
when 'Capybara::Session selenium #attach_file with a block can upload by clicking the file input'
pending "EdgeChrome doesn't allow clicking on file inputs"
end
end
RSpec.describe 'Capybara::Session with Edge', capybara_skip: skipped_tests do