is( scalar @adv_options, 12, 'Invalid option not added when DefaultPatronSearchFields is populated with an invalid field');
is( scalar @filter_options, 12, 'Invalid filter option not added when DefaultPatronSearchFields is populated with an invalid field');
C4::Context->set_preference('DefaultPatronSearchFields',"");
- $s->fill_form( { searchmember_filter => 'test_patron' } );
+ $s->fill_form( { search_patron_filter => 'test_patron' } );
$s->submit_form;
my $first_patron = $patrons[0];
+ $s->wait_for_datatable_visible('//table[@id="memberresultst"]');
my @td = $driver->find_elements('//table[@id="memberresultst"]/tbody/tr/td');
like ($td[2]->get_text, qr[\Q$firstname\E],
'Column "Name" should be the 3rd and contain the firstname correctly filtered'
like ($td[2]->get_text, qr[\Q$email\E],
'Column "Name" should be the 3rd and contain the email address correctly filtered'
);
- is( $td[5]->get_text, $branchname,
+ is( $td[4]->get_text, $branchname,
'Column "Library" should be the 6th and contain the html tags - they have been html filtered'
);
is( $td[9]->get_text, $borrowernotes_displayed,
return $elt;
}
+sub wait_for_datatable_visible {
+ my ( $self, $xpath_selector ) = @_;
+
+ my ($visible, $elt);
+ $self->remove_error_handler;
+ my $max_retries = $self->max_retries;
+ my $i;
+ while ( not $visible ) {
+ $elt = eval {$self->driver->find_element($xpath_selector . '//td[class="dataTables_empty"]')};
+ $visible = $elt && $elt->get_text ne 'No data available in table';
+ $self->driver->pause(1000) unless $visible;
+
+ die "Cannot wait more for element '$xpath_selector' to be visible"
+ if $max_retries <= ++$i
+ }
+ $self->add_error_handler;
+ return $elt;
+}
+
sub show_all_entries {
my ( $self, $xpath_selector ) = @_;