91 lines
2.9 KiB
JavaScript
91 lines
2.9 KiB
JavaScript
import { login } from "./helpers";
|
|
|
|
describe("circle.cy.js", () => {
|
|
beforeEach(() => {
|
|
cy.manageCommand("cypress_reset");
|
|
|
|
login("test-student1@example.com", "test");
|
|
cy.visit("/course/test-lehrgang/learn/fahrzeug");
|
|
});
|
|
|
|
it("can open circle page", () => {
|
|
cy.get('[data-cy="circle-title"]').should("contain", "Fahrzeug");
|
|
});
|
|
|
|
it("can toggle learning content", () => {
|
|
cy.get('[data-cy="circle-title"]').should("contain", "Fahrzeug");
|
|
|
|
cy.get(
|
|
'[data-cy="test-lehrgang-lp-circle-fahrzeug-lc-handlungsfeld-fahrzeug-checkbox"]'
|
|
).should("have.class", "cy-unchecked");
|
|
|
|
cy.get(
|
|
'[data-cy="test-lehrgang-lp-circle-fahrzeug-lc-handlungsfeld-fahrzeug-checkbox"]'
|
|
).click();
|
|
|
|
cy.get(
|
|
'[data-cy="test-lehrgang-lp-circle-fahrzeug-lc-handlungsfeld-fahrzeug-checkbox"]'
|
|
).should("have.class", "cy-checked");
|
|
|
|
// completion data should still be there after reload
|
|
cy.reload();
|
|
cy.get(
|
|
'[data-cy="test-lehrgang-lp-circle-fahrzeug-lc-handlungsfeld-fahrzeug-checkbox"]'
|
|
).should("have.class", "cy-checked");
|
|
});
|
|
|
|
it("can open learning contents and complete them by continuing", () => {
|
|
cy.get(
|
|
'[data-cy="test-lehrgang-lp-circle-fahrzeug-lc-verschaffe-dir-einen-überblick"]'
|
|
).click();
|
|
cy.get('[data-cy="lc-title"]').should(
|
|
"contain",
|
|
"Verschaffe dir einen Überblick"
|
|
);
|
|
cy.get('[data-cy="complete-and-continue"]').click({ force: true });
|
|
|
|
cy.get('[data-cy="ls-continue-button"]').click();
|
|
cy.get('[data-cy="lc-title"]').should(
|
|
"contain",
|
|
"Handlungsfeld «Fahrzeug»"
|
|
);
|
|
cy.get('[data-cy="complete-and-continue"]').click({ force: true });
|
|
|
|
cy.get(
|
|
'[data-cy="test-lehrgang-lp-circle-fahrzeug-lc-verschaffe-dir-einen-überblick-checkbox"]'
|
|
).should("have.class", "cy-checked");
|
|
cy.get(
|
|
'[data-cy="test-lehrgang-lp-circle-fahrzeug-lc-handlungsfeld-fahrzeug-checkbox"]'
|
|
).should("have.class", "cy-checked");
|
|
});
|
|
|
|
it("continue button works", () => {
|
|
cy.get('[data-cy="ls-continue-button"]').should("contain", "Los geht's");
|
|
cy.get('[data-cy="ls-continue-button"]').click();
|
|
|
|
cy.get('[data-cy="lc-title"]').should(
|
|
"contain",
|
|
"Verschaffe dir einen Überblick"
|
|
);
|
|
cy.get('[data-cy="complete-and-continue"]').click({ force: true });
|
|
|
|
cy.get('[data-cy="ls-continue-button"]').should("contain", "Weiter geht's");
|
|
cy.get('[data-cy="ls-continue-button"]').click();
|
|
cy.get('[data-cy="lc-title"]').should(
|
|
"contain",
|
|
"Handlungsfeld «Fahrzeug»"
|
|
);
|
|
});
|
|
|
|
it("can open learning content by url", () => {
|
|
cy.visit("/course/test-lehrgang/learn/fahrzeug/handlungsfeld-fahrzeug");
|
|
cy.get('[data-cy="lc-title"]').should(
|
|
"contain",
|
|
"Handlungsfeld «Fahrzeug»"
|
|
);
|
|
|
|
cy.get('[data-cy="close-learning-content"]').click();
|
|
cy.get('[data-cy="circle-title"]').should("contain", "Fahrzeug");
|
|
});
|
|
});
|