Test: Fix Breaking Features Tests by aaronskiba · Pull Request #3489 · DMPRoadmap/roadmap

@aaronskiba

- Moved all Capybara settings into `spec/support/capybara.rb` to centralize test configuration.
- Use `Capybara.default_driver = :rack_test` (prior to this, `spec/rails_helper.rb` was overriding the assignment)
- Use `Capybara.javascript_driver = :selenium_chrome_headless_custom` (previously defined in `spec/rails_helper.rb`)
- Use `Capybara.default_max_wait_time = 10`

@aaronskiba

- These changes address the Chrome 134 breaking changes (#3485).
- Added `expect` statements to ensure that page loads are completing successfully.
  - The `expect(page).to have_current_path(%r{#{org_admin_templates_path}/\d+})` statements help verify the page load.
  - It would be better to implement a notification such as "Customised template created successfully." and use that to verify the page load.
- These changes should be revisited (and possibly reverted) when a fix is available for these breaking changes via Chrome, Capybara, or Selenium.
- This code change allows Capybara to retry an action when the following error is encountered:
```
Selenium::WebDriver::Error::UnknownError:
unknown error: unhandled inspector error: {"code":-32000,"message":"Node with given id does not belong to the document"}
```
- An example of this error can be seen here (https://github.com/DMPRoadmap/roadmap/actions/runs/13951080715/job/39050483020)
- This handling has been added to address the breaking changes encountered between Chrome 134 and our features tests (#3485)

@aaronskiba