Bug 41604: (follow-up) Wait for the page to be ready before searching in patrons_search.t

Bug 41604 made every page do a bit more work when it loads. This
Selenium test didn't wait for that work to finish before typing into
the search box, so sometimes it searched too early and got the wrong
results.

This adds a short wait after each page load so the test only searches
once the page is actually ready.

Introduced by: Bug 41604: Save user decision per column when visibility changes

Test plan:
prove t/db_dependent/selenium/patrons_search.t

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Pedro Amorim 2026-07-21 14:40:16 +00:00 committed by Lucas Gass
parent fc78093a72
commit e1fe0bbf57
No known key found for this signature in database
GPG Key ID: 60B447398B0D36CA
1 changed files with 6 additions and 0 deletions

View File

@ -283,6 +283,7 @@ subtest 'Search patrons' => sub {
# NOTE: We should probably ensure the bad field is removed from 'standard' search here, else searches are broken
C4::Context->set_preference( 'DefaultPatronSearchFields', "" );
$driver->get( $base_url . "/members/members-home.pl" );
sleep $DT_delay && $s->wait_for_ajax;
$s->fill_form( { 'search_patron_filter' => 'test_patron' } );
$s->submit_form;
my $first_patron = Koha::Patrons->search( { surname => { like => 'test_patron_%' } } )->next;
@ -325,6 +326,7 @@ subtest 'Search patrons' => sub {
);
$driver->get( $base_url . "/members/members-home.pl" );
sleep $DT_delay && $s->wait_for_ajax;
$s->fill_form( { 'search_patron_filter' => 'test_patron' } );
$s->submit_form;
sleep $DT_delay && $s->wait_for_ajax;
@ -465,6 +467,7 @@ subtest 'Search patrons' => sub {
$patron_category->replace_library_limits( [ $library->id ] );
C4::Context->set_preference( 'PatronsPerPage', 5 );
$driver->get( $base_url . "/members/members-home.pl" );
sleep $DT_delay && $s->wait_for_ajax;
clear_filters();
$s->fill_form( { 'search_patron_filter' => 'test_patron' } );
$s->submit_form;
@ -486,6 +489,7 @@ subtest 'Search patrons' => sub {
C4::Context->set_preference( 'PatronsPerPage', 5 );
$driver->get( $base_url . "/members/members-home.pl" );
sleep $DT_delay && $s->wait_for_ajax;
clear_filters();
$s->fill_form( { 'search_patron_filter' => 'test_patron' } );
$s->submit_form;
@ -511,6 +515,7 @@ subtest 'Search patrons' => sub {
# Perform another search
$driver->get( $base_url . "/members/members-home.pl" );
sleep $DT_delay && $s->wait_for_ajax;
clear_filters();
$s->fill_form( { 'search_patron_filter' => 'test_patron' } );
$s->submit_form;
@ -547,6 +552,7 @@ subtest 'Search patrons' => sub {
# We have a patron with date of birth=1980-06-17 => formatted as 17/06/1980
$driver->get( $base_url . "/members/members-home.pl" );
sleep $DT_delay && $s->wait_for_ajax;
clear_filters();
$s->fill_form( { 'search_patron_filter' => 'test_patron' } );
$s->submit_form;