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>
This commit is contained in:
Pedro Amorim 2024-05-08 15:26:52 +00:00 committed by Katrin Fischer
parent c6e2995d27
commit 46c5a51d58
Signed by: kfischer
GPG key ID: 0EF6E2C03357A834

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");
});
});