Jonathan Druart
9470aa25fb
Signed-off-by: Owen Leonard <oleonard@myacpl.org> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
79 lines
2.3 KiB
TypeScript
79 lines
2.3 KiB
TypeScript
import { mount } from "@cypress/vue";
|
|
|
|
describe("Add/search user", () => {
|
|
beforeEach(() => {
|
|
cy.login();
|
|
cy.title().should("eq", "Koha staff interface");
|
|
cy.intercept(
|
|
"GET",
|
|
"/api/v1/erm/config",
|
|
'{"settings":{"ERMModule":"1","ERMProviders":["local"]}}'
|
|
);
|
|
});
|
|
|
|
it("Add agreement", () => {
|
|
let vendors = cy.get_vendors_to_relate();
|
|
// No agreement, no license yet
|
|
cy.intercept("GET", "/api/v1/erm/agreements*", {
|
|
statusCode: 200,
|
|
body: [],
|
|
});
|
|
cy.intercept("GET", "/api/v1/erm/licenses*", {
|
|
statusCode: 200,
|
|
body: [],
|
|
});
|
|
|
|
//Intercept patrons request
|
|
cy.intercept("GET", "/api/v1/patrons*", {
|
|
statusCode: 200,
|
|
body: [
|
|
{
|
|
patron_id: 1,
|
|
firstname: "foo",
|
|
surname: "bar",
|
|
category_id: "S",
|
|
library_id: "CPL",
|
|
},
|
|
{
|
|
patron_id: 2,
|
|
firstname: "foofoo",
|
|
surname: "barbar",
|
|
category_id: "S",
|
|
library_id: "CPL",
|
|
},
|
|
],
|
|
headers: {
|
|
"X-Base-Total-Count": "2",
|
|
"X-Total-Count": "2",
|
|
},
|
|
});
|
|
|
|
cy.intercept("GET", "/api/v1/patrons/1", {
|
|
statusCode: 200,
|
|
body: {
|
|
patron_id: 1,
|
|
firstname: "foo",
|
|
surname: "bar",
|
|
category_id: "S",
|
|
library_id: "CPL",
|
|
},
|
|
});
|
|
|
|
// Click the button in the toolbar
|
|
cy.visit("/cgi-bin/koha/erm/agreements");
|
|
cy.contains("New agreement").click();
|
|
cy.get("#agreements_add h2").contains("New agreement");
|
|
cy.left_menu_active_item_is("Agreements");
|
|
|
|
cy.contains("Add new user").click();
|
|
cy.contains("Select user").click();
|
|
cy.get("#patron_search_modal fieldset.action")
|
|
.contains("Search")
|
|
.click();
|
|
|
|
cy.get("#patron_search_modal table").contains("bar, foo");
|
|
cy.get("#patron_search_modal td").contains("Select").click();
|
|
|
|
cy.get("#user_roles li:first span.user").contains("foo bar");
|
|
});
|
|
});
|