Merge pull request #7901 from tchak/update-webdrivers
chore(webdriver): update
This commit is contained in:
commit
8eb42baba5
3 changed files with 36 additions and 24 deletions
2
Gemfile
2
Gemfile
|
@ -104,7 +104,7 @@ group :test do
|
||||||
gem 'shoulda-matchers', require: false
|
gem 'shoulda-matchers', require: false
|
||||||
gem 'timecop'
|
gem 'timecop'
|
||||||
gem 'vcr'
|
gem 'vcr'
|
||||||
gem 'webdrivers', '~> 4.0'
|
gem 'webdrivers'
|
||||||
gem 'webmock'
|
gem 'webmock'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
19
Gemfile.lock
19
Gemfile.lock
|
@ -162,7 +162,7 @@ GEM
|
||||||
rubyzip (>= 1.3.0, < 3)
|
rubyzip (>= 1.3.0, < 3)
|
||||||
charlock_holmes (0.7.7)
|
charlock_holmes (0.7.7)
|
||||||
chartkick (4.1.3)
|
chartkick (4.1.3)
|
||||||
childprocess (3.0.0)
|
childprocess (4.1.0)
|
||||||
choice (0.2.0)
|
choice (0.2.0)
|
||||||
chunky_png (1.4.0)
|
chunky_png (1.4.0)
|
||||||
clamav-client (3.2.0)
|
clamav-client (3.2.0)
|
||||||
|
@ -633,7 +633,7 @@ GEM
|
||||||
ruby-vips (2.1.4)
|
ruby-vips (2.1.4)
|
||||||
ffi (~> 1.12)
|
ffi (~> 1.12)
|
||||||
ruby2_keywords (0.0.5)
|
ruby2_keywords (0.0.5)
|
||||||
rubyzip (2.3.0)
|
rubyzip (2.3.2)
|
||||||
saml_idp (0.14.0)
|
saml_idp (0.14.0)
|
||||||
activesupport (>= 5.2)
|
activesupport (>= 5.2)
|
||||||
builder (>= 3.0)
|
builder (>= 3.0)
|
||||||
|
@ -660,9 +660,11 @@ GEM
|
||||||
scss_lint (0.59.0)
|
scss_lint (0.59.0)
|
||||||
sass (~> 3.5, >= 3.5.5)
|
sass (~> 3.5, >= 3.5.5)
|
||||||
selectize-rails (0.12.6)
|
selectize-rails (0.12.6)
|
||||||
selenium-webdriver (3.142.7)
|
selenium-webdriver (4.5.0)
|
||||||
childprocess (>= 0.5, < 4.0)
|
childprocess (>= 0.5, < 5.0)
|
||||||
rubyzip (>= 1.2.2)
|
rexml (~> 3.2, >= 3.2.5)
|
||||||
|
rubyzip (>= 1.2.2, < 3.0)
|
||||||
|
websocket (~> 1.0)
|
||||||
sentry-delayed_job (4.8.1)
|
sentry-delayed_job (4.8.1)
|
||||||
delayed_job (>= 4.0)
|
delayed_job (>= 4.0)
|
||||||
sentry-ruby-core (~> 4.8.1)
|
sentry-ruby-core (~> 4.8.1)
|
||||||
|
@ -766,10 +768,10 @@ GEM
|
||||||
activemodel (>= 6.0.0)
|
activemodel (>= 6.0.0)
|
||||||
bindex (>= 0.4.0)
|
bindex (>= 0.4.0)
|
||||||
railties (>= 6.0.0)
|
railties (>= 6.0.0)
|
||||||
webdrivers (4.5.0)
|
webdrivers (5.2.0)
|
||||||
nokogiri (~> 1.6)
|
nokogiri (~> 1.6)
|
||||||
rubyzip (>= 1.3.0)
|
rubyzip (>= 1.3.0)
|
||||||
selenium-webdriver (>= 3.0, < 4.0)
|
selenium-webdriver (~> 4.0)
|
||||||
webfinger (1.2.0)
|
webfinger (1.2.0)
|
||||||
activesupport
|
activesupport
|
||||||
httpclient (>= 2.4)
|
httpclient (>= 2.4)
|
||||||
|
@ -777,6 +779,7 @@ GEM
|
||||||
addressable (>= 2.3.6)
|
addressable (>= 2.3.6)
|
||||||
crack (>= 0.3.2)
|
crack (>= 0.3.2)
|
||||||
hashdiff (>= 0.4.0, < 2.0.0)
|
hashdiff (>= 0.4.0, < 2.0.0)
|
||||||
|
websocket (1.2.9)
|
||||||
websocket-driver (0.7.5)
|
websocket-driver (0.7.5)
|
||||||
websocket-extensions (>= 0.1.0)
|
websocket-extensions (>= 0.1.0)
|
||||||
websocket-extensions (0.1.5)
|
websocket-extensions (0.1.5)
|
||||||
|
@ -923,7 +926,7 @@ DEPENDENCIES
|
||||||
vite_rails
|
vite_rails
|
||||||
warden
|
warden
|
||||||
web-console
|
web-console
|
||||||
webdrivers (~> 4.0)
|
webdrivers
|
||||||
webmock
|
webmock
|
||||||
zipline
|
zipline
|
||||||
zxcvbn-ruby
|
zxcvbn-ruby
|
||||||
|
|
|
@ -4,18 +4,9 @@ require 'capybara/email/rspec'
|
||||||
require 'selenium/webdriver'
|
require 'selenium/webdriver'
|
||||||
|
|
||||||
Capybara.register_driver :chrome do |app|
|
Capybara.register_driver :chrome do |app|
|
||||||
Capybara::Selenium::Driver.new(app, browser: :chrome)
|
|
||||||
end
|
|
||||||
|
|
||||||
Capybara.register_driver :headless_chrome do |app|
|
|
||||||
options = Selenium::WebDriver::Chrome::Options.new
|
options = Selenium::WebDriver::Chrome::Options.new
|
||||||
options.add_argument('--no-sandbox') unless ENV['SANDBOX']
|
options.add_argument('--no-sandbox') unless ENV['SANDBOX']
|
||||||
options.add_argument('--headless') unless ENV['NO_HEADLESS']
|
options.add_argument('--mute-audio')
|
||||||
options.add_argument('--window-size=1440,900')
|
|
||||||
|
|
||||||
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(
|
|
||||||
chromeOptions: { args: ['disable-dev-shm-usage', 'disable-software-rasterizer', 'mute-audio', 'window-size=1440,900'] }
|
|
||||||
)
|
|
||||||
|
|
||||||
download_path = Capybara.save_path
|
download_path = Capybara.save_path
|
||||||
# Chromedriver 77 requires setting this for headless mode on linux
|
# Chromedriver 77 requires setting this for headless mode on linux
|
||||||
|
@ -23,10 +14,28 @@ Capybara.register_driver :headless_chrome do |app|
|
||||||
options.add_preference('download.default_directory', download_path)
|
options.add_preference('download.default_directory', download_path)
|
||||||
options.add_preference(:download, default_directory: download_path)
|
options.add_preference(:download, default_directory: download_path)
|
||||||
|
|
||||||
Capybara::Selenium::Driver.new(app,
|
Capybara::Selenium::Driver.new(app, browser: :chrome, options: options).tap do |driver|
|
||||||
browser: :chrome,
|
# Set download dir for Chrome < 77
|
||||||
desired_capabilities: capabilities,
|
driver.browser.download_path = download_path
|
||||||
options: options).tap do |driver|
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
Capybara.register_driver :headless_chrome do |app|
|
||||||
|
options = Selenium::WebDriver::Chrome::Options.new
|
||||||
|
options.add_argument('--no-sandbox') unless ENV['SANDBOX']
|
||||||
|
options.add_argument('--headless')
|
||||||
|
options.add_argument('--window-size=1440,900')
|
||||||
|
options.add_argument('--disable-dev-shm-usage')
|
||||||
|
options.add_argument('--disable-software-rasterizer')
|
||||||
|
options.add_argument('--mute-audio')
|
||||||
|
|
||||||
|
download_path = Capybara.save_path
|
||||||
|
# Chromedriver 77 requires setting this for headless mode on linux
|
||||||
|
# Different versions of Chrome/selenium-webdriver require setting differently - just set them all
|
||||||
|
options.add_preference('download.default_directory', download_path)
|
||||||
|
options.add_preference(:download, default_directory: download_path)
|
||||||
|
|
||||||
|
Capybara::Selenium::Driver.new(app, browser: :chrome, options: options).tap do |driver|
|
||||||
# Set download dir for Chrome < 77
|
# Set download dir for Chrome < 77
|
||||||
driver.browser.download_path = download_path
|
driver.browser.download_path = download_path
|
||||||
end
|
end
|
||||||
|
@ -53,7 +62,7 @@ RSpec.configure do |config|
|
||||||
end
|
end
|
||||||
|
|
||||||
config.before(:each, type: :system, js: true) do
|
config.before(:each, type: :system, js: true) do
|
||||||
driven_by :headless_chrome
|
driven_by ENV['NO_HEADLESS'] ? :chrome : :headless_chrome
|
||||||
end
|
end
|
||||||
|
|
||||||
# Set the user preferred language before Javascript system specs.
|
# Set the user preferred language before Javascript system specs.
|
||||||
|
|
Loading…
Reference in a new issue