vbv/cypress/e2e/assignments.cy.js

70 lines
1.9 KiB
JavaScript

import { login } from "./helpers";
describe("student test", () => {
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"
);
// 2 Steps forward, 1 step backwards
for (let i = 0; i !== 2; i++) {
cy.learningContentMultiLayoutNextStep();
}
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({ force: true });
cy.reload();
cy.get('[data-cy="it-checkbox-confirmation-1"]').should("be.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"
);
});
});