Bug 36355 - Auth/csrf.ts is failing if library with long info in the DB
Summary: Auth/csrf.ts is failing if library with long info in the DB
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Test Suite (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low minor (vote)
Assignee: Jonathan Druart
QA Contact: Martin Renvoize
URL:
Keywords:
Depends on: 36177
Blocks:
  Show dependency treegraph
 
Reported: 2024-03-19 08:13 UTC by Jonathan Druart
Modified: 2024-03-21 11:05 UTC (History)
2 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


Attachments
Bug 36355: Prevent csrf.ts to fail if DB has libraries with long name (1.89 KB, patch)
2024-03-19 08:34 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 36355: Prevent csrf.ts to fail if DB has libraries with long name (1.95 KB, patch)
2024-03-20 10:24 UTC, Martin Renvoize
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Druart 2024-03-19 08:13:07 UTC
The test is selecting "All" in the length dropdown list of DT, but the query takes more than the timeout delay (10sec) and we never see the "Delete" button.

We could fix this failure but actually it is catching another problem: we should not have that many libraries in the DB.

Koha_Master/2813

koha_1       |   Running:  Auth/csrf.ts                                                                   (3 of 15)
koha_1       | <?xml version="1.0" encoding="UTF-8"?>
koha_1       | <testsuites name="Mocha Tests" time="41.862" tests="6" failures="2">
koha_1       |   <testsuite name="Root Suite" timestamp="2024-03-18T11:18:40" tests="0" file="t/cypress/integration/Auth/csrf.ts" time="0.000" failures="0">
koha_1       |   </testsuite>
koha_1       |   <testsuite name="CSRF" timestamp="2024-03-18T11:18:40" tests="6" time="41.845" failures="2">
koha_1       |     <testcase name="CSRF Add using POST without csrf" time="3.693" classname="Add using POST without csrf">
koha_1       |     </testcase>
koha_1       |     <testcase name="CSRF Add using POST with invalid csrf" time="3.749" classname="Add using POST with invalid csrf">
koha_1       |     </testcase>
koha_1       |     <testcase name="CSRF Add using GET" time="1.737" classname="Add using GET">
koha_1       |     </testcase>
koha_1       |     <testcase name="CSRF Add" time="5.895" classname="Add">
koha_1       |     </testcase>
koha_1       |     <testcase name="CSRF Delete without CSRF" time="0.000" classname="Delete without CSRF">
koha_1       |       <failure message="Timed out retrying after 10050ms: `cy.click()` failed because the center of this element is hidden from view:
koha_1       | 
koha_1       | `&lt;button type=&quot;submit&quot; id=&quot;delete_library_TEST_LIB&quot; class=&quot;btn btn-default btn-xs&quot; role=&quot;button&quot;&gt;...&lt;/button&gt;`
koha_1       | 
koha_1       | Fix this problem, or use `{force: true}` to disable error checking.
koha_1       | 
koha_1       | https://on.cypress.io/element-cannot-be-interacted-with" type="CypressError"><![CDATA[CypressError: Timed out retrying after 10050ms: `cy.click()` failed because the center of this element is hidden from view:
koha_1       | 
koha_1       | `<button type="submit" id="delete_library_TEST_LIB" class="btn btn-default btn-xs" role="button">...</button>`
koha_1       | 
koha_1       | Fix this problem, or use `{force: true}` to disable error checking.
Comment 1 Jonathan Druart 2024-03-19 08:14:04 UTC Comment hidden (obsolete)
Comment 2 Jonathan Druart 2024-03-19 08:34:02 UTC
Created attachment 163382 [details] [review]
Bug 36355: Prevent csrf.ts to fail if DB has libraries with long name

If one library has a long name the "Delete" button will not appear on
the screen and the cypress test will fail
 Timed out retrying after 10050ms: `cy.click()` failed because the center of this element is hidden from view

We can either increase the size of the screen or force the click even if
the button is not visible.

Test plan:
Edit a library and set info with long name, address, etc.
Run the cypress test:
  yarn cypress run --spec t/cypress/integration/Auth/csrf.ts
Note the failure, you can watch the video and notice that the delete
button is not on the screen (t/cypress/videos/csrf.ts.mp4)
Apply the patch, try again
=> Succes
Comment 3 Jonathan Druart 2024-03-19 08:35:21 UTC Comment hidden (obsolete)
Comment 4 Martin Renvoize 2024-03-20 10:24:52 UTC
Created attachment 163519 [details] [review]
Bug 36355: Prevent csrf.ts to fail if DB has libraries with long name

If one library has a long name the "Delete" button will not appear on
the screen and the cypress test will fail
 Timed out retrying after 10050ms: `cy.click()` failed because the center of this element is hidden from view

We can either increase the size of the screen or force the click even if
the button is not visible.

Test plan:
Edit a library and set info with long name, address, etc.
Run the cypress test:
  yarn cypress run --spec t/cypress/integration/Auth/csrf.ts
Note the failure, you can watch the video and notice that the delete
button is not on the screen (t/cypress/videos/csrf.ts.mp4)
Apply the patch, try again
=> Succes

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 5 Martin Renvoize 2024-03-20 10:25:58 UTC
This makes sense to me now I've worked through it.. I was slightly torn as to whether we should 'fix' testbuilder to create shorter library names.. but I think it's actually useful to catch these things.  The fix here works as intended and makes sense to me.

Passing QA straight.
Comment 6 Katrin Fischer 2024-03-20 17:40:39 UTC
Pushed for 24.05!

Well done everyone, thank you!
Comment 7 Fridolin Somers 2024-03-21 11:05:55 UTC
Depends on Bug 36177 not in 23.11.x