Bugzilla – Attachment 159993 Details for
Bug 35598
selenium/authentication_2fa.t is still failing randomly
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35598: Fix selenium/authentication_2fa.t random failure
Bug-35598-Fix-seleniumauthentication2fat-random-fa.patch (text/plain), 3.99 KB, created by
Jonathan Druart
on 2023-12-19 09:53:09 UTC
(
hide
)
Description:
Bug 35598: Fix selenium/authentication_2fa.t random failure
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2023-12-19 09:53:09 UTC
Size:
3.99 KB
patch
obsolete
>From 87f737915181e965d7f4fd8e5b8b92cc6f8d1788 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 19 Dec 2023 10:28:30 +0100 >Subject: [PATCH] Bug 35598: Fix selenium/authentication_2fa.t random failure > >Jenkins is failing with >koha_1 | STRACE: /usr/share/perl5/Try/Tiny.pm:123 in Selenium::Remote::Driver::catch {...} >koha_1 | /usr/share/perl5/Selenium/Remote/Driver.pm:361 in Try::Tiny::try >koha_1 | (eval 582):1 in Selenium::Remote::Driver::__ANON__ >koha_1 | (eval 584):2 in Selenium::Remote::Driver::__ANON__ >koha_1 | (eval 556):17 in Selenium::Remote::Driver::_execute_command >koha_1 | /usr/share/perl5/Selenium/Remote/WebElement.pm:125 in Selenium::Remote::WebElement::_execute_command >koha_1 | t/db_dependent/selenium/authentication_2fa.t:276 in Selenium::Remote::WebElement::send_keys >koha_1 | /usr/share/perl/5.32/Test/Builder.pm:334 in main::__ANON__ >koha_1 | /usr/share/perl/5.32/Test/Builder.pm:334 in (eval) >koha_1 | /usr/share/perl/5.32/Test/More.pm:809 in Test::Builder::subtest >koha_1 | t/db_dependent/selenium/authentication_2fa.t:294 in Test::More::subtest >koha_1 | >selenium_1 | 1702911648831 Marionette INFO Stopped listening on port 41385 >selenium_1 | JavaScript error: resource:///modules/Interactions.jsm, line 230: NS_ERROR_FAILURE: Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIUserIdleService.removeIdleObserver] >selenium_1 | 15:00:49.452 INFO [ActiveSessions$1.onStop] - Removing session c3461b22-7a80-4b56-b177-653a53cc2651 (org.openqa.selenium.firefox.GeckoDriverService) >koha_1 | # Looks like you planned 7 tests but ran 3. >koha_1 | >koha_1 | # Failed test 'Enforce 2FA setup on first login' >koha_1 | # at t/db_dependent/selenium/authentication_2fa.t line 294. >koha_1 | 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. > >The error is: "Element <input id="pin_code" name="pin_code" type="text"> is not reachable by keyboard" > >A guess is that the input is either 1. outside of the viewport, or 2. not >displayed yet. > >1. We are hidding #registration-form then show it when we retrieved the > info (after POST /api/v1/auth/two-factor/registration) >2. Couldn't there be a race condition? >In auth.tt >284 success: function (data) { >292 $("#registration-form").show(); >And in the selenium test: >$s->wait_for_ajax; # There is an ajax request to populate the qr_code and the secret >Not sure this wait_for_ajax is waiting for the end of success, I don't >think so. > >This patch is supposed to fix both theories. > >Test plan: >0. Do not apply the patch >1. Edit auth.tt and sleep 1 second before showing the form: >290 const sleep = ms => new Promise(r => setTimeout(r, ms)); >291 await sleep(1000); >292 $("#registration-form").show(); > >2. prove t/db_dependent/selenium/authentication_2fa.t >=> "is not reachable by keyboard" error! > >3. Apply the patch, keep the sleep > >4. prove t/db_dependent/selenium/authentication_2fa.t >=> Tests are passing >--- > t/db_dependent/selenium/authentication_2fa.t | 2 ++ > 1 file changed, 2 insertions(+) > >diff --git a/t/db_dependent/selenium/authentication_2fa.t b/t/db_dependent/selenium/authentication_2fa.t >index ac9fe9be11a..1fafc92f60a 100755 >--- a/t/db_dependent/selenium/authentication_2fa.t >+++ b/t/db_dependent/selenium/authentication_2fa.t >@@ -265,6 +265,8 @@ SKIP: { > ); > > $s->wait_for_ajax; # There is an ajax request to populate the qr_code and the secret >+ $driver->set_window_size(3840,1080); >+ $s->wait_for_element_visible('//*[@id="registration-form"]'); > > isnt( $driver->find_element('//*[@id="qr_code"]')->get_attribute("src"), "" ); > my $secret32 = $driver->find_element('//*[@id="secret32"]')->get_value; >-- >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 35598
:
159993
|
160096
|
160099
|
160124