vbv/cypress/e2e/learningPath.cy.js

56 lines
1.9 KiB
JavaScript

import { login } from "./helpers";
describe("learningPath page", () => {
beforeEach(() => {
cy.manageCommand("cypress_reset");
login("test-student1@example.com", "test");
cy.visit("/course/test-lehrgang/learn");
});
it("can open learningPath page", () => {
cy.get('[data-cy="learning-path-title"]').should(
"contain",
"Test Lehrgang"
);
});
it("can click on circle to open it", () => {
cy.get('[data-cy="circle-Fahrzeug"]').click({ force: true });
cy.url().should("include", "/course/test-lehrgang/learn/fahrzeug");
cy.get('[data-cy="circle-title"]').should("contain", "Fahrzeug");
});
it("switch between list and path view", () => {
cy.get('[data-cy="lp-path-view"]').should("be.visible");
cy.get('[data-cy="view-switch"]').click();
cy.get('[data-cy="lp-list-view"]').should("be.visible");
cy.get('[data-cy="view-switch"]').click();
cy.get('[data-cy="lp-path-view"]').should("be.visible");
});
it("weiter gehts button will open next circle", () => {
// first click will open first circle
cy.get('[data-cy="lp-continue-button"]')
.filter(":visible")
.should("contain", "Los geht's")
.click();
cy.get('[data-cy="circle-title"]').should("contain", "Fahrzeug");
cy.get('[data-cy="back-to-learning-path-button"]').click();
// mark a learning content in second circle
cy.get('[data-cy="circle-Reisen"]').click({ force: true });
cy.get(
'[data-cy="test-lehrgang-lp-circle-reisen-lc-fachcheck-reisen-checkbox"] > .cy-checkbox'
).click();
cy.get('[data-cy="back-to-learning-path-button"]').click();
// click on continue should go to unit-test-circle
cy.get('[data-cy="lp-continue-button"]')
.filter(":visible")
.should("contain", "Weiter geht's")
.click();
cy.get('[data-cy="circle-title"]').should("contain", "Reisen");
});
});