From ff980555f39da7a033dc26f3910e6a323b7352dd Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 10 Sep 2021 11:27:33 +0200 Subject: [PATCH] Bug 28998: Adjust Selenium test Test plan: Run t/db_dependent/selenium/authentication_2fa.t Signed-off-by: Marcel de Rooy Signed-off-by: Martin Renvoize Signed-off-by: Fridolin Somers --- t/db_dependent/selenium/authentication_2fa.t | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/t/db_dependent/selenium/authentication_2fa.t b/t/db_dependent/selenium/authentication_2fa.t index ceda62fcff..1c5bb0d76d 100755 --- a/t/db_dependent/selenium/authentication_2fa.t +++ b/t/db_dependent/selenium/authentication_2fa.t @@ -80,7 +80,7 @@ SKIP: { $s->submit_form; is( $driver->find_element('//div[@class="two-factor-status"]')->get_text(), 'Status: Enabled', '2FA is enabled' ); $patron = $patron->get_from_storage; - is( $patron->secret, $secret32, 'secret is set in DB' ); + is( $patron->decoded_secret, $secret32, 'encrypted secret is set in DB' ); }; @@ -89,6 +89,7 @@ SKIP: { my $mainpage = $s->base_url . q|mainpage.pl|; + my $secret32 = $patron->decoded_secret; { # ok first try $driver->get($mainpage . q|?logout.x=1|); $driver->get($s->base_url . q|circ/circulation.pl?borrowernumber=|.$patron->borrowernumber); @@ -98,7 +99,8 @@ SKIP: { like( $driver->get_title, qr(Two-factor authentication), 'Must be on the second auth screen' ); is( login_error($s), undef ); - my $auth = Koha::Auth::TwoFactorAuth->new({patron => $patron}); + my $auth = Koha::Auth::TwoFactorAuth->new( + { patron => $patron, secret32 => $secret32 } ); my $code = $auth->code(); $auth->clear; $driver->find_element('//form[@id="loginform"]//input[@id="otp_token"]')->send_keys($code); @@ -138,7 +140,8 @@ SKIP: { $driver->find_element('//input[@type="submit"]')->click; is( login_error($s), "Invalid two-factor code" ); - my $auth = Koha::Auth::TwoFactorAuth->new({patron => $patron}); + my $auth = Koha::Auth::TwoFactorAuth->new( + { patron => $patron, secret32 => $secret32 } ); my $code = $auth->code(); $auth->clear; $driver->find_element('//form[@id="loginform"]//input[@id="otp_token"]')->send_keys($code); -- 2.39.5