View | Details | Raw Unified | Return to bug 33484
Collapse All | Expand All

(-)a/t/db_dependent/selenium/patrons_search.t (-11 / +15 lines)
Lines 280-285 subtest 'Search patrons' => sub { Link Here
280
    $s->submit_form;
280
    $s->submit_form;
281
    sleep $DT_delay && $s->wait_for_ajax;
281
    sleep $DT_delay && $s->wait_for_ajax;
282
282
283
    clear_filters();
283
    $s->driver->find_element('//*[@id="'.$table_id.'_filter"]//input')->send_keys('test_patron');
284
    $s->driver->find_element('//*[@id="'.$table_id.'_filter"]//input')->send_keys('test_patron');
284
    sleep $DT_delay && $s->wait_for_ajax;
285
    sleep $DT_delay && $s->wait_for_ajax;
285
    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' );
286
    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' );
Lines 288-297 subtest 'Search patrons' => sub { Link Here
288
    sleep $DT_delay && $s->wait_for_ajax;
289
    sleep $DT_delay && $s->wait_for_ajax;
289
    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, 25, $total_number_of_patrons), 'Filtering on library works in combination with main search' );
290
    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, 25, $total_number_of_patrons), 'Filtering on library works in combination with main search' );
290
291
291
    # Reset the filters
292
    clear_filters();
292
    $driver->find_element('//form[@class="patron_search_form"]//*[@class="btn btn-default clear_search"]')->click();
293
    $s->submit_form;
294
    sleep $DT_delay && $s->wait_for_ajax;
295
293
296
    # And make sure all the patrons are present
294
    # And make sure all the patrons are present
297
    is( $driver->find_element('//div[@id="'.$table_id.'_info"]')->get_text, sprintf('Showing 1 to %s of %s entries', $PatronsPerPage, $total_number_of_patrons), 'Resetting filters works as expected' );
295
    is( $driver->find_element('//div[@id="'.$table_id.'_info"]')->get_text, sprintf('Showing 1 to %s of %s entries', $PatronsPerPage, $total_number_of_patrons), 'Resetting filters works as expected' );
Lines 313-320 subtest 'Search patrons' => sub { Link Here
313
311
314
    is( $driver->find_element('//div[@id="'.$table_id.'_info"]')->get_text, sprintf('No entries to show (filtered from %s total entries)', $total_number_of_patrons), 'Searching on a non-searchable attribute returns no results' );
312
    is( $driver->find_element('//div[@id="'.$table_id.'_info"]')->get_text, sprintf('No entries to show (filtered from %s total entries)', $total_number_of_patrons), 'Searching on a non-searchable attribute returns no results' );
315
313
316
    # clear form
314
    clear_filters();
317
    $driver->find_element('//form[@class="patron_search_form"]//*[@class="btn btn-default clear_search"]')->click();
318
315
319
    # Search on searchable attribute, we expect 2 patrons
316
    # Search on searchable attribute, we expect 2 patrons
320
    $s->fill_form( { 'search_patron_filter' => 'test_attr_2' } );
317
    $s->fill_form( { 'search_patron_filter' => 'test_attr_2' } );
Lines 323-330 subtest 'Search patrons' => sub { Link Here
323
320
324
    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), 'Searching on a searchable attribute returns correct results' );
321
    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), 'Searching on a searchable attribute returns correct results' );
325
322
326
    # clear form
323
    clear_filters();
327
    $driver->find_element('//form[@class="patron_search_form"]//*[@class="btn btn-default clear_search"]')->click();
328
324
329
    $s->fill_form( { 'search_patron_filter' => 'test_attr_3' } ); # Terms must be split
325
    $s->fill_form( { 'search_patron_filter' => 'test_attr_3' } ); # Terms must be split
330
    $s->submit_form;
326
    $s->submit_form;
Lines 332-339 subtest 'Search patrons' => sub { Link Here
332
328
333
    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), 'Searching on a searchable attribute returns correct results' );
329
    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), 'Searching on a searchable attribute returns correct results' );
334
330
335
    # clear form
331
    clear_filters();
336
    $driver->find_element('//form[@class="patron_search_form"]//*[@class="btn btn-default clear_search"]')->click();
337
332
338
    # Search on searchable attribute as specific field, we expect 2 patrons
333
    # Search on searchable attribute as specific field, we expect 2 patrons
339
    $s->fill_form( { 'search_patron_filter' => 'test_attr_4' } );
334
    $s->fill_form( { 'search_patron_filter' => 'test_attr_4' } );
Lines 361-372 subtest 'Search patrons' => sub { Link Here
361
356
362
        C4::Context->set_preference( 'PatronsPerPage', 5 );
357
        C4::Context->set_preference( 'PatronsPerPage', 5 );
363
        $driver->get( $base_url . "/members/members-home.pl" );
358
        $driver->get( $base_url . "/members/members-home.pl" );
359
        clear_filters();
364
        $s->fill_form( { 'search_patron_filter' => 'test_patron' } );
360
        $s->fill_form( { 'search_patron_filter' => 'test_patron' } );
365
        $s->submit_form;
361
        $s->submit_form;
366
        sleep $DT_delay && $s->wait_for_ajax;
362
        sleep $DT_delay && $s->wait_for_ajax;
367
        my $patron_selected_text = $driver->find_element('//div[@id="table_search_selections"]/span')->get_text;
363
        my $patron_selected_text = $driver->find_element('//div[@id="table_search_selections"]/span')->get_text;
368
        is( $patron_selected_text, "", "Patrons selected is not displayed" );
364
        is( $patron_selected_text, "", "Patrons selected is not displayed" );
369
365
366
        $driver->capture_screenshot('selenium_xxx.png');
370
        my @checkboxes = $driver->find_elements(
367
        my @checkboxes = $driver->find_elements(
371
            '//input[@type="checkbox"][@name="borrowernumber"]');
368
            '//input[@type="checkbox"][@name="borrowernumber"]');
372
        $checkboxes[2]->click;
369
        $checkboxes[2]->click;
Lines 387-392 subtest 'Search patrons' => sub { Link Here
387
384
388
        # Perform another search
385
        # Perform another search
389
        $driver->get( $base_url . "/members/members-home.pl" );
386
        $driver->get( $base_url . "/members/members-home.pl" );
387
        clear_filters();
390
        $s->fill_form( { 'search_patron_filter' => 'test_patron' } );
388
        $s->fill_form( { 'search_patron_filter' => 'test_patron' } );
391
        $s->submit_form;
389
        $s->submit_form;
392
        sleep $DT_delay && $s->wait_for_ajax;
390
        sleep $DT_delay && $s->wait_for_ajax;
Lines 414-419 subtest 'Search patrons' => sub { Link Here
414
        # We have a patron with date of birth=1980-06-17 => formatted as 17/06/1980
412
        # We have a patron with date of birth=1980-06-17 => formatted as 17/06/1980
415
413
416
        $driver->get( $base_url . "/members/members-home.pl" );
414
        $driver->get( $base_url . "/members/members-home.pl" );
415
        clear_filters();
417
        $s->fill_form( { 'search_patron_filter' => 'test_patron' } );
416
        $s->fill_form( { 'search_patron_filter' => 'test_patron' } );
418
        $s->submit_form;
417
        $s->submit_form;
419
        sleep $DT_delay && $s->wait_for_ajax;
418
        sleep $DT_delay && $s->wait_for_ajax;
Lines 741-743 sub is_patron_shown { Link Here
741
    my @checkboxes = $driver->find_elements('//input[@type="checkbox"][@name="borrowernumber"]');
740
    my @checkboxes = $driver->find_elements('//input[@type="checkbox"][@name="borrowernumber"]');
742
    return scalar( grep { $_->get_value == $patron->borrowernumber } @checkboxes );
741
    return scalar( grep { $_->get_value == $patron->borrowernumber } @checkboxes );
743
}
742
}
744
- 
743
744
sub clear_filters {
745
    $driver->find_element('//form[@class="patron_search_form"]//*[@class="btn btn-default clear_search"]')->click();
746
    $s->submit_form;
747
    sleep $DT_delay && $s->wait_for_ajax;
748
}

Return to bug 33484