We need a way to insert into the DB the objects generated via mockData
Created attachment 183372 [details] [review] Bug 40174: Allow proper E2E testing with Cypress This is the first step toward implementing true end-to-end testing with Cypress. Until now, we have been mocking responses using cy.intercept(), but this approach can lead to confusion. In some cases, we have even had to mock global JavaScript variables, which makes the code unnecessarily complex and unconventional (e.g. win.categories_map). All the bug reports listed under this tree have helped lay the groundwork for this patch. With it, we are able to build mock objects (via plugin mockData) and insert them directly into the database (insertData). Once the tests are complete, we’ll restore the database to its previous state by removing any data generated during the tests. The tests in KohaTable/Holdings_spec.ts have been updated to leverage this new setup. Additionally, a caching mechanism has been added to prevent _id attributes from being generated with the same values (a rare issue we occasionally encountered). While this is still not a perfect solution, it introduces a solid foundation for future improvements. Test plan: All Cypress tests must pass
Created attachment 183373 [details] [review] Bug 40174: Introduce Cypress auth plugin So we can easily retrieve the value for the Authorization header.
Created attachment 183374 [details] [review] Bug 40174: Use api-client