|
Lines 54-60
my $schema = Koha::Database->schema;
Link Here
|
| 54 |
subtest 'Search patrons' => sub { |
54 |
subtest 'Search patrons' => sub { |
| 55 |
plan tests => 25; |
55 |
plan tests => 25; |
| 56 |
|
56 |
|
| 57 |
if ( Koha::Patrons->search({surname => {-like => "test_patron_%"}})->count ) { |
57 |
if ( Koha::Patrons->search({surname => {-like => "test.patron.%"}})->count ) { |
| 58 |
BAIL_OUT("Cannot run this test, data we need to create already exist in the DB"); |
58 |
BAIL_OUT("Cannot run this test, data we need to create already exist in the DB"); |
| 59 |
} |
59 |
} |
| 60 |
my @patrons; |
60 |
my @patrons; |
|
Lines 81-87
subtest 'Search patrons' => sub {
Link Here
|
| 81 |
{ |
81 |
{ |
| 82 |
class => 'Koha::Patrons', |
82 |
class => 'Koha::Patrons', |
| 83 |
value => { |
83 |
value => { |
| 84 |
surname => "test_patron_" . $i++, |
84 |
surname => "test.patron." . $i++, |
| 85 |
firstname => $firstname, |
85 |
firstname => $firstname, |
| 86 |
categorycode => $patron_category->categorycode, |
86 |
categorycode => $patron_category->categorycode, |
| 87 |
branchcode => $library->branchcode, |
87 |
branchcode => $library->branchcode, |
|
Lines 98-104
subtest 'Search patrons' => sub {
Link Here
|
| 98 |
class => 'Koha::Patrons', |
98 |
class => 'Koha::Patrons', |
| 99 |
value => { |
99 |
value => { |
| 100 |
surname => "test", |
100 |
surname => "test", |
| 101 |
firstname => "not_p_a_t_r_o_n", # won't match 'patron' |
101 |
firstname => "not._patr0n", # won't match 'patron' |
| 102 |
categorycode => $patron_category->categorycode, |
102 |
categorycode => $patron_category->categorycode, |
| 103 |
branchcode => $library->branchcode, |
103 |
branchcode => $library->branchcode, |
| 104 |
borrowernotes => $borrowernotes, |
104 |
borrowernotes => $borrowernotes, |
|
Lines 116-122
subtest 'Search patrons' => sub {
Link Here
|
| 116 |
{ |
116 |
{ |
| 117 |
class => 'Koha::Patrons', |
117 |
class => 'Koha::Patrons', |
| 118 |
value => { |
118 |
value => { |
| 119 |
surname => "test_patron_26", |
119 |
surname => "test.patron.26", |
| 120 |
firstname => $firstname, |
120 |
firstname => $firstname, |
| 121 |
categorycode => $patron_category->categorycode, |
121 |
categorycode => $patron_category->categorycode, |
| 122 |
branchcode => $library_2->branchcode, |
122 |
branchcode => $library_2->branchcode, |
|
Lines 182-188
subtest 'Search patrons' => sub {
Link Here
|
| 182 |
# NOTE: We should probably ensure the bad field is removed from 'standard' search here, else searches are broken |
182 |
# NOTE: We should probably ensure the bad field is removed from 'standard' search here, else searches are broken |
| 183 |
C4::Context->set_preference('DefaultPatronSearchFields',""); |
183 |
C4::Context->set_preference('DefaultPatronSearchFields',""); |
| 184 |
$driver->get( $base_url . "/members/members-home.pl" ); |
184 |
$driver->get( $base_url . "/members/members-home.pl" ); |
| 185 |
$s->fill_form( { search_patron_filter => 'test_patron' } ); |
185 |
$s->fill_form( { search_patron_filter => 'test.patron' } ); |
| 186 |
$s->submit_form; |
186 |
$s->submit_form; |
| 187 |
my $first_patron = $patrons[0]; |
187 |
my $first_patron = $patrons[0]; |
| 188 |
|
188 |
|
|
Lines 219-229
subtest 'Search patrons' => sub {
Link Here
|
| 219 |
); |
219 |
); |
| 220 |
|
220 |
|
| 221 |
$driver->get( $base_url . "/members/members-home.pl" ); |
221 |
$driver->get( $base_url . "/members/members-home.pl" ); |
| 222 |
$s->fill_form( { search_patron_filter => 'test_patron' } ); |
222 |
$s->fill_form( { search_patron_filter => 'test.patron' } ); |
| 223 |
$s->submit_form; |
223 |
$s->submit_form; |
| 224 |
$s->wait_for_ajax; |
224 |
$s->wait_for_ajax; |
| 225 |
|
225 |
|
| 226 |
$s->driver->find_element('//*[@id="'.$table_id.'_filter"]//input')->send_keys('test_patron'); |
226 |
$s->driver->find_element('//*[@id="'.$table_id.'_filter"]//input')->send_keys('test.patron'); |
| 227 |
$s->wait_for_ajax; |
227 |
$s->wait_for_ajax; |
| 228 |
is( $driver->find_element('//div[@id="'.$table_id.'_info"]')->get_text, sprintf('Showing 1 to %s of %s entries (filtered from %s total entries)', $PatronsPerPage, 26, $total_number_of_patrons), 'Searching in standard brings back correct results' ); |
228 |
is( $driver->find_element('//div[@id="'.$table_id.'_info"]')->get_text, sprintf('Showing 1 to %s of %s entries (filtered from %s total entries)', $PatronsPerPage, 26, $total_number_of_patrons), 'Searching in standard brings back correct results' ); |
| 229 |
|
229 |
|
|
Lines 267-273
subtest 'Search patrons' => sub {
Link Here
|
| 267 |
|
267 |
|
| 268 |
# Refine search and search for test_patron in all the data using the DT global search |
268 |
# Refine search and search for test_patron in all the data using the DT global search |
| 269 |
# No change in result expected, still 2 patrons |
269 |
# No change in result expected, still 2 patrons |
| 270 |
$s->driver->find_element('//*[@id="'.$table_id.'_filter"]//input')->send_keys('test_patron'); |
270 |
$s->driver->find_element('//*[@id="'.$table_id.'_filter"]//input')->send_keys('test.patron'); |
| 271 |
$s->wait_for_ajax; |
271 |
$s->wait_for_ajax; |
| 272 |
is( $driver->find_element('//div[@id="'.$table_id.'_info"]')->get_text, sprintf('Showing 1 to %s of %s entries (filtered from %s total entries)', 2, 2, $total_number_of_patrons), 'Refining with DataTables search works to further filter the original query' ); |
272 |
is( $driver->find_element('//div[@id="'.$table_id.'_info"]')->get_text, sprintf('Showing 1 to %s of %s entries (filtered from %s total entries)', 2, 2, $total_number_of_patrons), 'Refining with DataTables search works to further filter the original query' ); |
| 273 |
|
273 |
|
|
Lines 283-289
subtest 'Search patrons' => sub {
Link Here
|
| 283 |
|
283 |
|
| 284 |
C4::Context->set_preference( 'PatronsPerPage', 5 ); |
284 |
C4::Context->set_preference( 'PatronsPerPage', 5 ); |
| 285 |
$driver->get( $base_url . "/members/members-home.pl" ); |
285 |
$driver->get( $base_url . "/members/members-home.pl" ); |
| 286 |
$s->fill_form( { search_patron_filter => 'test_patron' } ); |
286 |
$s->fill_form( { search_patron_filter => 'test.patron' } ); |
| 287 |
$s->submit_form; |
287 |
$s->submit_form; |
| 288 |
$s->wait_for_ajax; |
288 |
$s->wait_for_ajax; |
| 289 |
my $patron_selected_text = $driver->find_element('//div[@id="patron_search_selected"]/span')->get_text; |
289 |
my $patron_selected_text = $driver->find_element('//div[@id="patron_search_selected"]/span')->get_text; |
|
Lines 309-315
subtest 'Search patrons' => sub {
Link Here
|
| 309 |
|
309 |
|
| 310 |
# Perform another search |
310 |
# Perform another search |
| 311 |
$driver->get( $base_url . "/members/members-home.pl" ); |
311 |
$driver->get( $base_url . "/members/members-home.pl" ); |
| 312 |
$s->fill_form( { search_patron_filter => 'test_patron' } ); |
312 |
$s->fill_form( { search_patron_filter => 'test.patron' } ); |
| 313 |
$s->submit_form; |
313 |
$s->submit_form; |
| 314 |
$s->wait_for_ajax; |
314 |
$s->wait_for_ajax; |
| 315 |
$patron_selected_text = $driver->find_element('//div[@id="patron_search_selected"]/span')->get_text; |
315 |
$patron_selected_text = $driver->find_element('//div[@id="patron_search_selected"]/span')->get_text; |
| 316 |
- |
|
|