Bugzilla – Attachment 144065 Details for
Bug 32010
selenium/authentication_2fa.t is failing randomly
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 32010: Make sure the alert will be displayed after the ajax call
Bug-32010-Make-sure-the-alert-will-be-displayed-af.patch (text/plain), 4.14 KB, created by
Tomás Cohen Arazi (tcohen)
on 2022-11-18 14:18:39 UTC
(
hide
)
Description:
Bug 32010: Make sure the alert will be displayed after the ajax call
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2022-11-18 14:18:39 UTC
Size:
4.14 KB
patch
obsolete
>From 7d7c8e18acc8a6ac31e512ae620ee02737ed3558 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 2 Nov 2022 09:08:46 +0100 >Subject: [PATCH] Bug 32010: Make sure the alert will be displayed after the > ajax call > >There is a missing wait_for_ajax call at after we click but wait_for_ajax >is waiting for the return of success, and the alert is there. > >22:01:57 koha_1 | STRACE: /usr/share/perl5/Try/Tiny.pm:123 in Selenium::Remote::Driver::catch {...} >22:01:57 koha_1 | /usr/share/perl5/Selenium/Remote/Driver.pm:361 in Try::Tiny::try >22:01:57 koha_1 | (eval 541):1 in Selenium::Remote::Driver::__ANON__ >22:01:57 koha_1 | (eval 543):2 in Selenium::Remote::Driver::__ANON__ >22:01:57 koha_1 | /usr/share/perl5/Selenium/Remote/Driver.pm:654 in Selenium::Remote::Driver::_execute_command >22:01:57 koha_1 | t/db_dependent/selenium/authentication_2fa.t:282 in Selenium::Remote::Driver::get_alert_text >22:01:57 koha_1 | /usr/share/perl/5.32/Test/Builder.pm:334 in main::__ANON__ >22:01:57 koha_1 | /usr/share/perl/5.32/Test/Builder.pm:334 in (eval) >22:01:57 koha_1 | /usr/share/perl/5.32/Test/More.pm:809 in Test::Builder::subtest >22:01:57 koha_1 | t/db_dependent/selenium/authentication_2fa.t:291 in Test::More::subtest >22:01:57 koha_1 | >22:01:57 koha_1 | # Looks like you planned 7 tests but ran 4. >22:01:57 koha_1 | >22:01:57 koha_1 | # Failed test 'Enforce 2FA setup on first login' >22:01:57 koha_1 | # at t/db_dependent/selenium/authentication_2fa.t line 291. >22:01:57 koha_1 | Error while executing command: no such alert at /usr/share/perl5/Selenium/Remote/Driver.pm line 411. >22:01:57 koha_1 | at /usr/share/perl5/Selenium/Remote/Driver.pm line 356. >22:01:57 koha_1 | # Looks like your test exited with 255 just after 4. >22:01:57 koha_1 | [20:59:37] t/db_dependent/selenium/authentication_2fa.t > >Test plan: >Confirm that the test pass (execute it in a loop, hundreds of times) >Confirm that the behaviour of 2FA "enforced" (see bug 30588) is still >working as expected. > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > koha-tmpl/intranet-tmpl/prog/en/modules/auth.tt | 6 ++++-- > t/db_dependent/selenium/authentication_2fa.t | 1 + > 2 files changed, 5 insertions(+), 2 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/auth.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/auth.tt >index a8d8f793d22..16cfb367db0 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/auth.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/auth.tt >@@ -279,8 +279,7 @@ > type: 'POST', > url: '/api/v1/auth/two-factor/registration/verification', > success: function (data) { >- alert(_("Two-factor authentication correctly configured. You will be redirected to the login screen.")); >- window.location = "/cgi-bin/koha/mainpage.pl"; >+ return; > }, > error: function (data) { > const error = data.responseJSON.error; >@@ -290,6 +289,9 @@ > alert(error); > } > }, >+ }).then(function(){ >+ alert(_("Two-factor authentication correctly configured. You will be redirected to the login screen.")); >+ window.location = "/cgi-bin/koha/mainpage.pl"; > }); > }); > >diff --git a/t/db_dependent/selenium/authentication_2fa.t b/t/db_dependent/selenium/authentication_2fa.t >index 81e75f2f065..a6bf221e5d9 100755 >--- a/t/db_dependent/selenium/authentication_2fa.t >+++ b/t/db_dependent/selenium/authentication_2fa.t >@@ -279,6 +279,7 @@ SKIP: { > $driver->find_element('//*[@id="pin_code"]')->clear; > $driver->find_element('//*[@id="pin_code"]')->send_keys($pin_code); > $driver->find_element('//*[@id="register-2FA"]')->click; >+ $s->wait_for_ajax; > is( $driver->get_alert_text, > "Two-factor authentication correctly configured. You will be redirected to the login screen." > ); >-- >2.34.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 32010
:
142914
| 144065 |
144106