Bug 34778: Add a selenium test

prove -v t/db_dependent/selenium/authentication.t

Signed-off-by: Emmanuel Bétemps <e.betemps@gmail.com>
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Lucas Gass 2025-01-16 23:41:44 +00:00 committed by Katrin Fischer
parent eb2760a9a8
commit 0e2222f9af
No known key found for this signature in database
GPG Key ID: 0EF6E2C03357A834
1 changed files with 34 additions and 1 deletions

View File

@ -142,7 +142,7 @@ SKIP: {
};
subtest 'OPAC interface authentication' => sub {
plan tests => 7;
plan tests => 11;
my $mainpage = $s->opac_base_url . q|opac-main.pl|;
@ -159,6 +159,23 @@ SKIP: {
# Using the modal
$driver->find_element('//a[@class="nav-link login-link loginModal-trigger"]')->click;
$s->fill_form( { muserid => $patron->userid, mpassword => $password } );
is(
$driver->find_element('//div[@id="loginModal"]//input[@id="mpassword"]')->get_attribute('type'),
'password',
'Password field is obscured initially'
);
$driver->find_element('//input[@id="show-password-toggle-checkbox-modal"]')->click;
is(
$driver->find_element('//div[@id="loginModal"]//input[@id="mpassword"]')->get_attribute('type'),
'text',
'Password field is shown'
);
$driver->find_element('//input[@id="show-password-toggle-checkbox-modal"]')->click;
$driver->find_element('//div[@id="loginModal"]//input[@type="submit"]')->click;
like( $driver->get_title, qr(Koha online catalog), 'Patron without permission should be able to login to the OPAC using the modal' );
$driver->find_element('//div[@id="userdetails"]');
@ -190,6 +207,22 @@ SKIP: {
# Using the form on the right
$s->fill_form( { userid => $patron->userid, password => $password } );
is(
$driver->find_element('//div[@id="login"]//input[@id="password"]')->get_attribute('type'),
'password',
'Password field is obscured initially'
);
$driver->find_element('//input[@id="show-password-toggle-checkbox-main"]')->click;
is(
$driver->find_element('//div[@id="login"]//input[@id="password"]')->get_attribute('type'),
'text',
'Password field is shown'
);
$driver->find_element('//input[@id="show-password-toggle-checkbox-main"]')->click;
$s->submit_form;
$driver->find_element('//div[@id="userdetails"]');
like( $driver->get_title, qr(Your library home), 'Patron without permissions should be able to login to the OPAC using the form on the right');