Koha-clms/t/lib
Martin Renvoize 106fabbf9a
Bug 43669: Make t::lib::Selenium wait for the server to be ready
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>
2026-09-29 16:03:56 +00:00
..
IdP Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Koha/BackgroundJob Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
Mocks Bug 40947: Remove warning "Aborted connection" from t/db_dependent/www/search_utf8.t 2026-02-06 15:17:12 -07:00
QA Bug 41076: Adjust our perl tidiness for v20250105 2026-02-05 09:03:51 -07:00
bad_plugins/Koha/Plugin Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
plugins/Koha/Plugin Bug 41648: Validate plugin date metadata 2026-08-21 14:31:48 +00:00
plugins_bad/Koha/Plugin Bug 41648: Validate plugin date metadata 2026-08-21 14:31:48 +00:00
Bootstrap.pm Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Dates.pm Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Mocks.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
Selenium.pm Bug 43669: Make t::lib::Selenium wait for the server to be ready 2026-09-29 16:03:56 +00:00
TestBuilder.pm Bug 36506: Adjust existing tests and test builder 2026-02-27 11:38:47 -07:00