Update cypress tests

This commit is contained in:
Daniel Egger 2023-04-14 10:26:28 +02:00
parent c0dc4d6a2f
commit f3edfab981
2 changed files with 29 additions and 50 deletions

View File

@ -5,77 +5,59 @@ describe("circle page", () => {
cy.manageCommand("cypress_reset"); cy.manageCommand("cypress_reset");
login("admin", "test"); login("admin", "test");
cy.visit("/course/test-lehrgang/learn/analyse"); cy.visit("/course/test-lehrgang/learn/fahrzeug");
}); });
it("can open circle page", () => { it("can open circle page", () => {
cy.get('[data-cy="circle-title"]').should("contain", "Analyse"); cy.get('[data-cy="circle-title"]').should("contain", "Fahrzeug");
}); });
it("can toggle learning content", () => { it("can toggle learning content", () => {
cy.get('[data-cy="circle-title"]').should("contain", "Analyse"); cy.get('[data-cy="circle-title"]').should("contain", "Fahrzeug");
cy.get( cy.get(
'[data-cy="test-lehrgang-lp-circle-analyse-lc-einleitung-circle-analyse-checkbox"] > .cy-checkbox' '[data-cy="test-lehrgang-lp-circle-fahrzeug-lc-mediathek-fahrzeug-checkbox"] > .cy-checkbox'
).click(); ).click();
cy.get( cy.get(
'[data-cy="test-lehrgang-lp-circle-analyse-lc-einleitung-circle-analyse-checkbox"] > .cy-checkbox-checked' '[data-cy="test-lehrgang-lp-circle-fahrzeug-lc-mediathek-fahrzeug-checkbox"] > .cy-checkbox-checked'
).should("have.class", "cy-checkbox-checked"); ).should("have.class", "cy-checkbox-checked");
// completion data should still be there after reload // completion data should still be there after reload
cy.reload(); cy.reload();
cy.get( cy.get(
'[data-cy="test-lehrgang-lp-circle-analyse-lc-einleitung-circle-analyse-checkbox"] > .cy-checkbox-checked' '[data-cy="test-lehrgang-lp-circle-fahrzeug-lc-mediathek-fahrzeug-checkbox"] > .cy-checkbox-checked'
).should("have.class", "cy-checkbox-checked"); ).should("have.class", "cy-checkbox-checked");
}); });
it("can open learning contents and complete them by continuing", () => { it("can open learning contents and complete them by continuing", () => {
cy.get( cy.get(
'[data-cy="test-lehrgang-lp-circle-analyse-lu-fahrzeug"] > div' '[data-cy="test-lehrgang-lp-circle-fahrzeug-lc-verschaffe-dir-einen-überblick"]'
).should("have.class", "self-evaluation-unknown");
cy.get(
'[data-cy="test-lehrgang-lp-circle-analyse-lc-rafael-fasel-wechselt-sein-auto"]'
).click(); ).click();
cy.get('[data-cy="ln-title"]').should( cy.get('[data-cy="ln-title"]').should(
"contain", "contain",
"Rafael Fasel wechselt sein Auto" "Verschaffe dir einen Überblick"
); );
cy.get('[data-cy="complete-and-continue"]').click(); cy.get('[data-cy="complete-and-continue"]').click();
cy.get('[data-cy="ls-continue-button"]').click(); cy.get('[data-cy="ls-continue-button"]').click();
cy.get('[data-cy="ln-title"]').should("contain", "Fachcheck Fahrzeug"); cy.get('[data-cy="ln-title"]').should("contain", "Mediathek Fahrzeug");
cy.get('[data-cy="complete-and-continue"]').click(); cy.get('[data-cy="complete-and-continue"]').click();
cy.get('[data-cy="test-lehrgang-lp-circle-analyse-lu-fahrzeug"]').click();
cy.get('[data-cy="ln-title"]').should(
"contain",
"Selbsteinschätzung Fahrzeug"
);
cy.get('[data-cy="success"]').click();
cy.get('[data-cy="next-step"]').click();
cy.get('[data-cy="success"]').click();
cy.get('[data-cy="complete-and-continue"]').click();
cy.get('[data-cy="ln-title"]').should(
"contain",
"Selbsteinschätzung Fahrzeug"
);
cy.get('[data-cy="success"]').click();
cy.get('[data-cy="complete-and-continue"]').click();
cy.get('[data-cy="ls-continue-button"]').click(); cy.get('[data-cy="ls-continue-button"]').click();
cy.get('[data-cy="ln-title"]').should("contain", "Vorbereitungsauftrag");
cy.get('[data-cy="complete-and-continue"]').click();
cy.get( cy.get(
'[data-cy="test-lehrgang-lp-circle-analyse-lc-rafael-fasel-wechselt-sein-auto-checkbox"] > .cy-checkbox-checked' '[data-cy="test-lehrgang-lp-circle-fahrzeug-lc-verschaffe-dir-einen-überblick-checkbox"] > .cy-checkbox-checked'
).should("have.class", "cy-checkbox-checked"); ).should("have.class", "cy-checkbox-checked");
cy.get( cy.get(
'[data-cy="test-lehrgang-lp-circle-analyse-lc-fachcheck-fahrzeug-checkbox"] > .cy-checkbox-checked' '[data-cy="test-lehrgang-lp-circle-fahrzeug-lc-mediathek-fahrzeug-checkbox"] > .cy-checkbox-checked'
).should("have.class", "cy-checkbox-checked"); ).should("have.class", "cy-checkbox-checked");
cy.get( cy.get(
'[data-cy="test-lehrgang-lp-circle-analyse-lu-fahrzeug"] > div' '[data-cy="test-lehrgang-lp-circle-fahrzeug-lc-vorbereitungsauftrag-checkbox"] > .cy-checkbox-checked'
).should("have.class", "self-evaluation-success"); ).should("have.class", "cy-checkbox-checked");
}); });
it("continue button works", () => { it("continue button works", () => {
@ -84,23 +66,20 @@ describe("circle page", () => {
cy.get('[data-cy="ln-title"]').should( cy.get('[data-cy="ln-title"]').should(
"contain", "contain",
'Einleitung Circle "Analyse"' "Verschaffe dir einen Überblick"
); );
cy.get('[data-cy="complete-and-continue"]').click(); cy.get('[data-cy="complete-and-continue"]').click();
cy.get('[data-cy="ls-continue-button"]').should("contain", "Weiter geht's"); cy.get('[data-cy="ls-continue-button"]').should("contain", "Weiter geht's");
cy.get('[data-cy="ls-continue-button"]').click(); cy.get('[data-cy="ls-continue-button"]').click();
cy.get('[data-cy="ln-title"]').should( cy.get('[data-cy="ln-title"]').should("contain", "Mediathek Fahrzeug");
"contain",
"Rafael Fasel wechselt sein Auto"
);
}); });
it("can open learning content by url", () => { it("can open learning content by url", () => {
cy.visit("/course/test-lehrgang/learn/analyse/reiseversicherung"); cy.visit("/course/test-lehrgang/learn/fahrzeug/mediathek-fahrzeug");
cy.get('[data-cy="ln-title"]').should("contain", "Reiseversicherung"); cy.get('[data-cy="ln-title"]').should("contain", "Mediathek Fahrzeug");
cy.get('[data-cy="close-learning-content"]').click(); cy.get('[data-cy="close-learning-content"]').click();
cy.get('[data-cy="circle-title"]').should("contain", "Analyse"); cy.get('[data-cy="circle-title"]').should("contain", "Fahrzeug");
}); });
}); });

View File

@ -6,37 +6,37 @@ describe("Competence", () => {
login("admin", "test"); login("admin", "test");
// test-lehrgang-lp-circle-analyse-lu-fahrzeug ist eine Selbstevaluation // test-lehrgang-lp-circle-reisen-lu-reisen ist eine Selbstevaluation
// mit mehreren Schritten // mit mehreren Schritten
cy.visit("/course/test-lehrgang/learn/analyse"); cy.visit("/course/test-lehrgang/learn/reisen");
}); });
it("self evaluation should be neutral", () => { it("self evaluation should be neutral", () => {
cy.get('[data-cy="test-lehrgang-lp-circle-analyse-lu-fahrzeug"]') cy.get('[data-cy="test-lehrgang-lp-circle-reisen-lu-reisen"]')
.find('[data-cy="unknown"]') .find('[data-cy="unknown"]')
.should("exist"); .should("exist");
}); });
it("should be able to make a happy self evaluation", () => { it("should be able to make a happy self evaluation", () => {
cy.get('[data-cy="test-lehrgang-lp-circle-analyse-lu-fahrzeug"]').click(); cy.get('[data-cy="test-lehrgang-lp-circle-reisen-lu-reisen"]').click();
cy.makeSelfEvaluation([true, true]); cy.makeSelfEvaluation([true, true]);
cy.get('[data-cy="test-lehrgang-lp-circle-analyse-lu-fahrzeug"]') cy.get('[data-cy="test-lehrgang-lp-circle-reisen-lu-reisen"]')
.find('[data-cy="success"]') .find('[data-cy="success"]')
.should("exist"); .should("exist");
}); });
it("should be able to make a fail self evaluation", () => { it("should be able to make a fail self evaluation", () => {
cy.get('[data-cy="test-lehrgang-lp-circle-analyse-lu-fahrzeug"]').click(); cy.get('[data-cy="test-lehrgang-lp-circle-reisen-lu-reisen"]').click();
cy.makeSelfEvaluation([false, false]); cy.makeSelfEvaluation([false, false]);
cy.get('[data-cy="test-lehrgang-lp-circle-analyse-lu-fahrzeug"]') cy.get('[data-cy="test-lehrgang-lp-circle-reisen-lu-reisen"]')
.find('[data-cy="fail"]') .find('[data-cy="fail"]')
.should("exist"); .should("exist");
}); });
it("should be able to make a mixed self evaluation", () => { it("should be able to make a mixed self evaluation", () => {
cy.get('[data-cy="test-lehrgang-lp-circle-analyse-lu-fahrzeug"]').click(); cy.get('[data-cy="test-lehrgang-lp-circle-reisen-lu-reisen"]').click();
cy.makeSelfEvaluation([false, true]); cy.makeSelfEvaluation([false, true]);
cy.get('[data-cy="test-lehrgang-lp-circle-analyse-lu-fahrzeug"]') cy.get('[data-cy="test-lehrgang-lp-circle-reisen-lu-reisen"]')
.find('[data-cy="fail"]') .find('[data-cy="fail"]')
.should("exist"); .should("exist");
}); });