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
11 changes: 0 additions & 11 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,6 @@ jobs:
DATABASE_URL: "postgres://postgres:postgres@localhost:5432/forms_runner_test"
QUEUE_DATABASE_URL: "postgres://postgres:postgres@localhost:5432/forms_runner_test_queue"
steps:
# TODO: remove these steps once we can use latest Chrome again (see https://github.com/teamcapybara/capybara/issues/2800)
- uses: nanasess/setup-chromedriver@e913548694400f275b4070efcd90f47dbbc8914c # v3.0.0
with:
chromedriver-version: '128.0.6613.8600'
chromeapp: chrome
- run: |
sudo apt-get purge google-chrome-stable
- uses: browser-actions/setup-chrome@2e1d749697dd1612b833dba4a722266286fbefcd # v2.1.2
with:
chrome-version: 128
install-chromedriver: 'false'
- name: Checkout code
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
# Add or replace dependency steps here
Expand Down
34 changes: 34 additions & 0 deletions spec/support/selenium_error_patch.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Monkey patch for a specific intermittent Selenium error.
#
# Intermittently, Selenium/Chromedriver raises `Selenium::WebDriver::Error::UnknownError`
# with the message "Node with given id does not belong to the document".

# Capybara's automatic waiting/retrying mechanism doesn't catch it,
# leading to failure.
#
# We intercept the initialization of `UnknownError`. If the message matches this specific
# case, we raise a `StaleElementReferenceError` instead. This uses Capybara's
# retry logic which makes doesn't fail the test
#
# This can be removed once the following issue is resolved:
# https://github.com/teamcapybara/capybara/issues/2800
#
# taken from the following issue:
# https://github.com/teamcapybara/capybara/issues/2800#issuecomment-3049956982

module Selenium
module WebDriver
module Error
class UnknownError
alias_method :old_initialize, :initialize
def initialize(msg = nil)
if msg&.include?("Node with given id does not belong to the document")
raise StaleElementReferenceError, msg
end

old_initialize(msg)
end
end
end
end
end