This patch adds a wait_for_server_ready check to t::lib::Selenium, so
Selenium-based tests poll the server until it responds successfully
before driving it, instead of assuming it is already up.
This guards against a race we saw on Jenkins CI:
t/db_dependent/selenium/00-onboarding.t and
t/db_dependent/selenium/01-installation.t both failed with 'no such
element: //div[@class="alert alert-success"]' right after the DB
connection check step, immediately after run_tests.pl's
get_commands_to_reset_db() restarted Apache/Plack. That helper
restarts services and moves straight to running the tests with no
readiness wait, so the very first requests can hit workers that are
still warming up. The test then fails on a missing page element even
though there is no bug in the installer flow itself.
A companion issue has been filed against koha-misc4dev to add a
readiness wait to run_tests.pl itself:
https://gitlab.com/koha-community/koha-misc4dev/-/work_items/108
Test plan:
1. Apply the patch
2. Run t/db_dependent/selenium/01-installation.t (or 00-onboarding.t)
against a fresh empty database with KOHA_TESTING=1, as usual
3. Confirm it still passes normally
4. To exercise the new wait: drop/recreate the database, then run
"sudo service apache2 restart" and "sudo service koha-common
restart", then immediately run the selenium test with no delay.
Confirm it either passes (server came up in time) or fails fast
with a clear "Cannot wait more for the server to be ready" message
rather than a confusing missing-element error deep in the install
wizard
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>