Bug 36774: Add cypress tests

Inside k-t-d, run:
cypress run --spec t/cypress/integration/flatpickr_spec.ts

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 46c5a51d58)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit df53cb4e24)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Pedro Amorim 2024-05-08 15:26:52 +00:00 committed by Lucas Gass
parent a47024d8f1
commit 448dd0d2fc
1 changed files with 33 additions and 0 deletions

View File

@ -0,0 +1,33 @@
import { mount } from "@cypress/vue";
const dayjs = require("dayjs");
const dates = {
today_iso: dayjs().format("YYYY-MM-DD"),
today_us: dayjs().format("MM/DD/YYYY"),
tomorrow_iso: dayjs().add(1, "day").format("YYYY-MM-DD"),
tomorrow_us: dayjs().add(1, "day").format("MM/DD/YYYY"),
};
describe("Flatpickr", () => {
beforeEach(() => {
cy.login();
cy.title().should("eq", "Koha staff interface");
});
it("'Clear filter' works correctly", () => {
cy.visit("/cgi-bin/koha/circ/overdue.pl");
cy.get("#from+span > input").click();
cy.get(".flatpickr-calendar")
.eq(0)
.find("span.today")
.click({ force: true });
cy.get("#from").invoke("val").should("eq", dates["today_iso"]);
cy.get("#from+span > a").click();
cy.get("#from").invoke("val").should("have.length", 0);
cy.get("#from+span > input").should("exist");
});
});