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

(-)a/t/db_dependent/selenium/patrons_search.t (-19 / +19 lines)
Lines 411-416 subtest 'Search patrons' => sub { Link Here
411
411
412
        C4::Context->set_preference( 'dateformat', 'metric' );
412
        C4::Context->set_preference( 'dateformat', 'metric' );
413
413
414
        sub get_dob_search_filter {
415
            return $s->driver->find_element( '//table[@id="' . shift . '"]//th[@aria-label="Date of birth: activate to sort column ascending"]/input' );
416
        }
417
414
        # We have a patron with date of birth=1980-06-17 => formatted as 17/06/1980
418
        # We have a patron with date of birth=1980-06-17 => formatted as 17/06/1980
415
419
416
        $driver->get( $base_url . "/members/members-home.pl" );
420
        $driver->get( $base_url . "/members/members-home.pl" );
Lines 420-465 subtest 'Search patrons' => sub { Link Here
420
        sleep $DT_delay && $s->wait_for_ajax;
424
        sleep $DT_delay && $s->wait_for_ajax;
421
425
422
        $s->show_all_entries( '//div[@id="' . $table_id . '_wrapper"]' );
426
        $s->show_all_entries( '//div[@id="' . $table_id . '_wrapper"]' );
423
        my $dob_search_filter =
424
            $s->driver->find_element( '//table[@id="' . $table_id . '"]//input[@placeholder="Date of birth search"]' );
425
427
426
        $dob_search_filter->send_keys('1980');
428
        get_dob_search_filter($table_id)->send_keys('1980');
427
        sleep $DT_delay && $s->wait_for_ajax;
429
        sleep $DT_delay && $s->wait_for_ajax;
428
        my $patron_27 = Koha::Patrons->search( { surname => 'test_patron_27' } )->next;
430
        my $patron_27 = Koha::Patrons->search( { surname => 'test_patron_27' } )->next;
429
        is( is_patron_shown($patron_27), 1, 'search by correct year shows the patron' );
431
        is( is_patron_shown($patron_27), 1, 'search by correct year shows the patron' );
430
        $dob_search_filter->clear;
432
        get_dob_search_filter($table_id)->clear;
431
        $dob_search_filter = $s->driver->find_element( '//table[@id="' . $table_id . '"]//input[@placeholder="Date of birth search"]' );
432
433
433
        $dob_search_filter->send_keys('1986');
434
        get_dob_search_filter($table_id)->send_keys('1986');
434
        sleep $DT_delay && $s->wait_for_ajax;
435
        sleep $DT_delay && $s->wait_for_ajax;
435
        is( is_patron_shown($patron_27), 0, 'search by incorrect year does not show the patron' );
436
        is( is_patron_shown($patron_27), 0, 'search by incorrect year does not show the patron' );
436
        $dob_search_filter->clear;
437
        get_dob_search_filter($table_id)->clear;
437
        $dob_search_filter = $s->driver->find_element( '//table[@id="' . $table_id . '"]//input[@placeholder="Date of birth search"]' );
438
438
439
        $dob_search_filter->send_keys('1980-06');
439
        get_dob_search_filter($table_id)->send_keys('1980-06');
440
        sleep $DT_delay && $s->wait_for_ajax;
440
        sleep $DT_delay && $s->wait_for_ajax;
441
        is( is_patron_shown($patron_27), 1, 'search by correct year-month shows the patron' );
441
        is( is_patron_shown($patron_27), 1, 'search by correct year-month shows the patron' );
442
        $dob_search_filter->clear;
442
        get_dob_search_filter($table_id)->clear;
443
443
444
        $dob_search_filter->send_keys('1980-06-17');
444
        get_dob_search_filter($table_id)->send_keys('1980-06-17');
445
        sleep $DT_delay && $s->wait_for_ajax;
445
        sleep $DT_delay && $s->wait_for_ajax;
446
        is( is_patron_shown($patron_27), 1, 'search by correct full iso date shows the patron' );
446
        is( is_patron_shown($patron_27), 1, 'search by correct full iso date shows the patron' );
447
        $dob_search_filter->clear;
447
        get_dob_search_filter($table_id)->clear;
448
448
449
        $dob_search_filter->send_keys('1986-06-17');
449
        get_dob_search_filter($table_id)->send_keys('1986-06-17');
450
        sleep $DT_delay && $s->wait_for_ajax;
450
        sleep $DT_delay && $s->wait_for_ajax;
451
        is( is_patron_shown($patron_27), 0, 'search by incorrect full iso date does not show the patron' );
451
        is( is_patron_shown($patron_27), 0, 'search by incorrect full iso date does not show the patron' );
452
        $dob_search_filter->clear;
452
        get_dob_search_filter($table_id)->clear;
453
453
454
        $dob_search_filter->send_keys('17/06/1980');
454
        get_dob_search_filter($table_id)->send_keys('17/06/1980');
455
        sleep $DT_delay && $s->wait_for_ajax;
455
        sleep $DT_delay && $s->wait_for_ajax;
456
        is( is_patron_shown($patron_27), 1, 'search by correct full formatted date shows the patron' );
456
        is( is_patron_shown($patron_27), 1, 'search by correct full formatted date shows the patron' );
457
        $dob_search_filter->clear;
457
        get_dob_search_filter($table_id)->clear;
458
458
459
        $dob_search_filter->send_keys('17/06/1986');
459
        get_dob_search_filter($table_id)->send_keys('17/06/1986');
460
        sleep $DT_delay && $s->wait_for_ajax;
460
        sleep $DT_delay && $s->wait_for_ajax;
461
        is( is_patron_shown($patron_27), 0, 'search by incorrect full formatted date does not show the patron' );
461
        is( is_patron_shown($patron_27), 0, 'search by incorrect full formatted date does not show the patron' );
462
        $dob_search_filter->clear;
462
        get_dob_search_filter($table_id)->clear;
463
463
    };
464
    };
464
465
465
    teardown();
466
    teardown();
466
- 

Return to bug 28633