Skip to content

Conversation

@bshand
Copy link
Contributor

@bshand bshand commented Oct 13, 2025

This fixes intermittent errors "Node with given id does not belong to the document" by duplicating the monkey patch from alphagov/forms-admin@5ea9876#diff-c36c07a0c7f499b1b95634f9dce1a10ebf4d10a9dee872f39f746a9efa555ddbR1-R34
This is needed until teamcapybara/capybara#2800 is fixed.

The bundle audit warning is fixed separately on PR #158.

The test failures are all integration tests, and can be ignored: recent chrome driver changes have made the integration tests very brittle, but the front-end is no longer in use (and the code for it is probably still working fine anyway).

@bshand bshand marked this pull request as draft October 13, 2025 09:10
Our feature tests using Capybara and Chromedriver are intermittently
failing with the following error:

unknown error: unhandled inspector error: {"code":-32000,"message":"Node with given id does not
belong to the document"}

This can usually be fixed by rerunning the tests.

In our CI environments and end-to-end tests we pin chrome to 128 where
the issue doesn't occur.

It's harder to pin chrome in local development environments.

This commit takes a different approach found in a comment on the
capabara issue: It adds a monkey patch to the Selenium driver to
intercept the initialization of `UnknownError` and raise a
`StaleElementReferenceError` instead.

This makes the test retry.

This commit can be reverted once the issue is resolved.

teamcapybara/capybara#2800
@bshand bshand force-pushed the bugfix/fix_brittle_tests_20251013 branch from d43bdb1 to 6bf051b Compare October 13, 2025 09:15
@bshand bshand marked this pull request as ready for review October 13, 2025 09:58
@bshand bshand merged commit 65170ef into develop Oct 13, 2025
10 of 15 checks passed
@bshand bshand deleted the bugfix/fix_brittle_tests_20251013 branch October 13, 2025 10:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants