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

(-)a/t/db_dependent/selenium/authentication.t (-3 / +26 lines)
Lines 23-29 Link Here
23
#Note: If you are testing this on kohadevbox with selenium installed in kohadevbox then you need to set the staffClientBaseURL to localhost:8080 and the OPACBaseURL to localhost:80
23
#Note: If you are testing this on kohadevbox with selenium installed in kohadevbox then you need to set the staffClientBaseURL to localhost:8080 and the OPACBaseURL to localhost:80
24
24
25
use Modern::Perl;
25
use Modern::Perl;
26
use Test::More tests => 2;
26
use Test::More tests => 3;
27
27
28
use C4::Context;
28
use C4::Context;
29
use Koha::AuthUtils;
29
use Koha::AuthUtils;
Lines 35-41 my @data_to_cleanup; Link Here
35
35
36
SKIP: {
36
SKIP: {
37
    eval { require Selenium::Remote::Driver; };
37
    eval { require Selenium::Remote::Driver; };
38
    skip "Selenium::Remote::Driver is needed for selenium tests.", 2 if $@;
38
    skip "Selenium::Remote::Driver is needed for selenium tests.", 3 if $@;
39
39
40
    my $builder  = t::lib::TestBuilder->new;
40
    my $builder  = t::lib::TestBuilder->new;
41
    my $s        = t::lib::Selenium->new;
41
    my $s        = t::lib::Selenium->new;
Lines 276-281 SKIP: { Link Here
276
        push @data_to_cleanup, $patron, $patron->category, $patron->library;
276
        push @data_to_cleanup, $patron, $patron->category, $patron->library;
277
    };
277
    };
278
278
279
    subtest 'Regressions' => sub {
280
281
        plan tests => 2;
282
283
        my $mainpage = $s->base_url . q|mainpage.pl|;
284
285
        my $patron_1 = $builder->build_object({ class => 'Koha::Patrons', value => { flags => 1 }});
286
        my $patron_2 = $builder->build_object({ class => 'Koha::Patrons', value => { flags => 0 }});
287
        my $password = 'password';
288
        t::lib::Mocks::mock_preference( 'RequireStrongPassword', 0 );
289
        $patron_1->set_password({ password => $password });
290
        $patron_2->set_password({ password => $password });
291
292
        $driver->get($mainpage . q|?logout.x=1|);
293
        $s->auth( $patron_2->userid, $password );
294
        like( $driver->get_title, qr(Access denied), 'Patron without permissions should not be able to login' );
295
296
        $s->auth( $patron_1->userid, $password );
297
        like( $driver->get_title(), qr(Koha staff interface), 'Patron with permissions should be able to login' );
298
299
        push @data_to_cleanup, $patron_1, $patron_1->category, $patron_1->library;
300
        push @data_to_cleanup, $patron_2, $patron_2->category, $patron_2->library;
301
    };
302
279
    $driver->quit();
303
    $driver->quit();
280
};
304
};
281
305
282
- 

Return to bug 31908