[Koha-bugs] [Bug 32898] Cypress tests are failing

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Wed Feb 8 12:08:16 CET 2023


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

--- Comment #3 from Jonathan Druart <jonathan.druart+koha at gmail.com> ---
Created attachment 146384
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=146384&action=edit
Bug 32898: ERM - Improve fetch

... and fix cypress tests

The main problem was that there were no more checkError call for
fetchLocalTitleCount
and the error was not displayed on the UI.

This commit is doing several things:
- Refactor fetch.js to call the same fetch method (myFetch) in order to
deal with the error in a single place
- Have a new myFetchTotal JS function to get the X-Total-Count header
from the response and get the benefit of the previous refactoring
- Rename fetchCountLocalPackages with fetchLocalPackagesCount to match
fetchLocalTitleCount
- Use fetchLocalPackagesCount on the Package list view
- Use checkError from components using fetch directly. Ideally the could
should be moved to fetch.js and myFetch should be used.
- checkError get a new flag in parameter to ask for the response instead
of the result (ie. the JSON of the response). That's useful when we need
the response status or the headers
- Make checkError throw a proper exception to stop propation. This
modify the error we display on the UI, it's why we have the following
changes in cypress tests:
-            "Something went wrong: Internal Server Error"
+            "Something went wrong: Error: Internal Server Error"
That's not ideal, we should have our own JS exception to avoid that
"Error" (coming from the toString call on the error)

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


More information about the Koha-bugs mailing list