Bug 34920: Add cypress tests

Run the agreements cypress test spec:

cypress run --spec t/cypress/integration/ERM/Agreements_spec.ts

Signed-off-by: Laura Escamilla <laura.escamilla@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Pedro Amorim 2024-02-29 16:06:39 +00:00 committed by Katrin Fischer
parent c81a4bb213
commit 631f146ec3
Signed by: kfischer
GPG key ID: 0EF6E2C03357A834
2 changed files with 906 additions and 0 deletions

View file

@ -135,6 +135,7 @@ describe("Agreement CRUD operations", () => {
it("Add agreement", () => {
let agreement = cy.get_agreement();
let vendors = cy.get_vendors_to_relate();
let av_cat_values = cy.get_ERM_av_cats_values();
// No agreement, no license yet
cy.intercept("GET", "/api/v1/erm/agreements*", {
statusCode: 200,
@ -150,6 +151,11 @@ describe("Agreement CRUD operations", () => {
body: vendors,
});
cy.intercept("GET", "/api/v1/authorised_value_categories*", {
statusCode: 200,
body: av_cat_values,
}).as("get-ERM-av-cats-values");
// Click the button in the toolbar
cy.visit("/cgi-bin/koha/erm/agreements");
cy.contains("New agreement").click();
@ -169,6 +175,20 @@ describe("Agreement CRUD operations", () => {
"have.length",
1
); // name, description, status
cy.get("#agreement_status .vs__search").type("closed" + "{enter}", {
force: true,
});
cy.get("#agreement_closure_reason .vs__search").click();
let closure_reasons = av_cat_values.find(
av_cat => av_cat.category_name === "ERM_AGREEMENT_CLOSURE_REASON"
);
cy.get("#agreement_closure_reason #vs3__option-0").contains(
closure_reasons.authorised_values[0].description
);
cy.get("#agreement_closure_reason #vs3__option-1").should("be.empty");
cy.get("#agreement_status .vs__search").type(
agreement.status + "{enter}",
{ force: true }

View file

@ -131,6 +131,892 @@ cy.get_agreement = () => {
};
}
cy.get_ERM_av_cats_values = () => {
return [
{
authorised_values: [
{
authorised_value_id: 11,
category_name: "ERM_AGREEMENT_CLOSURE_REASON",
description: "Expired",
image_url: null,
opac_description: null,
value: "expired",
},
{
authorised_value_id: 12,
category_name: "ERM_AGREEMENT_CLOSURE_REASON",
description: null,
image_url: "",
opac_description: null,
value: "cancelled",
},
],
category_name: "ERM_AGREEMENT_CLOSURE_REASON",
is_system: true,
},
{
authorised_values: [
{
authorised_value_id: 30,
category_name: "ERM_AGREEMENT_LICENSE_LOCATION",
description: "Filing cabinet",
image_url: null,
opac_description: null,
value: "filing_cabinet",
},
{
authorised_value_id: 31,
category_name: "ERM_AGREEMENT_LICENSE_LOCATION",
description: "Cupboard",
image_url: null,
opac_description: null,
value: "cupboard",
},
],
category_name: "ERM_AGREEMENT_LICENSE_LOCATION",
is_system: true,
},
{
authorised_values: [
{
authorised_value_id: 27,
category_name: "ERM_AGREEMENT_LICENSE_STATUS",
description: "Controlling",
image_url: null,
opac_description: null,
value: "controlling",
},
{
authorised_value_id: 28,
category_name: "ERM_AGREEMENT_LICENSE_STATUS",
description: "Future",
image_url: null,
opac_description: null,
value: "future",
},
{
authorised_value_id: 29,
category_name: "ERM_AGREEMENT_LICENSE_STATUS",
description: "Historic",
image_url: null,
opac_description: null,
value: "history",
},
],
category_name: "ERM_AGREEMENT_LICENSE_STATUS",
is_system: true,
},
{
authorised_values: [
{
authorised_value_id: 13,
category_name: "ERM_AGREEMENT_RENEWAL_PRIORITY",
description: "For review",
image_url: null,
opac_description: null,
value: "for_review",
},
{
authorised_value_id: 14,
category_name: "ERM_AGREEMENT_RENEWAL_PRIORITY",
description: "Renew",
image_url: null,
opac_description: null,
value: "renew",
},
{
authorised_value_id: 15,
category_name: "ERM_AGREEMENT_RENEWAL_PRIORITY",
description: "Cancel",
image_url: null,
opac_description: null,
value: "cancel",
},
],
category_name: "ERM_AGREEMENT_RENEWAL_PRIORITY",
is_system: true,
},
{
authorised_values: [
{
authorised_value_id: 8,
category_name: "ERM_AGREEMENT_STATUS",
description: "Active",
image_url: null,
opac_description: null,
value: "active",
},
{
authorised_value_id: 9,
category_name: "ERM_AGREEMENT_STATUS",
description: "In negotiation",
image_url: null,
opac_description: null,
value: "in_negotiation",
},
{
authorised_value_id: 10,
category_name: "ERM_AGREEMENT_STATUS",
description: "Closed",
image_url: null,
opac_description: null,
value: "closed",
},
],
category_name: "ERM_AGREEMENT_STATUS",
is_system: true,
},
{
authorised_values: [
{
authorised_value_id: 81,
category_name: "ERM_DATABASE_REPORTS_METRICS",
description: "Searches automated",
image_url: null,
opac_description: null,
value: "Searches_Automated",
},
{
authorised_value_id: 82,
category_name: "ERM_DATABASE_REPORTS_METRICS",
description: "Searches federated",
image_url: null,
opac_description: null,
value: "Searches_Federated",
},
{
authorised_value_id: 83,
category_name: "ERM_DATABASE_REPORTS_METRICS",
description: "Searches regular",
image_url: null,
opac_description: null,
value: "Searches_Regular",
},
{
authorised_value_id: 84,
category_name: "ERM_DATABASE_REPORTS_METRICS",
description: "Total item investigations",
image_url: null,
opac_description: null,
value: "Total_Item_Investigations",
},
{
authorised_value_id: 85,
category_name: "ERM_DATABASE_REPORTS_METRICS",
description: "Total item requests",
image_url: null,
opac_description: null,
value: "Total_Item_Requests",
},
{
authorised_value_id: 86,
category_name: "ERM_DATABASE_REPORTS_METRICS",
description: "Unique item investigations",
image_url: null,
opac_description: null,
value: "Unique_Item_Investigations",
},
{
authorised_value_id: 87,
category_name: "ERM_DATABASE_REPORTS_METRICS",
description: "Unique item requests",
image_url: null,
opac_description: null,
value: "Unique_Item_Requests",
},
{
authorised_value_id: 88,
category_name: "ERM_DATABASE_REPORTS_METRICS",
description: "Unique title investigations",
image_url: null,
opac_description: null,
value: "Unique_Title_Investigations",
},
{
authorised_value_id: 89,
category_name: "ERM_DATABASE_REPORTS_METRICS",
description: "Unique title requests",
image_url: null,
opac_description: null,
value: "Unique_Title_Requests",
},
{
authorised_value_id: 90,
category_name: "ERM_DATABASE_REPORTS_METRICS",
description: "No license",
image_url: null,
opac_description: null,
value: "No_License",
},
{
authorised_value_id: 91,
category_name: "ERM_DATABASE_REPORTS_METRICS",
description: "Limit exceeded",
image_url: null,
opac_description: null,
value: "Limit_Exceeded",
},
],
category_name: "ERM_DATABASE_REPORTS_METRICS",
is_system: true,
},
{
authorised_values: [
{
authorised_value_id: 100,
category_name: "ERM_ITEM_REPORTS_METRICS",
description: "Total item investigations",
image_url: null,
opac_description: null,
value: "Total_Item_Investigations",
},
{
authorised_value_id: 101,
category_name: "ERM_ITEM_REPORTS_METRICS",
description: "Total item requests",
image_url: null,
opac_description: null,
value: "Total_Item_Requests",
},
{
authorised_value_id: 102,
category_name: "ERM_ITEM_REPORTS_METRICS",
description: "Unique item investigations",
image_url: null,
opac_description: null,
value: "Unique_Item_Investigations",
},
{
authorised_value_id: 103,
category_name: "ERM_ITEM_REPORTS_METRICS",
description: "Unique item requests",
image_url: null,
opac_description: null,
value: "Unique_Item_Requests",
},
{
authorised_value_id: 104,
category_name: "ERM_ITEM_REPORTS_METRICS",
description: "Limit exceeded",
image_url: null,
opac_description: null,
value: "Limit_Exceeded",
},
{
authorised_value_id: 105,
category_name: "ERM_ITEM_REPORTS_METRICS",
description: "No license",
image_url: null,
opac_description: null,
value: "No_License",
},
],
category_name: "ERM_ITEM_REPORTS_METRICS",
is_system: true,
},
{
authorised_values: [
{
authorised_value_id: 22,
category_name: "ERM_LICENSE_STATUS",
description: "In negotiation",
image_url: null,
opac_description: null,
value: "in_negotiation",
},
{
authorised_value_id: 23,
category_name: "ERM_LICENSE_STATUS",
description: "Not yet active",
image_url: null,
opac_description: null,
value: "not_yet_active",
},
{
authorised_value_id: 24,
category_name: "ERM_LICENSE_STATUS",
description: "Active",
image_url: null,
opac_description: null,
value: "active",
},
{
authorised_value_id: 25,
category_name: "ERM_LICENSE_STATUS",
description: "Rejected",
image_url: null,
opac_description: null,
value: "rejected",
},
{
authorised_value_id: 26,
category_name: "ERM_LICENSE_STATUS",
description: "Expired",
image_url: null,
opac_description: null,
value: "expired",
},
],
category_name: "ERM_LICENSE_STATUS",
is_system: true,
},
{
authorised_values: [
{
authorised_value_id: 18,
category_name: "ERM_LICENSE_TYPE",
description: "Local",
image_url: null,
opac_description: null,
value: "local",
},
{
authorised_value_id: 19,
category_name: "ERM_LICENSE_TYPE",
description: "Consortial",
image_url: null,
opac_description: null,
value: "consortial",
},
{
authorised_value_id: 20,
category_name: "ERM_LICENSE_TYPE",
description: "National",
image_url: null,
opac_description: null,
value: "national",
},
{
authorised_value_id: 21,
category_name: "ERM_LICENSE_TYPE",
description: "Alliance",
image_url: null,
opac_description: null,
value: "alliance",
},
],
category_name: "ERM_LICENSE_TYPE",
is_system: true,
},
{
authorised_values: [
{
authorised_value_id: 34,
category_name: "ERM_PACKAGE_CONTENT_TYPE",
description: "Aggregated full",
image_url: null,
opac_description: null,
value: "AggregatedFullText",
},
{
authorised_value_id: 35,
category_name: "ERM_PACKAGE_CONTENT_TYPE",
description: "Abstract and index",
image_url: null,
opac_description: null,
value: "AbstractAndIndex",
},
{
authorised_value_id: 36,
category_name: "ERM_PACKAGE_CONTENT_TYPE",
description: "E-book",
image_url: null,
opac_description: null,
value: "EBook",
},
{
authorised_value_id: 37,
category_name: "ERM_PACKAGE_CONTENT_TYPE",
description: "Mixed content",
image_url: null,
opac_description: null,
value: "MixedContent",
},
{
authorised_value_id: 38,
category_name: "ERM_PACKAGE_CONTENT_TYPE",
description: "E-journal",
image_url: null,
opac_description: null,
value: "EJournal",
},
{
authorised_value_id: 39,
category_name: "ERM_PACKAGE_CONTENT_TYPE",
description: "Online reference",
image_url: null,
opac_description: null,
value: "OnlineReference",
},
{
authorised_value_id: 40,
category_name: "ERM_PACKAGE_CONTENT_TYPE",
description: "Print",
image_url: null,
opac_description: null,
value: "Print",
},
{
authorised_value_id: 41,
category_name: "ERM_PACKAGE_CONTENT_TYPE",
description: "Streaming media",
image_url: null,
opac_description: null,
value: "StreamingMedia",
},
{
authorised_value_id: 42,
category_name: "ERM_PACKAGE_CONTENT_TYPE",
description: "Unknown",
image_url: null,
opac_description: null,
value: "Unknown",
},
],
category_name: "ERM_PACKAGE_CONTENT_TYPE",
is_system: true,
},
{
authorised_values: [
{
authorised_value_id: 32,
category_name: "ERM_PACKAGE_TYPE",
description: "Local",
image_url: null,
opac_description: null,
value: "local",
},
{
authorised_value_id: 33,
category_name: "ERM_PACKAGE_TYPE",
description: "Complete",
image_url: null,
opac_description: null,
value: "complete",
},
],
category_name: "ERM_PACKAGE_TYPE",
is_system: true,
},
{
authorised_values: [
{
authorised_value_id: 74,
category_name: "ERM_PLATFORM_REPORTS_METRICS",
description: "Searches platform",
image_url: null,
opac_description: null,
value: "Searches_Platform",
},
{
authorised_value_id: 75,
category_name: "ERM_PLATFORM_REPORTS_METRICS",
description: "Total item investigations",
image_url: null,
opac_description: null,
value: "Total_Item_Investigations",
},
{
authorised_value_id: 76,
category_name: "ERM_PLATFORM_REPORTS_METRICS",
description: "Total item requests",
image_url: null,
opac_description: null,
value: "Total_Item_Requests",
},
{
authorised_value_id: 77,
category_name: "ERM_PLATFORM_REPORTS_METRICS",
description: "Unique item investigations",
image_url: null,
opac_description: null,
value: "Unique_Item_Investigations",
},
{
authorised_value_id: 78,
category_name: "ERM_PLATFORM_REPORTS_METRICS",
description: "Unique item requests",
image_url: null,
opac_description: null,
value: "Unique_Item_Requests",
},
{
authorised_value_id: 79,
category_name: "ERM_PLATFORM_REPORTS_METRICS",
description: "Unique title investigations",
image_url: null,
opac_description: null,
value: "Unique_Title_Investigations",
},
{
authorised_value_id: 80,
category_name: "ERM_PLATFORM_REPORTS_METRICS",
description: "Unique title requests",
image_url: null,
opac_description: null,
value: "Unique_Title_Requests",
},
],
category_name: "ERM_PLATFORM_REPORTS_METRICS",
is_system: true,
},
{
authorised_values: [
{
authorised_value_id: 58,
category_name: "ERM_REPORT_TYPES",
description: "PR - Platform master report",
image_url: null,
opac_description: null,
value: "PR",
},
{
authorised_value_id: 59,
category_name: "ERM_REPORT_TYPES",
description: "PR_P1 - Platform usage",
image_url: null,
opac_description: null,
value: "PR_P1",
},
{
authorised_value_id: 60,
category_name: "ERM_REPORT_TYPES",
description: "DR - Database master report",
image_url: null,
opac_description: null,
value: "DR",
},
{
authorised_value_id: 61,
category_name: "ERM_REPORT_TYPES",
description: "DR_D1 - Database search and item usage",
image_url: null,
opac_description: null,
value: "DR_D1",
},
{
authorised_value_id: 62,
category_name: "ERM_REPORT_TYPES",
description: "DR_D2 - Database access denied",
image_url: null,
opac_description: null,
value: "DR_D2",
},
{
authorised_value_id: 63,
category_name: "ERM_REPORT_TYPES",
description: "TR - Title master report",
image_url: null,
opac_description: null,
value: "TR",
},
{
authorised_value_id: 64,
category_name: "ERM_REPORT_TYPES",
description: "TR_B1 - Book requests (excluding OA_Gold)",
image_url: null,
opac_description: null,
value: "TR_B1",
},
{
authorised_value_id: 65,
category_name: "ERM_REPORT_TYPES",
description: "TR_B2 - Book access denied",
image_url: null,
opac_description: null,
value: "TR_B2",
},
{
authorised_value_id: 66,
category_name: "ERM_REPORT_TYPES",
description: "TR_B3 - Book usage by access type",
image_url: null,
opac_description: null,
value: "TR_B3",
},
{
authorised_value_id: 67,
category_name: "ERM_REPORT_TYPES",
description: "TR_J1 - Journal requests (excluding OA_Gold)",
image_url: null,
opac_description: null,
value: "TR_J1",
},
{
authorised_value_id: 68,
category_name: "ERM_REPORT_TYPES",
description: "TR_J2 - Journal access denied",
image_url: null,
opac_description: null,
value: "TR_J2",
},
{
authorised_value_id: 69,
category_name: "ERM_REPORT_TYPES",
description: "TR_J3 - Journal usage by access type",
image_url: null,
opac_description: null,
value: "TR_J3",
},
{
authorised_value_id: 70,
category_name: "ERM_REPORT_TYPES",
description:
"TR_J4 - Journal requests by YOP(excluding OA_Gold)",
image_url: null,
opac_description: null,
value: "TR_J4",
},
{
authorised_value_id: 71,
category_name: "ERM_REPORT_TYPES",
description: "IR - Item master report",
image_url: null,
opac_description: null,
value: "IR",
},
{
authorised_value_id: 72,
category_name: "ERM_REPORT_TYPES",
description: "IR_A1 - Journal article requests",
image_url: null,
opac_description: null,
value: "IR_A1",
},
{
authorised_value_id: 73,
category_name: "ERM_REPORT_TYPES",
description: "IR_M1 - Multimedia item requests",
image_url: null,
opac_description: null,
value: "IR_M1",
},
],
category_name: "ERM_REPORT_TYPES",
is_system: true,
},
{
authorised_values: [
{
authorised_value_id: 43,
category_name: "ERM_TITLE_PUBLICATION_TYPE",
description: "Journal",
image_url: null,
opac_description: null,
value: "journal",
},
{
authorised_value_id: 44,
category_name: "ERM_TITLE_PUBLICATION_TYPE",
description: "Newsletter",
image_url: null,
opac_description: null,
value: "newsletter",
},
{
authorised_value_id: 45,
category_name: "ERM_TITLE_PUBLICATION_TYPE",
description: "Report",
image_url: null,
opac_description: null,
value: "report",
},
{
authorised_value_id: 46,
category_name: "ERM_TITLE_PUBLICATION_TYPE",
description: "Proceedings",
image_url: null,
opac_description: null,
value: "proceedings",
},
{
authorised_value_id: 47,
category_name: "ERM_TITLE_PUBLICATION_TYPE",
description: "Website",
image_url: null,
opac_description: null,
value: "website",
},
{
authorised_value_id: 48,
category_name: "ERM_TITLE_PUBLICATION_TYPE",
description: "Newspaper",
image_url: null,
opac_description: null,
value: "newspaper",
},
{
authorised_value_id: 49,
category_name: "ERM_TITLE_PUBLICATION_TYPE",
description: "Unspecified",
image_url: null,
opac_description: null,
value: "unspecified",
},
{
authorised_value_id: 50,
category_name: "ERM_TITLE_PUBLICATION_TYPE",
description: "Book",
image_url: null,
opac_description: null,
value: "book",
},
{
authorised_value_id: 51,
category_name: "ERM_TITLE_PUBLICATION_TYPE",
description: "E-book",
image_url: null,
opac_description: null,
value: "ebook",
},
{
authorised_value_id: 52,
category_name: "ERM_TITLE_PUBLICATION_TYPE",
description: "Bookseries",
image_url: null,
opac_description: null,
value: "bookseries",
},
{
authorised_value_id: 53,
category_name: "ERM_TITLE_PUBLICATION_TYPE",
description: "Database",
image_url: null,
opac_description: null,
value: "database",
},
{
authorised_value_id: 54,
category_name: "ERM_TITLE_PUBLICATION_TYPE",
description: "Thesis/Dissertation",
image_url: null,
opac_description: null,
value: "thesisdissertation",
},
{
authorised_value_id: 55,
category_name: "ERM_TITLE_PUBLICATION_TYPE",
description: "Streaming audio",
image_url: null,
opac_description: null,
value: "streamingaudio",
},
{
authorised_value_id: 56,
category_name: "ERM_TITLE_PUBLICATION_TYPE",
description: "Streaming video",
image_url: null,
opac_description: null,
value: "streamingvideo",
},
{
authorised_value_id: 57,
category_name: "ERM_TITLE_PUBLICATION_TYPE",
description: "Audiobook",
image_url: null,
opac_description: null,
value: "audiobook",
},
],
category_name: "ERM_TITLE_PUBLICATION_TYPE",
is_system: true,
},
{
authorised_values: [
{
authorised_value_id: 92,
category_name: "ERM_TITLE_REPORTS_METRICS",
description: "Total item investigations",
image_url: null,
opac_description: null,
value: "Total_Item_Investigations",
},
{
authorised_value_id: 93,
category_name: "ERM_TITLE_REPORTS_METRICS",
description: "Total item requests",
image_url: null,
opac_description: null,
value: "Total_Item_Requests",
},
{
authorised_value_id: 94,
category_name: "ERM_TITLE_REPORTS_METRICS",
description: "Unique item investigations",
image_url: null,
opac_description: null,
value: "Unique_Item_Investigations",
},
{
authorised_value_id: 95,
category_name: "ERM_TITLE_REPORTS_METRICS",
description: "Unique item requests",
image_url: null,
opac_description: null,
value: "Unique_Item_Requests",
},
{
authorised_value_id: 96,
category_name: "ERM_TITLE_REPORTS_METRICS",
description: "Unique title investigations",
image_url: null,
opac_description: null,
value: "Unique_Title_Investigations",
},
{
authorised_value_id: 97,
category_name: "ERM_TITLE_REPORTS_METRICS",
description: "Unique title requests",
image_url: null,
opac_description: null,
value: "Unique_Title_Requests",
},
{
authorised_value_id: 98,
category_name: "ERM_TITLE_REPORTS_METRICS",
description: "Limit exceeded",
image_url: null,
opac_description: null,
value: "Limit_Exceeded",
},
{
authorised_value_id: 99,
category_name: "ERM_TITLE_REPORTS_METRICS",
description: "No license",
image_url: null,
opac_description: null,
value: "No_License",
},
],
category_name: "ERM_TITLE_REPORTS_METRICS",
is_system: true,
},
{
authorised_values: [
{
authorised_value_id: 16,
category_name: "ERM_USER_ROLES",
description: "ERM librarian",
image_url: null,
opac_description: null,
value: "librarian",
},
{
authorised_value_id: 17,
category_name: "ERM_USER_ROLES",
description: "Subject specialist",
image_url: null,
opac_description: null,
value: "subject_specialist",
},
],
category_name: "ERM_USER_ROLES",
is_system: true,
},
];
}
cy.get_licenses_to_relate = () => {
return [
{