import { login } from "./helpers"; const navigateToAssignment = () => { cy.visit( "/course/überbetriebliche-kurse/learn/fahrzeug/überprüfen-einer-motorfahrzeug-versicherungspolice" ); }; describe("assignment completion", () => { beforeEach(() => { cy.manageCommand("cypress_reset"); login("admin", "test"); navigateToAssignment(); }); 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.wait(250); cy.reload(); // 1 Step forward cy.learningContentMultiLayoutNextStep(); 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"); cy.wait(550); cy.reload(); // 2 Step forward cy.learningContentMultiLayoutNextStep(); cy.learningContentMultiLayoutNextStep(); cy.get('[data-cy="it-textarea-user-text-input-1"]').should( "have.value", "Hallovelo" ); }); });