Add readonly? to Capybara::Node::Simple

This commit is contained in:
Thomas Walpole 2020-09-25 18:27:58 -07:00
parent ca97cb6eb0
commit 952c4c21e7
5 changed files with 20 additions and 16 deletions

View File

@ -148,6 +148,10 @@ module Capybara
native.has_attribute?('multiple')
end
def readonly?
native.has_attribute?('readonly')
end
def synchronize(_seconds = nil)
yield # simple nodes don't need to wait
end

View File

@ -100,9 +100,9 @@ module Capybara
def is_displayed_atom # rubocop:disable Naming/PredicateName
@@is_displayed_atom ||= begin # rubocop:disable Style/ClassVars
browser.send(:bridge).send(:read_atom, 'isDisplayed')
rescue StandardError
# If the atom doesn't exist or other error
''
rescue StandardError
# If the atom doesn't exist or other error
''
end
end
end

View File

@ -6,10 +6,10 @@ private
def read_atom(function)
@atoms ||= Hash.new do |hash, key|
hash[key] = begin
File.read(File.expand_path("../../atoms/#{key}.min.js", __FILE__))
rescue Errno::ENOENT
super
end
File.read(File.expand_path("../../atoms/#{key}.min.js", __FILE__))
rescue Errno::ENOENT
super
end
end
@atoms[function]
end

View File

@ -27,10 +27,10 @@ module Capybara
def log(type)
data = begin
execute :get_log, {}, type: type.to_s
rescue ::Selenium::WebDriver::Error::UnknownCommandError
execute :get_log_legacy, {}, type: type.to_s
end
execute :get_log, {}, type: type.to_s
rescue ::Selenium::WebDriver::Error::UnknownCommandError
execute :get_log_legacy, {}, type: type.to_s
end
Array(data).map do |l|
::Selenium::WebDriver::LogEntry.new l.fetch('level', 'UNKNOWN'), l.fetch('timestamp'), l.fetch('message')

View File

@ -2,11 +2,11 @@
require 'spec_helper'
nokogumbo_required = begin
require 'nokogumbo'
true
rescue LoadError
false
end
require 'nokogumbo'
true
rescue LoadError
false
end
module TestSessions
RackTest = Capybara::Session.new(:rack_test, TestApp)