From 374b69a32760552fa514e6cbafc83a732c23c0f6 Mon Sep 17 00:00:00 2001 From: Arthur Suzuki Date: Thu, 27 Jun 2024 11:55:15 +0200 Subject: [PATCH] Bug 36372: Cypress tests --- .../integration/Catalogue/Detail_spec.ts | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 t/cypress/integration/Catalogue/Detail_spec.ts diff --git a/t/cypress/integration/Catalogue/Detail_spec.ts b/t/cypress/integration/Catalogue/Detail_spec.ts new file mode 100644 index 00000000000..8175a4b3d60 --- /dev/null +++ b/t/cypress/integration/Catalogue/Detail_spec.ts @@ -0,0 +1,37 @@ +import { mount } from "@cypress/vue"; +const dayjs = require("dayjs"); /* Cannot use our calendar JS code, it's in an include file (!) + Also note that moment.js is deprecated */ + +describe("Set record_source button is present", () => { + before(() => { + cy.login(); + cy.title().should("eq", "Koha staff interface"); + cy.visit("/cgi-bin/koha/admin/record_sources"); + cy.contains("New record source").click(); + cy.get("#name").type("Poop"); + cy.get("#record_source_edit").contains("Submit").click(); + }); + + after(() => { + cy.visit("/cgi-bin/koha/cataloguing/record_source.pl?biblionumber=51"); + cy.get("select").select("No specified source"); + cy.get("input[type=submit]").click(); + + cy.intercept("GET", '/api/v1/record_sources*').as('listSources') + cy.visit("/cgi-bin/koha/admin/record_sources"); + cy.wait('@listSources') + cy.get("tr:last-child a.delete").click(); + cy.contains("Poop"); + cy.get("button.approve").click(); + }); + + it("Set record source", () => { + cy.visit("/cgi-bin/koha/catalogue/detail.pl?biblionumber=51"); + cy.contains("Edit").click(); + cy.contains("Set record source").click(); + cy.get("#record_source_id").select("Poop"); + cy.contains("Set record source").click(); + cy.visit("/cgi-bin/koha/catalogue/detail.pl?biblionumber=51"); + cy.get("#catalogue_detail_record_source").contains("Poop"); + }); +}); \ No newline at end of file -- 2.39.2