156 lines
5.6 KiB
JavaScript
156 lines
5.6 KiB
JavaScript
import { login } from "../helpers";
|
|
import {
|
|
TEST_COURSE_SESSION_ZURICH_ID,
|
|
TEST_STUDENT1_USER_ID,
|
|
TEST_STUDENT1_VV_USER_ID,
|
|
TEST_STUDENT2_USER_ID,
|
|
} from "../../consts";
|
|
|
|
function selectDropboxItem(dropboxSelector, item) {
|
|
cy.get(dropboxSelector).click();
|
|
cy.get(dropboxSelector).contains(item).click();
|
|
}
|
|
|
|
describe("berufsbildner.cy.js", () => {
|
|
beforeEach(() => {
|
|
cy.manageCommand(
|
|
`cypress_reset --create-assignment-evaluation --assignment-evaluation-scores 4,6,4,3,2 --assignment-points-deducted 3 --create-edoniq-test-results 19 24 8 --edoniq-user-id ${TEST_STUDENT2_USER_ID} --edoniq-course-session-id ${TEST_COURSE_SESSION_ZURICH_ID}`,
|
|
);
|
|
});
|
|
|
|
it("check data on dashboard", () => {
|
|
login("test-berufsbildner1@example.com", "test");
|
|
cy.visit("/");
|
|
|
|
cy.get('[data-cy="panel-role-key"]').should("contain", "Berufsbildner");
|
|
|
|
cy.get('[data-cy="num-dashboard-persons"]').should("contain", "3 Personen");
|
|
|
|
cy.get('[data-cy="dashboard.stats.competenceGrades"]').should(
|
|
"contain",
|
|
"3.81",
|
|
);
|
|
|
|
cy.get('[data-cy="dashboard.stats.assignments"]').should("contain", "17%");
|
|
cy.get('[data-cy="dashboard.stats.assignments"]').should(
|
|
"contain",
|
|
"2 Elemente abgeschlossen",
|
|
);
|
|
|
|
cy.get('[data-cy="dashboard.mentor.menteeCountValue"]').should(
|
|
"contain",
|
|
"3",
|
|
);
|
|
});
|
|
|
|
it("check competence grades with subpages", () => {
|
|
login("test-berufsbildner1@example.com", "test");
|
|
cy.visit("/");
|
|
|
|
cy.get(
|
|
'[data-cy="dashboard.stats.competenceGrades"] [data-cy="basebox.detailsLink"]',
|
|
).click();
|
|
|
|
// check average grade filtered by dropbox selects
|
|
cy.get('[data-cy="average-grade-header"]').should("contain", "3.81");
|
|
|
|
selectDropboxItem('[data-cy="select-session"]', "Bern");
|
|
cy.get('[data-cy="average-grade-header"]').should("contain", "4.33");
|
|
|
|
selectDropboxItem('[data-cy="select-session"]', "Zürich");
|
|
cy.get('[data-cy="average-grade-header"]').should("contain", "3.29");
|
|
|
|
selectDropboxItem('[data-cy="select-session"]', "Alle");
|
|
cy.get('[data-cy="average-grade-header"]').should("contain", "3.81");
|
|
|
|
// go to competence certificate detail page
|
|
cy.get(
|
|
'[data-cy="competence-grade@-1-Kompetenznachweis 1"] [data-cy="basebox.detailsLink"]',
|
|
).click();
|
|
cy.get('[data-cy="total-average-grade"]').should("contain", "4.33");
|
|
cy.get(`[data-cy="person-${TEST_STUDENT1_USER_ID}"]`).should(
|
|
"contain",
|
|
"4.33",
|
|
);
|
|
cy.get('[data-cy="back-button"]').click();
|
|
|
|
cy.get(
|
|
'[data-cy="competence-grade@-2-Kompetenznachweis 1"] [data-cy="basebox.detailsLink"]',
|
|
).click();
|
|
cy.get('[data-cy="total-average-grade"]').should("contain", "3.29");
|
|
|
|
// open student profile link
|
|
cy.get(`[data-cy="person-${TEST_STUDENT2_USER_ID}"]`)
|
|
.find('[data-cy="person-learning-path-link"]')
|
|
.click();
|
|
|
|
cy.get('[data-cy="profileCompetence"]').click();
|
|
cy.get('[data-cy="side-menu-competenceCertificates"]').click();
|
|
|
|
cy.get('[data-cy="certificate-total-grade"]').should(
|
|
"contain",
|
|
"Note: 3.5",
|
|
);
|
|
cy.get(
|
|
'[data-cy="certificate-test-lehrgang-competencenavi-certificates-kompetenznachweis-1-grade-percent"]',
|
|
).should("contain", "3.29");
|
|
});
|
|
|
|
it("check competence elements with subpages", () => {
|
|
login("test-berufsbildner1@example.com", "test");
|
|
cy.visit("/");
|
|
|
|
cy.get(
|
|
'[data-cy="dashboard.stats.assignments"] [data-cy="basebox.detailsLink"]',
|
|
).click();
|
|
|
|
// check assignment filter
|
|
cy.get('[data-cy="statistics-filter-list-item"]').should("have.length", 4);
|
|
selectDropboxItem('[data-cy="select-session"]', "Bern");
|
|
cy.get('[data-cy="statistics-filter-list-item"]').should("have.length", 2);
|
|
cy.get(
|
|
'[data-cy="Überprüfen einer Motorfahrzeugs-Versicherungspolice@-1"]',
|
|
).should("contain", "1 von 3 bestanden");
|
|
|
|
selectDropboxItem('[data-cy="select-session"]', "Zürich");
|
|
cy.get('[data-cy="statistics-filter-list-item"]').should("have.length", 2);
|
|
cy.get(
|
|
'[data-cy="Edoniq Wissens- und Verständisfragen - Circle Fahrzeug (Demo)@-2"]',
|
|
).should("contain", "0 von 1 bestanden");
|
|
|
|
selectDropboxItem('[data-cy="select-session"]', "Alle");
|
|
cy.get('[data-cy="statistics-filter-list-item"]').should("have.length", 4);
|
|
|
|
// check detail values for Student 1
|
|
cy.get(
|
|
'[data-cy="Überprüfen einer Motorfahrzeugs-Versicherungspolice@-1"] [data-cy="details-link"]',
|
|
).click();
|
|
|
|
cy.get('[data-cy="Student1"]').should("contain", "Bewertung freigegeben");
|
|
cy.get('[data-cy="Student1"]').should("contain", "16 von 24 Punkten");
|
|
cy.get('[data-cy="Student1"]').should("contain", "67%");
|
|
cy.get('[data-cy="Student1"] [data-cy="show-results"]').click();
|
|
|
|
cy.get(
|
|
'[data-cy="certificate-test-lehrgang-competencenavi-certificates-kompetenznachweis-1-grade"]',
|
|
).should("contain", "4.5");
|
|
cy.get(
|
|
'[data-cy="certificate-test-lehrgang-competencenavi-certificates-kompetenznachweis-1-grade-percent"]',
|
|
).should("contain", "4.33");
|
|
cy.get('[data-cy="back-button"]').click();
|
|
cy.get(".heading-2").should(
|
|
"contain",
|
|
"Überprüfen einer Motorfahrzeug-Versicherungspolice",
|
|
);
|
|
cy.get('[data-cy="back-button"]').click();
|
|
|
|
// check detail values for Student 2
|
|
cy.get(
|
|
'[data-cy="Edoniq Wissens- und Verständisfragen - Circle Fahrzeug (Demo)@-2"] [data-cy="details-link"]',
|
|
).click();
|
|
cy.get('[data-cy="Student2"]').should("contain", "Bewertung freigegeben");
|
|
cy.get('[data-cy="Student2"]').should("contain", "11 von 24 Punkten (46%)");
|
|
cy.get('[data-cy="Student2"]').should("contain", "Nicht bestanden");
|
|
});
|
|
});
|