diff --git a/.ruby-version b/.ruby-version index c5106e6..2d2d681 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -4.0.4 +4.0.10 diff --git a/.tool-versions b/.tool-versions index 75d5860..7fa1ac0 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1,2 +1,2 @@ -ruby 4.0.4 +ruby 4.0.10 nodejs 24.18.0 diff --git a/Dockerfile b/Dockerfile index a1603af..ea81831 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # syntax=docker/dockerfile:1 -FROM ruby:4.0.4 +FROM ruby:4.0.10 RUN dpkg --add-architecture i386 \ && apt-get update -qq \ diff --git a/Gemfile.lock b/Gemfile.lock index 26b2ddf..98be963 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -453,7 +453,7 @@ DEPENDENCIES wkhtmltopdf-binary (= 0.12.3.1) RUBY VERSION - ruby 4.0.4 + ruby 4.0.10 BUNDLED WITH 4.0.15 diff --git a/Gemfile.next.lock b/Gemfile.next.lock index 26b2ddf..98be963 100644 --- a/Gemfile.next.lock +++ b/Gemfile.next.lock @@ -453,7 +453,7 @@ DEPENDENCIES wkhtmltopdf-binary (= 0.12.3.1) RUBY VERSION - ruby 4.0.4 + ruby 4.0.10 BUNDLED WITH 4.0.15 diff --git a/README.md b/README.md index c1d55d0..5afe8c9 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ You can see it working in https://audit.fastruby.io ## Requirements -- Ruby version `4.0.4` (see `.ruby-version` / `.tool-versions`) +- Ruby version `4.0.10` (see `.ruby-version` / `.tool-versions`) - Node version `24.18.0` (see `.tool-versions`) - Docker + Docker Compose (recommended for local development) diff --git a/test/application_system_test_case.rb b/test/application_system_test_case.rb index 38a39f5..188ba9a 100644 --- a/test/application_system_test_case.rb +++ b/test/application_system_test_case.rb @@ -36,6 +36,41 @@ Capybara::Selenium::Driver.new(app, browser: :chrome, options: options, service: service) end +# Capybara 3.40.0 clears storage with `origin: "*"`, which recent Chrome +# rejects. Clear the app server's origin instead. The version guard turns this +# off once a Capybara release with the fix is installed. +# https://github.com/teamcapybara/capybara/pull/2867 +# https://github.com/teamcapybara/capybara/pull/2868 +if Gem::Version.new(Capybara::VERSION) <= Gem::Version.new("3.40.0") + Capybara::Selenium::Driver::ChromeDriver.class_eval do + # Mirrors Capybara's upstream reset!, so keep its shape rather than splitting it up. + # :reek:TooManyStatements + def reset! + # Use instance variable directly so we avoid starting the browser just to reset the session + return unless @browser + + switch_to_window(window_handles.first) + window_handles.slice(1..).each { |win| close_window(win) } + return super if chromedriver_version < 73 + + timer = Capybara::Helpers.timer(expire_in: 10) + begin + clear_storage unless uniform_storage_clear? + @browser.navigate.to('about:blank') + wait_for_empty_page(timer) + rescue *unhandled_alert_errors + accept_unhandled_reset_alert + retry + end + + # base_url includes the random port Capybara's server listens on, which + # Storage.clearDataForOrigin needs to match the app's storage. + origin = Capybara.current_session.server&.base_url + execute_cdp('Storage.clearDataForOrigin', origin: origin, storageTypes: storage_types_to_clear) if origin + end + end +end + class ApplicationSystemTestCase < ActionDispatch::SystemTestCase driven_by :headless_chromium end