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

(-)a/t/db_dependent/selenium/patrons_search.t (-2 / +78 lines)
Lines 145-150 sub setup { Link Here
145
      );
145
      );
146
    unshift @cleanup, $patron_27;
146
    unshift @cleanup, $patron_27;
147
147
148
    my $patron_28 = $builder->build_object(
149
        {
150
            class => 'Koha::Patrons',
151
            value => {
152
                surname      => "expired_patron_surname",
153
                firstname    => 'expired_patron',
154
                categorycode => $patron_category->categorycode,
155
                branchcode   => $library_2->branchcode,
156
                dateexpiry   => '2000-12-01',
157
            }
158
        }
159
    );
160
    unshift @cleanup, $patron_28;
161
148
    $attribute_type = Koha::Patron::Attribute::Type->new(
162
    $attribute_type = Koha::Patron::Attribute::Type->new(
149
        {
163
        {
150
            code        => 'my code1',
164
            code        => 'my code1',
Lines 207-213 sub teardown { Link Here
207
}
221
}
208
222
209
subtest 'Search patrons' => sub {
223
subtest 'Search patrons' => sub {
210
    plan tests => 28;
224
    plan tests => 29;
211
225
212
    setup();
226
    setup();
213
    my $total_number_of_patrons = Koha::Patrons->search->count;
227
    my $total_number_of_patrons = Koha::Patrons->search->count;
Lines 463-468 subtest 'Search patrons' => sub { Link Here
463
477
464
    };
478
    };
465
479
480
    subtest 'expired and restricted badges' => sub {
481
        plan tests => 5;
482
483
        my $patron_28 = Koha::Patrons->search( { surname => 'expired_patron_surname' } )->next;
484
485
        $driver->get( $base_url . "/members/members-home.pl" );
486
        $s->fill_form( { 'searchmember' => 'expired_patron' } );
487
488
        sleep $DT_delay && $s->wait_for_ajax;
489
490
        like(
491
            $driver->find_element('//ul[@id="ui-id-2"]/li/a')->get_text,
492
            qr[\Qexpired_patron_surname\E],
493
            'expired_patron is shown'
494
        );
495
496
        is(
497
            $driver->find_element('//ul[@id="ui-id-2"]/li/a/span[@class="badge text-bg-warning"]')->get_text,
498
            'Expired',
499
            'Expired badge is shown'
500
        );
501
502
        $patron_28->dateexpiry('2999-12-01')->store;
503
504
        $driver->get( $base_url . "/members/members-home.pl" );
505
        $s->fill_form( { 'searchmember' => 'expired_patron' } );
506
507
        sleep $DT_delay && $s->wait_for_ajax;
508
509
        my @expired_badges = $driver->find_elements('//ul[@id="ui-id-2"]/li/a/span[@class="badge text-bg-warning"]');
510
        is(
511
            scalar @expired_badges, 0,
512
            'No expired badge is shown'
513
        );
514
515
        $patron_28->debarred('2048-11-18')->store;
516
517
        $driver->get( $base_url . "/members/members-home.pl" );
518
        $s->fill_form( { 'searchmember' => 'expired_patron' } );
519
520
        sleep $DT_delay && $s->wait_for_ajax;
521
522
        my @restricted_badges = $driver->find_elements('//ul[@id="ui-id-2"]/li/a/span[@class="badge text-bg-danger"]');
523
        is(
524
            $driver->find_element('//ul[@id="ui-id-2"]/li/a/span[@class="badge text-bg-danger"]')->get_text,
525
            'Restricted',
526
            'Restricted badge is shown'
527
        );
528
529
        $patron_28->dateexpiry('2000-12-01')->store;
530
531
        $driver->get( $base_url . "/members/members-home.pl" );
532
        $s->fill_form( { 'searchmember' => 'expired_patron' } );
533
534
        sleep $DT_delay && $s->wait_for_ajax;
535
536
        is(
537
            $driver->find_element('//ul[@id="ui-id-2"]/li/a/span[@class="badge text-bg-warning"]')->get_text,
538
            'Expired',
539
            'Both badges are shown'
540
        );
541
    };
542
466
    teardown();
543
    teardown();
467
544
468
};
545
};
469
- 

Return to bug 36454