Defect #44809
openSystem tests fail with Chrome 158 because Capybara cannot reset sessions
Description
Since Chrome 158, many system tests fail, both locally and on GitHub Actions:
https://github.com/redmine/redmine/actions/runs/46119154831/job/140899606752
This is caused by an incompatibility between Capybara 3.40.0 and Chrome 158: https://github.com/teamcapybara/capybara/issues/2865
After each test, Capybara resets the session by sending Storage.clearDataForOrigin with the origin *. Chrome 158 rejects it with "invalid argument: * is not a valid URL". As a result, the cookies are not cleared, and the next test starts logged in.
A version of Capybara that fixes this has not been released yet. The attached patch works around the problem in ApplicationSystemTestCase. It clears the cookies with Network.clearBrowserCookies, and the other storage with the origin of the application. It has no effect once Capybara stops sending the origin *, and should be removed when a fixed version is released.
Files
No data to display