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 | `<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. 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.
We could improve the tests and for instance filter the table to only fetch the libraries we expect to be displayed, but as it's actually catching a bug from somewhere else I don't think we should focus on this now.
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
(In reply to Jonathan Druart from comment #1) > We could improve the tests and for instance filter the table to only fetch > the libraries we expect to be displayed, but as it's actually catching a bug > from somewhere else I don't think we should focus on this now. Not correct, it's actually not failing because of the number of libraries.
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>
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.
Pushed for 24.05! Well done everyone, thank you!
Depends on Bug 36177 not in 23.11.x