From dfed7f235d2e079743a74bb2791db2d4ebd63b1d Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 6 Jun 2023 10:40:03 +0200 Subject: [PATCH] Bug 33904: Add tests Signed-off-by: Martin Renvoize Signed-off-by: Katrin Fischer Signed-off-by: Tomas Cohen Arazi --- t/db_dependent/selenium/authentication_2fa.t | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/t/db_dependent/selenium/authentication_2fa.t b/t/db_dependent/selenium/authentication_2fa.t index 053b47343d..ac9fe9be11 100755 --- a/t/db_dependent/selenium/authentication_2fa.t +++ b/t/db_dependent/selenium/authentication_2fa.t @@ -16,6 +16,7 @@ # along with Koha; if not, see . use Modern::Perl; +use utf8; use Test::More tests => 5; use C4::Context; @@ -34,7 +35,9 @@ SKIP: { my $builder = t::lib::TestBuilder->new; - my $patron = $builder->build_object({ class => 'Koha::Patrons', value => { flags => 1 }}); + my $library_name = 'my ❤ library'; + my $library = $builder->build_object( { class => 'Koha::Libraries', value => { branchname => $library_name } } ); + my $patron = $builder->build_object( { class => 'Koha::Patrons', value => { flags => 1, branchcode => $library->branchcode } } ); $patron->flags(1)->store; # superlibrarian permission my $password = Koha::AuthUtils::generate_password($patron->category); t::lib::Mocks::mock_preference( 'RequireStrongPassword', 0 ); @@ -46,7 +49,7 @@ SKIP: { my $driver = $s->driver; subtest 'Setup' => sub { - plan tests => 12; + plan tests => 13; my $mainpage = $s->base_url . q|mainpage.pl|; $driver->get($mainpage); @@ -79,6 +82,7 @@ SKIP: { $driver->find_element('//*[@id="enable-2FA"]')->click; $s->wait_for_ajax; ok($driver->find_element('//img[@id="qr_code"]'), 'There is a QR code'); + is($driver->find_element('//span[@id="issuer"]')->get_text, $library_name); $driver->find_element('//*[@id="pin_code"]')->send_keys('wrong_code'); $driver->find_element('//*[@id="register-2FA"]')->click; -- 2.39.5