[Bug 38236] New: selenium/administration_tasks.t is failing randomly with "no such alert"
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38236 Bug ID: 38236 Summary: selenium/administration_tasks.t is failing randomly with "no such alert" Change sponsored?: --- Product: Koha Version: unspecified Hardware: All OS: All Status: NEW Severity: minor Priority: P5 - low Component: Test Suite Assignee: chris@bigballofwax.co.nz Reporter: jonathan.druart@gmail.com QA Contact: testopia@bugs.koha-community.org Depends on: 25551 15:44:00 koha_1 | STRACE: /usr/share/perl5/Try/Tiny.pm:123 in Selenium::Remote::Driver::catch {...} 15:44:00 koha_1 | /usr/share/perl5/Selenium/Remote/Driver.pm:361 in Try::Tiny::try 15:44:00 koha_1 | (eval 2020):1 in Selenium::Remote::Driver::__ANON__ 15:44:00 koha_1 | (eval 2022):2 in Selenium::Remote::Driver::__ANON__ 15:44:00 koha_1 | /usr/share/perl5/Selenium/Remote/Driver.pm:712 in Selenium::Remote::Driver::_execute_command 15:44:00 koha_1 | t/db_dependent/selenium/administration_tasks.t:180 in Selenium::Remote::Driver::accept_alert 15:44:00 koha_1 | 15:44:00 selenium_1 | 1729518016380 Marionette INFO Stopped listening on port 46675 15:44:00 selenium_1 | JavaScript error: resource:///modules/Interactions.jsm, line 230: NS_ERROR_FAILURE: Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIUserIdleService.removeIdleObserver] 15:44:00 selenium_1 | 13:40:17.451 INFO [ActiveSessions$1.onStop] - Removing session 3ec3997e-064a-48e2-9ea2-f77f391fcf82 (org.openqa.selenium.firefox.GeckoDriverService) 15:44:00 koha_1 | Error while executing command: no such alert at /usr/share/perl5/Selenium/Remote/Driver.pm line 411. 15:44:00 koha_1 | at /usr/share/perl5/Selenium/Remote/Driver.pm line 356. 15:44:00 koha_1 | # Looks like your test exited with 255 just after 3. 15:44:00 koha_1 | [13:40:17] t/db_dependent/selenium/administration_tasks.t .............................. Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25551 [Bug 25551] [OMNIBUS] Some tests are failing randomly -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38236 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=32010 --- Comment #1 from Jonathan Druart <jonathan.druart@gmail.com> --- selenium/authentication_2fa.t had a similar failure (bug 32010) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38236 --- Comment #2 from Jonathan Druart <jonathan.druart@gmail.com> --- It run 300x successfully locally. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38236 --- Comment #3 from Jonathan Druart <jonathan.druart@gmail.com> --- It was Koha_Master/3063 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38236 --- Comment #4 from Jonathan Druart <jonathan.druart@gmail.com> --- (In reply to Jonathan Druart from comment #1)
selenium/authentication_2fa.t had a similar failure (bug 32010)
But because of an AJAX request, what we do not have here. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38236 Victor Grousset/tuxayo <victor@tuxayo.net> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |victor@tuxayo.net --- Comment #5 from Victor Grousset/tuxayo <victor@tuxayo.net> --- In case that helps, I'm able to reproduce this ``` t/db_dependent/selenium/administration_tasks.t:179 in Selenium::Remote::Driver::find_element Error while executing command: no such element: Unable to locate element: //input[@name="id"][@value=""]/following-sibling::button at /usr/share/perl5/Selenium/Remote/Driver.pm line 411. ``` It's the line just before the: $s->driver->accept_alert; # Accept the modal "Are you sure you want to delete this authorized value?" -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38236 --- Comment #6 from Jonathan Druart <jonathan.druart@gmail.com> --- (In reply to Victor Grousset/tuxayo from comment #5)
In case that helps, I'm able to reproduce this
How? Can you provide the screenshot of the problematic screen ? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38236 --- Comment #7 from Victor Grousset/tuxayo <victor@tuxayo.net> ---
How?
I'm just running the test in a loop. 3 such failures in 48 runs.
Can you provide the screenshot of the problematic screen ?
Screenshot capture is broken in some failures. I had a patch to fix it that I added to a selenium ticket 6mo/1y ago. But it was mixed with other changes to testing process t/lib/Selenium.pm and ultimately wasn't retained. I'll try to find it. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38236 --- Comment #8 from Jonathan Druart <jonathan.druart@gmail.com> --- Koha_Main/3075 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38236 --- Comment #9 from Jonathan Druart <jonathan.druart@gmail.com> --- (In reply to Victor Grousset/tuxayo from comment #7)
How?
I'm just running the test in a loop. 3 such failures in 48 runs.
I got 300 successes in a row :-/
Can you provide the screenshot of the problematic screen ?
Screenshot capture is broken in some failures. I had a patch to fix it that I added to a selenium ticket 6mo/1y ago. But it was mixed with other changes to testing process t/lib/Selenium.pm and ultimately wasn't retained. I'll try to find it.
I don't understand. Could you add a capture_screenshot call before the failure and see how is the screen? $driver->capture_screenshot( 'test.png' ); -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38236 --- Comment #10 from Victor Grousset/tuxayo <victor@tuxayo.net> --- (In reply to Jonathan Druart from comment #9)
(In reply to Victor Grousset/tuxayo from comment #7)
Screenshot capture is broken in some failures. I had a patch to fix it that I added to a selenium ticket 6mo/1y ago. But it was mixed with other changes to testing process t/lib/Selenium.pm and ultimately wasn't retained. I'll try to find it.
I don't understand. Could you add a capture_screenshot call before the failure and see how is the screen?
$driver->capture_screenshot( 'test.png' );
Oh right! I though it was about the screenshot taken on failure. So, after 6 failures in 188 runs fail: https://lutim.lagout.org/8oEY7SVs/K9Vz9RK2.png ok: https://lutim.lagout.org/gZ6IQwAu/f9MjqAoL.png And turns out we are in a case where selenium_failure.png is managed to be taken. And it the same image as a success! It seems that the list of AVs hasn't loaded yet when it fails. And when selenium_failure.png is taken, the page has finished loading. Which is weird because Selenium is supposed to wait for the load event to be fired/document.readyState===complete. And find_element() is supposed to wait until a timeout before failing. Given that the runtime of the failed run is 10 sec more than a good run, it seem it waited. But then somehow it didn't find the element, failed and the screenshot just after shows a loaded page. Random Selenium bug? >_< Anyway, does the screenshots give any hint? code change to take screenshot:
@@ -176,6 +176,7 @@ SKIP: { [...] #$driver->find_element('//input[@id="'.$av_id.'"]/following-sibling::button[text() = >"Delete"]')->click; +$driver->capture_screenshot( 'test.png' ); $driver->find_element('//input[@name="id"][@value="'.$av_id.'"]/following-sibling::button')->click; $s->driver->accept_alert; # Accept the modal "Are you sure you want to delete this authorized value?"
-- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38236 --- Comment #11 from Jonathan Druart <jonathan.druart@gmail.com> --- It will take less time to rewrite those tests using cypress than debug them... -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38236 --- Comment #12 from Jonathan Druart <jonathan.druart@gmail.com> --- Could you remove this code and see if it still fails? 433 $("#Aform").submit(function() { 434 if ( $('#authorised_value').length ) { 435 if ( ! $('#authorised_value').get(0).checkValidity() ) { 436 alert( _("Authorised value should be numeric.") ); 437 $('#authorised_value').focus(); 438 return false; 439 } 440 } 441 return true; 442 }); -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38236 --- Comment #13 from Victor Grousset/tuxayo <victor@tuxayo.net> --- (In reply to Jonathan Druart from comment #11)
It will take less time to rewrite those tests using cypress than debug them...
+1, as soon as bug 38503 makes it, I'll try to be able spend labor time rewriting tests. Oh, it's in need signoff! I'll look at it ASAP! *jumping from excitement*
Could you remove this code and see if it still fails?
4 fail in 155 runs 🫠🫠🫠 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38236 --- Comment #14 from Jonathan Druart <jonathan.druart@gmail.com> --- (In reply to Victor Grousset/tuxayo from comment #13)
(In reply to Jonathan Druart from comment #11)
It will take less time to rewrite those tests using cypress than debug them...
+1, as soon as bug 38503 makes it, I'll try to be able spend labor time rewriting tests.
Bug 38503 won't help much here. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38236 --- Comment #15 from Victor Grousset/tuxayo <victor@tuxayo.net> --- Yep, looking at the diff there, I just finally realized that mock means mock. And not touching the DB. 😅😅😅😅🤦 Anyway it's still a big win to be able to more easily test the front end.
won't help much here
It might be coping and delusion but [to be continued in bug 29285 comment 4] -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38236 --- Comment #16 from Jonathan Druart <jonathan.druart@gmail.com> --- Koha_Main/3153 on Docker_15 -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org