51 lines
2.2 KiB
JavaScript
51 lines
2.2 KiB
JavaScript
import { login } from "./helpers";
|
|
|
|
function selectDropboxItem(dropboxSelector, item) {
|
|
cy.get(dropboxSelector).click();
|
|
cy.get(dropboxSelector).contains(item).click();
|
|
cy.get('[data-cy="title"]').should("contain", "Termine");
|
|
}
|
|
|
|
describe("dueDates.cy.js", () => {
|
|
beforeEach(() => {
|
|
cy.manageCommand("cypress_reset");
|
|
login("test-student2@example.com", "test");
|
|
cy.visit("/dashboard/due-dates");
|
|
});
|
|
|
|
it("can filter due dates by dropbox selects", () => {
|
|
cy.get('[data-cy="due-date-list"]').children().should("have.length", 7);
|
|
|
|
// can filter by session
|
|
selectDropboxItem('[data-cy="select-session"]', "Zürich");
|
|
cy.get('[data-cy="due-date-list"]').children().should("have.length", 1);
|
|
selectDropboxItem('[data-cy="select-session"]', "Bern");
|
|
cy.get('[data-cy="due-date-list"]').children().should("have.length", 6);
|
|
selectDropboxItem('[data-cy="select-session"]', "Alle");
|
|
cy.get('[data-cy="due-date-list"]').children().should("have.length", 7);
|
|
|
|
// can filter by circle
|
|
selectDropboxItem('[data-cy="select-circle"]', "Fahrzeug");
|
|
cy.get('[data-cy="due-date-list"]').children().should("have.length", 6);
|
|
selectDropboxItem('[data-cy="select-circle"]', "Reisen");
|
|
cy.get('[data-cy="due-date-list"]').children().should("have.length", 1);
|
|
selectDropboxItem('[data-cy="select-circle"]', "Alle");
|
|
cy.get('[data-cy="due-date-list"]').children().should("have.length", 7);
|
|
|
|
// can filter by types
|
|
selectDropboxItem('[data-cy="select-type"]', "Präsenzkurs");
|
|
cy.get('[data-cy="due-date-list"]').children().should("have.length", 3);
|
|
selectDropboxItem('[data-cy="select-type"]', "Bewertung");
|
|
cy.get('[data-cy="due-date-list"]').children().should("have.length", 1);
|
|
|
|
// combination
|
|
selectDropboxItem('[data-cy="select-session"]', "Bern");
|
|
selectDropboxItem('[data-cy="select-type"]', "Präsenzkurs");
|
|
cy.get('[data-cy="due-date-list"]').children().should("have.length", 2);
|
|
selectDropboxItem('[data-cy="select-session"]', "Zürich");
|
|
cy.get('[data-cy="due-date-list"]').children().should("have.length", 1);
|
|
selectDropboxItem('[data-cy="select-type"]', "Bewertung");
|
|
cy.get('[data-cy="due-date-list"]').should("contain", "Keine Termine");
|
|
});
|
|
});
|