66 lines
2.3 KiB
JavaScript
66 lines
2.3 KiB
JavaScript
import { login } from "./helpers";
|
|
|
|
describe("learningPath.cy.js", () => {
|
|
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"]'
|
|
).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");
|
|
});
|
|
|
|
it("checks contents", () => {
|
|
cy.get('[data-cy="lp-topic"]').should("have.length", 2);
|
|
cy.get('[data-cy="lp-topic"]').first().should("contain", "Circle ÜK");
|
|
cy.get('[data-cy="lp-topic"]').eq(1).should("contain", "Circle VV");
|
|
|
|
cy.get(".cy-lp-circle").should("have.length", 2);
|
|
cy.get(".cy-lp-circle").first().should("contain", "Fahrzeug");
|
|
cy.get(".cy-lp-circle").eq(1).should("contain", "Reisen");
|
|
});
|
|
});
|