113 lines
3.4 KiB
JavaScript
113 lines
3.4 KiB
JavaScript
import { login } from "../helpers";
|
|
|
|
describe("assignmentStudent.cy.js", () => {
|
|
beforeEach(() => {
|
|
cy.manageCommand("cypress_reset");
|
|
login("test-student1@example.com", "test");
|
|
cy.visit(
|
|
"/course/test-lehrgang/learn/fahrzeug/überprüfen-einer-motorfahrzeug-versicherungspolice"
|
|
);
|
|
});
|
|
|
|
it("can open assignment", () => {
|
|
cy.testLearningContentTitle("Einleitung");
|
|
cy.testLearningContentSubtitle(
|
|
"Überprüfen einer Motorfahrzeugs-Versicherungspolice"
|
|
);
|
|
});
|
|
|
|
it("can navigate through assignment", () => {
|
|
// 1 Step forward
|
|
cy.learningContentMultiLayoutNextStep();
|
|
cy.testLearningContentTitle(
|
|
"Teilaufgabe 1: Beispiel einer Versicherungspolice finden"
|
|
);
|
|
|
|
cy.learningContentMultiLayoutNextStep();
|
|
cy.testLearningContentTitle(
|
|
"Teilaufgabe 2: Kundensituation und Ausgangslage"
|
|
);
|
|
|
|
cy.learningContentMultiLayoutNextStep();
|
|
cy.testLearningContentTitle("Teilaufgabe 3: Aktuelle Versicherung");
|
|
|
|
cy.learningContentMultiLayoutPreviousStep();
|
|
|
|
cy.testLearningContentTitle(
|
|
"Teilaufgabe 2: Kundensituation und Ausgangslage"
|
|
);
|
|
});
|
|
|
|
it("can save confirmation", () => {
|
|
// 1 Step forward
|
|
cy.learningContentMultiLayoutNextStep();
|
|
cy.testLearningContentTitle(
|
|
"Teilaufgabe 1: Beispiel einer Versicherungspolice finden"
|
|
);
|
|
// Click confirmation
|
|
cy.get('[data-cy="it-checkbox-confirmation-1"]').click();
|
|
|
|
cy.reload();
|
|
cy.get('[data-cy="it-checkbox-confirmation-1"]').should(
|
|
"have.class",
|
|
"cy-checked"
|
|
);
|
|
});
|
|
|
|
it("can save text", () => {
|
|
// 2 Steps forward
|
|
cy.learningContentMultiLayoutNextStep();
|
|
cy.learningContentMultiLayoutNextStep();
|
|
cy.testLearningContentTitle(
|
|
"Teilaufgabe 2: Kundensituation und Ausgangslage"
|
|
);
|
|
// Enter text
|
|
cy.get('[data-cy="it-textarea-user-text-input-1"]')
|
|
.clear()
|
|
.type("Hallovelo");
|
|
// wait because of input debounce
|
|
cy.wait(550);
|
|
cy.reload();
|
|
|
|
cy.get('[data-cy="it-textarea-user-text-input-1"]').should(
|
|
"have.value",
|
|
"Hallovelo"
|
|
);
|
|
});
|
|
|
|
it("can visit sub step directly via url", () => {
|
|
cy.visit(
|
|
"/course/test-lehrgang/learn/fahrzeug/überprüfen-einer-motorfahrzeug-versicherungspolice?step=3"
|
|
);
|
|
cy.testLearningContentTitle("Teilaufgabe 3: Aktuelle Versicherung");
|
|
});
|
|
|
|
it("can visit sub step by clicking navigation bar", () => {
|
|
cy.get('[data-cy="nav-progress-step-4"]').click();
|
|
cy.testLearningContentTitle("Teilaufgabe 4: Deine Empfehlungen");
|
|
});
|
|
|
|
it("can submit assignment", () => {
|
|
cy.visit(
|
|
"/course/test-lehrgang/learn/fahrzeug/überprüfen-einer-motorfahrzeug-versicherungspolice?step=7"
|
|
);
|
|
cy.get('[data-cy="confirm-submit-results"]').click();
|
|
cy.get('[data-cy="confirm-submit-person"]').click();
|
|
cy.get('[data-cy="submit-assignment"]').click();
|
|
cy.get('[data-cy="success-text"]').should("exist");
|
|
|
|
// Check if trainer received notification
|
|
cy.clearLocalStorage();
|
|
cy.clearCookies();
|
|
cy.reload(true);
|
|
login("test-trainer1@example.com", "test");
|
|
cy.visit("/notifications");
|
|
cy.get(`[data-cy=notification-idx-0]`).within(() => {
|
|
cy.get('[data-cy="unread"]').should("exist");
|
|
cy.get('[data-cy="notification-target-idx-0-verb"]').contains(
|
|
"Test Student1 hat die geleitete Fallarbeit «Überprüfen einer Motorfahrzeugs-Versicherungspolice» abgegeben."
|
|
);
|
|
});
|
|
});
|
|
});
|