42 lines
1.3 KiB
JavaScript
42 lines
1.3 KiB
JavaScript
import { login } from "./helpers";
|
|
|
|
// constants
|
|
const COURSE_SELECT = "[data-cy=appointments-course-select]";
|
|
const SESSION_SELECT = "[data-cy=appointments-session-select]";
|
|
const CIRCLE_SELECT = "[data-cy=appointments-circle-select]";
|
|
const APPOINTMENTS = "[data-cy=appointments-list]";
|
|
|
|
describe("appointments.cy.js", () => {
|
|
beforeEach(() => {
|
|
cy.manageCommand("cypress_reset");
|
|
login("test-student2@example.com", "test");
|
|
cy.visit("/course/test-lehrgang/appointments");
|
|
});
|
|
|
|
it("preselects first course (Test Lehrgang)", () => {
|
|
cy.visit("/course/test-lehrgang/appointments");
|
|
cy.get(COURSE_SELECT).should("contain", "Test Lehrgang");
|
|
cy.get(SESSION_SELECT).should("contain", "Bern");
|
|
cy.get(CIRCLE_SELECT).should("contain", "Alle");
|
|
|
|
cy.get(".cy-single-due-date").should("have.length", 5);
|
|
});
|
|
|
|
it("can filter by circle", () => {
|
|
cy.get(CIRCLE_SELECT).click();
|
|
cy.get(CIRCLE_SELECT).contains("Fahrzeug").click();
|
|
|
|
// THEN
|
|
cy.get(APPOINTMENTS).should("not.contain", "Keine Termine");
|
|
});
|
|
|
|
it("can switch course session", () => {
|
|
cy.get(SESSION_SELECT).click();
|
|
cy.get(SESSION_SELECT).contains("Zürich").click();
|
|
cy.get(SESSION_SELECT).should("contain", "Zürich");
|
|
|
|
// THEN
|
|
cy.get(APPOINTMENTS).should("contain", "Keine Termine");
|
|
});
|
|
});
|