Bug 26162: Don't fall into an infinite loop

If something went wrong we do want to stop the script!

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit a0b5cefdc8)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit a29a9ec75408f135e070205fbd1868789b90b54b)
This commit is contained in:
Jonathan Druart 2020-08-19 07:19:09 +02:00 committed by Lucas Gass
parent 9b43f15602
commit eb6ab608d9
1 changed files with 7 additions and 1 deletions

View File

@ -187,7 +187,8 @@ sub show_all_entries {
$self->driver->find_element( $xpath_selector
. '//div[@class="dataTables_length"]/label/select/option[@value="-1"]'
)->click;
my ($all_displayed);
my ($all_displayed, $i);
my $max_retries = $self->max_retries;
while ( not $all_displayed ) {
my $dt_infos = $self->driver->get_text(
$xpath_selector . '//div[@class="dataTables_info"]' );
@ -197,6 +198,9 @@ sub show_all_entries {
}
$self->driver->pause(1000) unless $all_displayed;
die "Cannot show all entries from table $xpath_selector"
if $max_retries <= ++$i
}
}
@ -216,6 +220,8 @@ sub click_when_visible {
$elt->click unless $clicked; # finally Raise the error
}
sub max_retries { 10 }
=head1 NAME
t::lib::Selenium - Selenium helper module