Patch #42422
Updated by Marius BĂLTEANU 14 days ago
# Problem The login step in the system test sometimes fails because the expected page load isn’t complete when the assertion is executed as follows. <pre> $ cd ../redmine && RAILS_ENV=test bin/rails redmine:plugins:test NAME=full_text_search # Running: ...............Capybara starting Puma... * Version 6.6.0 , codename: Return to Forever * Min threads: 0, max threads: 4 * Listening on http://127.0.0.1:43813 .[Screenshot Image]: /home/runner/work/redmine_full_text_search/redmine/tmp/screenshots/failures_test_keep_search_target.png F Failure: FullTextSearch::SearchTest#test_keep_search_target [test/application_system_test_case.rb:79]: --- expected +++ actual @@ -1 +1 @@ -"/my/page" +"/login" rails test plugins/full_text_search/test/system/full_text_search/search_test.rb:58 ............SSS.......................................................................... Finished in 124.323414s, 0.8526 runs/s, 1.0778 assertions/s. 106 runs, 134 assertions, 1 failures, 0 errors, 3 skips </pre> ref: https://github.com/clear-code/redmine_full_text_search/actions/runs/13889360454/job/38858640197 ## Cause The test was using @assert_equal@ `assert_equal` to verify the current path immediately after form submission. Since @assert_equal@ `assert_equal` does not wait for the page to load fully, it leads to intermittent failures in environments where page rendering is slower. ## Solution Replace @assert_equal@ `assert_equal` with @assert_current_path@ `assert_current_path` in the login steps. This change leverages Capybara’s built-in waiting mechanism, ensuring that the test only proceeds once the browser has navigated to the expected page. ref: https://www.rubydoc.info/gems/capybara/Capybara%2FSessionMatchers:assert_current_path