Bug 38236

Summary: selenium/administration_tasks.t is failing randomly with "no such alert"
Product: Koha Reporter: Jonathan Druart <jonathan.druart>
Component: Test SuiteAssignee: Chris Cormack <chris>
Status: NEW --- QA Contact: Testopia <testopia>
Severity: minor    
Priority: P5 - low CC: victor
Version: unspecified   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32010
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Bug Depends on: 25551    
Bug Blocks:    

Description Jonathan Druart 2024-10-23 11:31:13 UTC
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 ..............................
Comment 1 Jonathan Druart 2024-10-23 11:33:24 UTC
selenium/authentication_2fa.t had a similar failure (bug 32010)
Comment 2 Jonathan Druart 2024-10-23 11:33:46 UTC
It run 300x successfully locally.
Comment 3 Jonathan Druart 2024-10-23 11:34:50 UTC
It was Koha_Master/3063
Comment 4 Jonathan Druart 2024-10-23 11:37:20 UTC
(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.
Comment 5 Victor Grousset/tuxayo 2024-10-24 04:08:03 UTC
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?"
Comment 6 Jonathan Druart 2024-10-24 07:47:11 UTC
(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 ?
Comment 7 Victor Grousset/tuxayo 2024-10-24 18:01:08 UTC
> 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.
Comment 8 Jonathan Druart 2024-10-28 10:58:05 UTC
Koha_Main/3075
Comment 9 Jonathan Druart 2024-10-28 11:00:18 UTC
(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' );