From 7dde89ff540f78ceaaaae723e0ba6b853cd5f65d Mon Sep 17 00:00:00 2001 From: Robert Fletcher Date: Sun, 21 Jun 2026 10:51:44 -0700 Subject: [PATCH] Flake: prevent axe-core from setting page load timeout --- spec/support/axe_core.rb | 10 ++++++++++ spec/support/capybara.rb | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/spec/support/axe_core.rb b/spec/support/axe_core.rb index 42d48805d..4879e1fbf 100644 --- a/spec/support/axe_core.rb +++ b/spec/support/axe_core.rb @@ -37,4 +37,14 @@ def check_accessibility(a11y_skip:) RSpec.configure do |config| config.include(AccessibilityOverrides, type: :system) + + # axe-core-api shrinks the Selenium page_load timeout to 1s while it runs + # (lib/axe/api/run.rb), which intermittently fails under CI load with + # "Navigation timed out after 1000 ms". Neutralize the setter so it can't. + # https://github.com/dequelabs/axe-core-gems/issues/386 + config.before(:each, type: :system) do + page.driver.browser.manage.timeouts.instance_eval do + def page_load=(*); end + end + end end diff --git a/spec/support/capybara.rb b/spec/support/capybara.rb index 326814be8..1ccbb4d25 100644 --- a/spec/support/capybara.rb +++ b/spec/support/capybara.rb @@ -11,7 +11,7 @@ using = ENV.fetch("DRIVER", :firefox).to_sym RSpec.configure do |config| - config.before(:each, type: :system) do + config.prepend_before(:each, type: :system) do driven_by(:selenium, using:) do |driver| driver.add_preference("browser.download.folderList", 2) driver.add_preference("browser.download.manager.showWhenStarting", false)