Bug 34655 - system_preferences_search.t is failing randomly
Summary: system_preferences_search.t is failing randomly
Status: Needs documenting
Alias: None
Product: Koha
Classification: Unclassified
Component: Test Suite (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low normal
Assignee: Jonathan Druart
QA Contact: Martin Renvoize (ashimema)
URL:
Keywords:
Depends on: 32926
Blocks: 25551
  Show dependency treegraph
 
Reported: 2023-08-30 12:48 UTC by Jonathan Druart
Modified: 2024-11-18 16:17 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
24.05.00
Circulation function:


Attachments
Bug 34655: Prevent selenium/system_preferences_search.t to fail randomly (36.75 KB, patch)
2024-05-10 08:36 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 34655: Prevent selenium/system_preferences_search.t to fail randomly (36.79 KB, patch)
2024-05-10 09:29 UTC, David Nind
Details | Diff | Splinter Review
Bug 34655: Prevent selenium/system_preferences_search.t to fail randomly (36.86 KB, patch)
2024-05-10 12:40 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 34655: (QA follow-up) Tidy the file (38.60 KB, patch)
2024-05-10 12:40 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Druart 2023-08-30 12:48:11 UTC
21:54:14 koha_1       |     #   Failed test 'The first "Policy" section (under "Accounting") is currently expanded'
21:54:14 koha_1       |     #   at t/db_dependent/selenium/system_preferences_search.t line 63.
21:54:14 koha_1       |     #          got: undef
21:54:14 koha_1       |     #     expected: 'expanded'
21:54:14 koha_1       |     # Looks like you failed 1 test of 6.
21:54:14 koha_1       | 
21:54:14 koha_1       | #   Failed test 'Perform a system preferences search for "log", and try to expand/collapse both "Policy" sections that appear'
21:54:14 koha_1       | #   at t/db_dependent/selenium/system_preferences_search.t line 91.
Comment 1 Jonathan Druart 2023-08-30 12:48:36 UTC
(In reply to Jonathan Druart from comment #0)
> 21:54:14 koha_1       |     #   Failed test 'The first "Policy" section
> (under "Accounting") is currently expanded'
> 21:54:14 koha_1       |     #   at
> t/db_dependent/selenium/system_preferences_search.t line 63.
> 21:54:14 koha_1       |     #          got: undef
> 21:54:14 koha_1       |     #     expected: 'expanded'
> 21:54:14 koha_1       |     # Looks like you failed 1 test of 6.
> 21:54:14 koha_1       | 
> 21:54:14 koha_1       | #   Failed test 'Perform a system preferences search
> for "log", and try to expand/collapse both "Policy" sections that appear'
> 21:54:14 koha_1       | #   at
> t/db_dependent/selenium/system_preferences_search.t line 91.

This was Koha_Master/2625
Comment 2 Katrin Fischer 2023-12-28 08:45:25 UTC
It just failed again on yesterday's run #2771:

koha_1       | 
koha_1       |     #   Failed test 'The first "Policy" section (under "Accounting") is currently expanded'
koha_1       |     #   at t/db_dependent/selenium/system_preferences_search.t line 63.
koha_1       |     #          got: undef
koha_1       |     #     expected: 'expanded'
koha_1       |     # Looks like you failed 1 test of 6.
koha_1       | 
koha_1       | #   Failed test 'Perform a system preferences search for "log", and try to expand/collapse both "Policy" sections that appear'
koha_1       | #   at t/db_dependent/selenium/system_preferences_search.t line 91.
koha_1       | # Looks like you failed 1 test of 1.
koha_1       | [18:44:17] t/db_dependent/selenium/system_preferences_search.t ......................... 
koha_1       | Dubious, test returned 1 (wstat 256, 0x100)
koha_1       | Failed 1/1 subtests
Comment 3 Jonathan Druart 2024-03-21 08:44:24 UTC
Koha_Master/2818
Comment 4 Jonathan Druart 2024-05-10 08:36:28 UTC
Created attachment 166509 [details] [review]
Bug 34655: Prevent selenium/system_preferences_search.t to fail randomly

Removing this JS code from document.ready.
The script tag is at the end of the DOM and there is no good reasons (at
least I didn't find any) to wait for the whole document to be ready
before executing the JS code.

It made the selenium tests selenium/system_preferences_search.t to fail
randomly with:
    #   Failed test 'The first "Policy" section (under "Accounting") is currently expanded'
    #   at t/db_dependent/selenium/system_preferences_search.t line 63.
    #          got: undef
    #     expected: 'expanded'
    # Looks like you failed 1 test of 6.

Because we set the class in this JS code and selenium won't wait for it
to finish before starting running the tests.
Comment 5 David Nind 2024-05-10 09:29:08 UTC
Created attachment 166517 [details] [review]
Bug 34655: Prevent selenium/system_preferences_search.t to fail randomly

Removing this JS code from document.ready.
The script tag is at the end of the DOM and there is no good reasons (at
least I didn't find any) to wait for the whole document to be ready
before executing the JS code.

It made the selenium tests selenium/system_preferences_search.t to fail
randomly with:
    #   Failed test 'The first "Policy" section (under "Accounting") is currently expanded'
    #   at t/db_dependent/selenium/system_preferences_search.t line 63.
    #          got: undef
    #     expected: 'expanded'
    # Looks like you failed 1 test of 6.

Because we set the class in this JS code and selenium won't wait for it
to finish before starting running the tests.

Signed-off-by: David Nind <david@davidnind.com>
Comment 6 David Nind 2024-05-10 09:30:22 UTC
Testing notes (using KTD):

1. Start up KTD with selenium: ktd --selenium up

2. Tests fail before the patch, and pass after the patch: prove t/db_dependent/selenium/system_preferences_search.t
Comment 7 Martin Renvoize (ashimema) 2024-05-10 12:40:41 UTC
Created attachment 166543 [details] [review]
Bug 34655: Prevent selenium/system_preferences_search.t to fail randomly

Removing this JS code from document.ready.
The script tag is at the end of the DOM and there is no good reasons (at
least I didn't find any) to wait for the whole document to be ready
before executing the JS code.

It made the selenium tests selenium/system_preferences_search.t to fail
randomly with:
    #   Failed test 'The first "Policy" section (under "Accounting") is currently expanded'
    #   at t/db_dependent/selenium/system_preferences_search.t line 63.
    #          got: undef
    #     expected: 'expanded'
    # Looks like you failed 1 test of 6.

Because we set the class in this JS code and selenium won't wait for it
to finish before starting running the tests.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 8 Martin Renvoize (ashimema) 2024-05-10 12:40:44 UTC
Created attachment 166544 [details] [review]
Bug 34655: (QA follow-up) Tidy the file

As we're already updating whitespace over almost the entire file, we may
as well go and tidy the whole thing too and add the /* keep tidy */
flag. (I checked for conflicts with existing bugs.. there's bug 20930
which will need a rebase, but it will already conflict and need a rebase
and is currently FQA)

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 9 Martin Renvoize (ashimema) 2024-05-10 12:42:14 UTC
I'm not finding any regressions here.. all seems to work.. time will tell ;P

Passing QA
Comment 10 Katrin Fischer 2024-05-10 13:19:52 UTC
Pushed for 24.05!

Well done everyone, thank you!
Comment 11 Fridolin Somers 2024-05-29 08:53:06 UTC
Does not apply easy on 23.11.x I prefer not to backport