Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ruby '3.2.4'
gem 'rails', '~> 7.2.2.1'
gem 'puma', '~> 6.6' # roar
gem 'sdoc', '~> 2.6.0', group: :doc
gem 'nokogiri', '>= 1.13.4'
gem 'nokogiri', '>= 1.18.9'
gem 'tzinfo-data', require: false
gem 'bootsnap', '>= 1.4.2', require: false
gem 'rexml' # not a ruby default in 3, but a requirement of bootsnap
Expand Down
8 changes: 4 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ GEM
minitest (> 1.2.0)
rails (>= 2.3.3)
mini_mime (1.1.5)
mini_portile2 (2.8.8)
mini_portile2 (2.8.9)
minitest (5.25.5)
minitest-optional_retry (0.0.2)
minitest (~> 5.0)
Expand All @@ -257,10 +257,10 @@ GEM
net-smtp (0.5.1)
net-protocol
nio4r (2.7.4)
nokogiri (1.18.8)
nokogiri (1.18.9)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
nokogiri (1.18.8-x86_64-linux-gnu)
nokogiri (1.18.9-x86_64-linux-gnu)
racc (~> 1.4)
oauth2 (2.0.9)
faraday (>= 0.17.3, < 3.0)
Expand Down Expand Up @@ -524,7 +524,7 @@ DEPENDENCIES
net-imap
net-pop
net-smtp
nokogiri (>= 1.13.4)
nokogiri (>= 1.18.9)
omniauth-google-oauth2 (~> 1.2.1)
omniauth-rails_csrf_protection (~> 1.0)
paper_trail (~> 16.0)
Expand Down
42 changes: 34 additions & 8 deletions test/application_system_test_case.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,45 @@
require 'test_helper'
require 'integration_helper'
require 'capybara/rails'
require 'capybara/selenium/driver'

# Set systemtest behavior
class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
include IntegrationHelper
include OmniauthMocker

# Configure webdrivers to use the latest compatible version
#Webdrivers::Chromedriver.update

# Explicitly register a selenium chrome headless driver
Capybara.register_driver :headless_chrome do |app|
chrome_options = Selenium::WebDriver::Chrome::Options.new(
args: [
'--headless=new',
'--disable-gpu',
'--no-sandbox',
'--disable-dev-shm-usage',
'--disable-site-isolation-trials',
'--disable-background-timer-throttling',
'--disable-backgrounding-occluded-windows',
'--disable-renderer-backgrounding'
]
)

Capybara::Selenium::Driver.new(
app,
browser: :chrome,
options: chrome_options
)
end

# Conditionally select driver based on environment
if ENV['GITHUB_WORKFLOW'] || ENV['DOCKER']
driven_by :selenium, using: :headless_chrome
else
driven_by :selenium, using: :chrome
end

before do
Capybara.reset_sessions!
PaperTrail.enabled = true
Expand All @@ -16,12 +50,4 @@ class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
PaperTrail.enabled = false
PaperTrail.request.enabled = false
end

# if in CI, run system tests headlessly.
browser = ENV['GITHUB_WORKFLOW'] ? :headless_chrome : :chrome

# if in docker, run headless firefox
browser = ENV['DOCKER'] ? :headless_firefox : browser

driven_by :selenium, using: browser
end
Loading