Bug 29485

Summary: selenium/administration_tasks.t is failing randomly
Product: Koha Reporter: Jonathan Druart <jonathan.druart+koha>
Component: Test SuiteAssignee: Jonathan Druart <jonathan.druart+koha>
Status: RESOLVED FIXED QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: fridolin.somers, kyle, victor
Version: unspecified   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Text to go in the release notes:
Version(s) released in:
21.11.00
Bug Depends on: 19185    
Bug Blocks: 25551    
Attachments: Bug 29485: Trying to prevent administration_tasks.t to fail randomly
Bug 29485: (follow-up) Trying to prevent administration_tasks.t to fail randomly

Description Jonathan Druart 2021-11-15 13:59:23 UTC
Since bug 19185, and Koha_Master running the tests after t/db_dependent/selenium/01-installation.t is ran, t/db_dependent/selenium/administration_tasks.t is failing randomly with:

12:32:59 koha_1       | STRACE:	/usr/share/perl5/Try/Tiny.pm:123 in Selenium::Remote::Driver::catch {...} 
12:32:59 koha_1       | 	/usr/local/share/perl/5.28.1/Selenium/Remote/Driver.pm:361 in Try::Tiny::try
12:32:59 koha_1       | 	(eval 1710):1 in Selenium::Remote::Driver::__ANON__
12:32:59 koha_1       | 	(eval 1712):2 in Selenium::Remote::Driver::__ANON__
12:32:59 koha_1       | 	/usr/local/share/perl/5.28.1/Selenium/Remote/Driver.pm:1340 in Selenium::Remote::Driver::_execute_command
12:32:59 koha_1       | 	/usr/local/share/perl/5.28.1/Selenium/Remote/Driver.pm:1340 in (eval)
12:32:59 koha_1       | 	/kohadevbox/koha/t/lib/Selenium.pm:170 in Selenium::Remote::Driver::find_element
12:32:59 koha_1       | 	t/db_dependent/selenium/administration_tasks.t:188 in t::lib::Selenium::click

I don't recreate it locally.

The screenshot of the failure shows that the screen is still on the authorised value list view.
Comment 1 Jonathan Druart 2021-11-15 14:05:56 UTC
Created attachment 127654 [details] [review]
Bug 29485: Trying to prevent administration_tasks.t to fail randomly

Since bug 19185, and Koha_Master running the tests after t/db_dependent/selenium/01-installation.t is ran, t/db_dependent/selenium/administration_tasks.t is failing randomly with:

12:32:59 koha_1       | STRACE:	/usr/share/perl5/Try/Tiny.pm:123 in Selenium::Remote::Driver::catch {...}
12:32:59 koha_1       | 	/usr/local/share/perl/5.28.1/Selenium/Remote/Driver.pm:361 in Try::Tiny::try
12:32:59 koha_1       | 	(eval 1710):1 in Selenium::Remote::Driver::__ANON__
12:32:59 koha_1       | 	(eval 1712):2 in Selenium::Remote::Driver::__ANON__
12:32:59 koha_1       | 	/usr/local/share/perl/5.28.1/Selenium/Remote/Driver.pm:1340 in Selenium::Remote::Driver::_execute_command
12:32:59 koha_1       | 	/usr/local/share/perl/5.28.1/Selenium/Remote/Driver.pm:1340 in (eval)
12:32:59 koha_1       | 	/kohadevbox/koha/t/lib/Selenium.pm:170 in Selenium::Remote::Driver::find_element
12:32:59 koha_1       | 	t/db_dependent/selenium/administration_tasks.t:188 in t::lib::Selenium::click

I don't recreate it locally.

The screenshot of the failure shows that the screen is still on the authorised value list view.

This does not make a lot of sense, but I am failing to find a logic
here.
Comment 2 Jonathan Druart 2021-11-15 14:09:25 UTC
Patch pushed to master for 21.11.00
Comment 3 Victor Grousset/tuxayo 2021-11-17 00:41:25 UTC
thanks, I'll try to reproduce and see if that can still happen when I'll upgrade Selenium to v4.

Fingers crossed to not need the dirty fix after that.
Comment 4 Kyle M Hall 2021-11-19 16:40:04 UTC
Pushed to 21.05.x for 21.05.05
Comment 5 Fridolin Somers 2021-11-20 00:24:41 UTC
I see it has been reverted from 21.05.x :

4107c8def4 Revert "Bug 29485: Trying to prevent administration_tasks.t to fail randomly"
Comment 6 Kyle M Hall 2021-11-22 11:59:55 UTC
(In reply to Fridolin Somers from comment #5)
> I see it has been reverted from 21.05.x :
> 
> 4107c8def4 Revert "Bug 29485: Trying to prevent administration_tasks.t to
> fail randomly"

Yes, my bad for not posting an update.

Patched unit tests run and pass, but are superfluous as parent bug is not part of 21.05.x.
Comment 7 Jonathan Druart 2021-11-24 08:14:59 UTC
Created attachment 127971 [details] [review]
Bug 29485: (follow-up) Trying to prevent administration_tasks.t to fail randomly

Recreated the problem after run #47
Error while executing command: no such element: Unable to locate element: //*[@id="userid"] at /usr/local/share/perl/5.28.1/Selenium/Remote/Driver.pm line 411.

With this patch I do not longer recreate the failure. It's ugly but,
well, I don't have any other solutions. It seems that the accept_alert
is taking too long and is async (??)
Comment 8 Jonathan Druart 2021-11-24 08:36:46 UTC
(In reply to Jonathan Druart from comment #7)
> Created attachment 127971 [details] [review] [review]
> Bug 29485: (follow-up) Trying to prevent administration_tasks.t to fail
> randomly
> 
> Recreated the problem after run #47
> Error while executing command: no such element: Unable to locate element:
> //*[@id="userid"] at /usr/local/share/perl/5.28.1/Selenium/Remote/Driver.pm
> line 411.
> 
> With this patch I do not longer recreate the failure. It's ugly but,
> well, I don't have any other solutions. It seems that the accept_alert
> is taking too long and is async (??)

Patch pushed to master.