[Koha-bugs] [Bug 35598] selenium/authentication_2fa.t is still failing randomly

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Wed Dec 20 11:35:33 CET 2023


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35598

--- Comment #8 from Jonathan Druart <jonathan.druart+koha at gmail.com> ---
(In reply to David Nind from comment #7)
> Testing notes:
> 
> 1. If I add the async to line 284 of
> koha-tmpl/intranet-tmpl/prog/en/modules/auth.tt BEFORE applying the patch,
> the tests pass.
> 
> 2. If I add async to line 284 of
> koha-tmpl/intranet-tmpl/prog/en/modules/auth.tt AFTER applying the patch,
> the tests pass.
> 
> I'm assuming 2 is what is required.

On master:

diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/auth.tt
b/koha-tmpl/intranet-tmpl/prog/en/modules/auth.tt
index 14e30e5e6e5..81ab5eac13d 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/auth.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/auth.tt
@@ -281,12 +281,14 @@
                     data: {},
                     type: 'POST',
                     url: '/api/v1/auth/two-factor/registration',
-                    success: function (data) {
+                    success: async function (data) {
                         $("#qr_code").attr('src', data.qr_code);
                         $("#secret32").val(data.secret32);
                         $("#issuer").html(data.issuer);
                         $("#key_id").html(data.key_id);
                         $("#key_secret").html(data.secret32);
+                        const sleep = ms => new Promise(r => setTimeout(r,
ms));
+                        await sleep(1000);
                         $("#registration-form").show();
                     },
                     error: function (data) {




$ prove t/db_dependent/selenium/authentication_2fa.t 
t/db_dependent/selenium/authentication_2fa.t .. 3/5 
STRACE: /usr/share/perl5/Try/Tiny.pm:123 in Selenium::Remote::Driver::catch
{...} 
        /usr/share/perl5/Selenium/Remote/Driver.pm:361 in Try::Tiny::try
        (eval 582):1 in Selenium::Remote::Driver::__ANON__
        (eval 584):2 in Selenium::Remote::Driver::__ANON__
        (eval 556):17 in Selenium::Remote::Driver::_execute_command
        /usr/share/perl5/Selenium/Remote/WebElement.pm:125 in
Selenium::Remote::WebElement::_execute_command
        t/db_dependent/selenium/authentication_2fa.t:276 in
Selenium::Remote::WebElement::send_keys
        /usr/share/perl/5.32/Test/Builder.pm:334 in main::__ANON__
        /usr/share/perl/5.32/Test/Builder.pm:334 in (eval)
        /usr/share/perl/5.32/Test/More.pm:809 in Test::Builder::subtest
        t/db_dependent/selenium/authentication_2fa.t:294 in Test::More::subtest

    # Looks like you planned 7 tests but ran 3.
t/db_dependent/selenium/authentication_2fa.t .. 4/5 
#   Failed test 'Enforce 2FA setup on first login'
#   at t/db_dependent/selenium/authentication_2fa.t line 294.
Error while executing command: element not interactable: Element <input
id="pin_code" name="pin_code" type="text"> is not reachable by keyboard at
/usr/share/perl5/Selenium/Remote/Driver.pm line 411.
 at /usr/share/perl5/Selenium/Remote/Driver.pm line 356.
# Looks like your test exited with 255 just after 4.

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list