mirror of
https://github.com/teamcapybara/capybara.git
synced 2022-11-09 12:08:07 -05:00
Only use visibility optimization if atom is available
Test base versions
This commit is contained in:
parent
d28a0d7866
commit
c6680db46a
7 changed files with 32 additions and 11 deletions
|
@ -41,7 +41,7 @@ matrix:
|
|||
env:
|
||||
- CAPYBARA_REMOTE=true
|
||||
- CAPYBARA_FF=true
|
||||
- gemfile: gemfiles/Gemfile.rspec-35
|
||||
- gemfile: gemfiles/Gemfile.base-versions
|
||||
rvm: 2.3.8
|
||||
env: CAPYBARA_FF=true
|
||||
addons:
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
# Version 3.13.1
|
||||
Release date: 2019-01-24
|
||||
|
||||
### Fixed
|
||||
|
||||
* Only use Selenium visibility optimization when JS atom is available - Issue #2151
|
||||
|
||||
# Version 3.13.0
|
||||
Release date: 2019-01-23
|
||||
|
||||
|
|
10
gemfiles/Gemfile.base-versions
Normal file
10
gemfiles/Gemfile.base-versions
Normal file
|
@ -0,0 +1,10 @@
|
|||
source 'https://rubygems.org'
|
||||
|
||||
gem 'bundler', '< 3.0'
|
||||
gemspec path: '..'
|
||||
|
||||
gem 'rack', '1.6.0'
|
||||
gem 'nokogiri', '~>1.8.0'
|
||||
gem 'xpath', '~>3.2.0'
|
||||
gem 'rspec', '~>3.5.0'
|
||||
gem 'selenium-webdriver', '~>3.5.0'
|
|
@ -1,7 +0,0 @@
|
|||
source 'https://rubygems.org'
|
||||
|
||||
gem 'bundler', '< 3.0'
|
||||
gemspec path: '..'
|
||||
|
||||
gem 'xpath', github: 'teamcapybara/xpath'
|
||||
gem 'rspec', '~>3.5.0'
|
|
@ -16,12 +16,14 @@ module Capybara
|
|||
def find_by(format, selector, uses_visibility:, texts:, styles:)
|
||||
els = find_context.find_elements(format, selector)
|
||||
hints = []
|
||||
|
||||
if (els.size > 2) && !ENV['DISABLE_CAPYBARA_SELENIUM_OPTIMIZATIONS']
|
||||
els = filter_by_text(els, texts) unless texts.empty?
|
||||
|
||||
hints_js = +''
|
||||
functions = []
|
||||
if uses_visibility
|
||||
if uses_visibility && !is_displayed_atom.empty?
|
||||
puts "running vis func"
|
||||
hints_js << <<~VISIBILITY_JS
|
||||
var vis_func = #{is_displayed_atom};
|
||||
VISIBILITY_JS
|
||||
|
@ -74,7 +76,12 @@ module Capybara
|
|||
end
|
||||
|
||||
def is_displayed_atom # rubocop:disable Naming/PredicateName
|
||||
@@is_displayed_atom ||= browser.send(:bridge).send(:read_atom, 'isDisplayed')
|
||||
@@is_displayed_atom ||= begin
|
||||
browser.send(:bridge).send(:read_atom, 'isDisplayed')
|
||||
rescue StandardError
|
||||
# If the atom doesn't exist or other error
|
||||
""
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -13,6 +13,8 @@ Capybara::SpecHelper.run_specs TestClass.new, 'DSL', capybara_skip: %i[
|
|||
case example.metadata[:full_description]
|
||||
when /has_css\? should support case insensitive :class and :id options/
|
||||
pending "Nokogiri doesn't support case insensitive CSS attribute matchers"
|
||||
when /#click_button should follow permanent redirects that maintain method/
|
||||
pending "Rack < 2 doesn't support 308" if Gem.loaded_specs['rack'].version < Gem::Version.new('2.0.0')
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -29,7 +29,9 @@ skipped_tests = %i[
|
|||
Capybara::SpecHelper.run_specs TestSessions::RackTest, 'RackTest', capybara_skip: skipped_tests do |example|
|
||||
case example.metadata[:full_description]
|
||||
when /has_css\? should support case insensitive :class and :id options/
|
||||
pending "Nokogiri doesn't support case insensitive CSS attribute matchers"
|
||||
skip "Nokogiri doesn't support case insensitive CSS attribute matchers"
|
||||
when /#click_button should follow permanent redirects that maintain method/
|
||||
skip "Rack < 2 doesn't support 308" if Gem.loaded_specs['rack'].version < Gem::Version.new('2.0.0')
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue