1
0
Fork 0
mirror of https://github.com/teamcapybara/capybara.git synced 2022-11-09 12:08:07 -05:00

Skip shadow root specs for Selenium versions that do not support it

This commit is contained in:
Matijs van Zuijlen 2022-11-06 19:11:06 +01:00 committed by Thomas Walpole
parent 48fe7018ed
commit 51d6982705
3 changed files with 13 additions and 0 deletions

View file

@ -87,6 +87,8 @@ Capybara::SpecHelper.run_specs TestSessions::Chrome, CHROME_DRIVER.to_s, capybar
pending "Chrome headless doesn't support maximize" if ENV['HEADLESS']
when /Capybara::Session selenium_chrome node #shadow_root should get visible text/
pending "Selenium doesn't currently support getting visible text for shadow root elements"
when /Capybara::Session selenium_chrome node #shadow_root/
skip 'Not supported with this Selenium version' if selenium_lt?('4.1', @session)
end
end

View file

@ -82,6 +82,8 @@ Capybara::SpecHelper.run_specs TestSessions::SeleniumFirefox, 'selenium', capyba
pending 'Not sure what firefox is doing here'
when /Capybara::Session selenium_chrome node #shadow_root should get visible text/
pending "Selenium doesn't currently support getting visible text for shadow root elements"
when /Capybara::Session selenium node #shadow_root/
skip 'Not supported with this Selenium version' if selenium_lt?('4.1', @session)
end
end

View file

@ -45,6 +45,15 @@ module Capybara
chrome?(session) && (chrome_version(session) >= version)
end
def selenium?(session)
session.driver.is_a? Capybara::Selenium::Driver
end
def selenium_lt?(version, session)
selenium?(session) &&
Gem::Version.new(::Selenium::WebDriver::VERSION) < Gem::Version.new(version)
end
def edge?(session)
browser_name(session).to_s.start_with?('edge')
end