From 15d94d07de2a80c02996df124a1118b8b87afe33 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 3 May 2022 13:56:55 +0200 Subject: [PATCH] Bug 32030: ERM - Add a "show agreement" view Signed-off-by: Jonathan Field Signed-off-by: Martin Renvoize Signed-off-by: Kyle M Hall Signed-off-by: Tomas Cohen Arazi --- cypress/integration/Agreements_spec.ts | 27 +++ .../intranet-tmpl/prog/js/vue/Agreements.vue | 17 +- .../js/vue/components/ERM/AgreementsList.vue | 29 ++- .../js/vue/components/ERM/AgreementsShow.vue | 199 ++++++++++++++++++ 4 files changed, 265 insertions(+), 7 deletions(-) create mode 100644 koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementsShow.vue diff --git a/cypress/integration/Agreements_spec.ts b/cypress/integration/Agreements_spec.ts index d50203d120..c50a5f9103 100644 --- a/cypress/integration/Agreements_spec.ts +++ b/cypress/integration/Agreements_spec.ts @@ -225,6 +225,33 @@ describe("Agreement CRUD operations", () => { cy.get("#agreements").contains("Agreement updated"); }); + it ("Show agreement", () => { + let agreement = get_agreement(); + let agreements = [agreement]; + // Click the "name" link from the list + cy.intercept("GET", "/api/v1/erm/agreements*", { + statusCode: 200, + body: agreements, + headers: { + "X-Base-Total-Count": "1", + "X-Total-Count": "1", + }, + }); + cy.intercept("GET", "/api/v1/erm/agreements/*", agreement).as("get-agreement"); + cy.visit("/cgi-bin/koha/erm/agreements.pl"); + let name_link = cy.get("#agreements table tbody tr:first td:first a"); + name_link.should("have.text", agreement.name + " (#" + agreement.agreement_id + ")"); + name_link.click(); + cy.wait("@get-agreement"); + cy.wait(500); // Cypress is too fast! Vue hasn't populated the form yet! + cy.get("#agreements h2").contains("Agreement #" + agreement.agreement_id); + + // TODO There are more to test here: + // Dates correctly formatted + // Vendors displayed + // AV's libs displayed + // Tables for periods and users + }); it ("Delete agreement", () => { let agreement = get_agreement(); let agreements = [agreement]; diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/Agreements.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/Agreements.vue index fdca901b24..17ee020460 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/Agreements.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/Agreements.vue @@ -12,6 +12,17 @@ @switch-view="switchView" @set-error="setError" /> + -- 2.39.5