Bug 41384: Trying to fix SIP2/Accounts.ts random failures

The intercept is done too late, it must be done before we load the view,
and then we should wait for it.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Jonathan Druart 2026-03-18 13:11:21 +01:00
parent be37389414
commit c1ab7be960
No known key found for this signature in database
GPG Key ID: A085E712BEF0E0F0
1 changed files with 9 additions and 7 deletions

View File

@ -123,14 +123,21 @@ describe("Accounts", () => {
cy.intercept("GET", "/api/v1/sip2/accounts**", {
statusCode: 200,
body: [],
});
}).as("getAccounts");
cy.intercept("GET", "/api/v1/sip2/institutions*", institutions).as(
"getSIP2Institutions"
);
//TODO: intercept http://localhost:8081/api/v1/item_types?_per_page=-1
cy.intercept("GET", "/api/v1/item_types*", {
statusCode: 200,
body: cy.getItemTypes(),
}).as("getItemTypes");
// Click the button in the toolbar
cy.visit("/cgi-bin/koha/sip2/accounts");
cy.wait("@getAccounts");
cy.contains("New account").click();
cy.get("#accounts_add h2").contains("New account");
cy.left_menu_active_item_is("Accounts");
@ -143,7 +150,7 @@ describe("Accounts", () => {
);
cy.get("#login_id").type(account.login_id);
cy.wait("@getSIP2Institutions");
cy.wait(["@getSIP2Institutions", "@getItemTypes"]);
cy.get("#sip_institution_id .vs__search").type(
institutions[0].name + "{enter}",
{
@ -172,11 +179,6 @@ describe("Accounts", () => {
"CG"
);
//TODO: intercept http://localhost:8081/api/v1/item_types?_per_page=-1
cy.intercept("GET", "/api/v1/item_types*", {
statusCode: 200,
body: cy.getItemTypes(),
});
// blocked_item_types
cy.get("#blocked_item_types .vs__search").click();
cy.get("#blocked_item_types [id*=__option-0]").contains("Books");