[Koha-bugs] [Bug 35506] selenium/regressions.t is failing randomly

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Fri Jan 5 00:00:58 CET 2024


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35506

--- Comment #18 from Victor Grousset/tuxayo <victor at tuxayo.net> ---
> Created attachment
> Just a guess, we should wait for the ajax response before looking for
> the element in the table.

Wait, I'm really on this! Yes, that's one of things, at this same place. What
is DT_delay for?


(In reply to Jonathan Druart from comment #16)
> (In reply to Victor Grousset/tuxayo from comment #14)
> > Found some tactics that seem effective on test 'Encoding in session
> > variables'
> > and test 'Display circulation table correctly'
> 
> Which ones?

https://gitlab.com/tuxayo/Koha/-/commits/bug-35506-selenium-regressions.t-failing-randomly

Here is a summary of what my WIP patch has:
- After asking in Selenium and JavaScript chats, there must be added a way to
know if a button is ready to be clicked on. Because $(document).ready() content
is long enough so that Selenium can be faster to click on the button before it
has it's callback set. The proper thing is something telling the users that the
page is still loading or visibly showing that the button isn't ready. For lack
of time to go for something on the UI side with a lot of uncertainties, setting
a flag at the end of $(document).ready() is one line way to cover a whole page
regardless of how many problematic buttons there are.
So the idea is to set in the JS window._pageFullyReady and having the tests
wait (with wait_for_page_fully_ready()) for it like wait_for_ajax does. And
that can be used on other page by adding the same flag in their
$(document).ready() callback.
- Next, so yes wait_for_ajax is needed, but in the +2000 runs I did, dozens of
times I got way more than 10 sec wait (noted in the comments next to the
calls). For this I had to make max_retries a variable and not a constant so I
started doing a getter/setter and messed things up with confusing various ways
to do it in Perl and finally noticed that we had __PACKAGE__->mk_accessors ^^"
- A weird thing about having to reload the checkouts page because it's not
refreshed after doing a checkout! (more details in the code comment)
- Needing wait_for_ajax to output a stack trace (can't even know which call
fail otherwise) and take a screenshot on timeout

So it's almost done. Questions:
1. What is DT_delay for?
2. I only though of it just now: instead of having the flag
window._pageFullyReady, should the problematic buttons be hidden in the HTML?
(and maybe have a dummy button with a loading icon in place to show the user
that stuff it loading) And then the stuff in $(document).ready() makes them
visible after setting the onclick callback. And the test just waits for the
button to be visible instead of the flag to be set.

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list