From 998001df146928395ff8ac8388b05147029edeeb Mon Sep 17 00:00:00 2001 From: Daniel Egger Date: Wed, 5 Oct 2022 17:02:17 +0200 Subject: [PATCH] Fix cypress tests --- .../learningPath/LearningSequence.vue | 16 +++++++++----- .../learningPath/SelfEvaluation.vue | 15 +++++++++++-- cypress/e2e/circle.cy.js | 22 +++++++++++++++++++ 3 files changed, 45 insertions(+), 8 deletions(-) diff --git a/client/src/components/learningPath/LearningSequence.vue b/client/src/components/learningPath/LearningSequence.vue index f319a96e..1fd65536 100644 --- a/client/src/components/learningPath/LearningSequence.vue +++ b/client/src/components/learningPath/LearningSequence.vue @@ -158,24 +158,28 @@ const learningSequenceBorderClass = computed(() => {
- +
Selbsteinschätzung: Ich kann das.
- +
Selbsteinschätzung: Muss ich nochmals anschauen
-
- +
+
Selbsteinschätzung
diff --git a/client/src/components/learningPath/SelfEvaluation.vue b/client/src/components/learningPath/SelfEvaluation.vue index 0a0fdc91..be53ba5b 100644 --- a/client/src/components/learningPath/SelfEvaluation.vue +++ b/client/src/components/learningPath/SelfEvaluation.vue @@ -45,9 +45,18 @@ function handleContinue() { -

{{ learningUnit.title }}

+

+ Selbsteinschätzung {{ learningUnit.title }} +

- +
@@ -73,6 +82,7 @@ function handleContinue() { 'border-2': currentQuestion.completion_status === 'success', 'border-gray-500': currentQuestion.completion_status !== 'success', }" + data-cy="success" @click="circleStore.markCompletion(currentQuestion, 'success')" > @@ -85,6 +95,7 @@ function handleContinue() { 'border-2': currentQuestion.completion_status === 'fail', 'border-gray-500': currentQuestion.completion_status !== 'fail', }" + data-cy="fail" @click="circleStore.markCompletion(currentQuestion, 'fail')" > diff --git a/cypress/e2e/circle.cy.js b/cypress/e2e/circle.cy.js index 7bf1715f..6a6d385c 100644 --- a/cypress/e2e/circle.cy.js +++ b/cypress/e2e/circle.cy.js @@ -31,6 +31,10 @@ describe("circle page", () => { }); it("can open learning contents and complete them by continuing", () => { + cy.get( + '[data-cy="test-lehrgang-lp-circle-analyse-lu-fahrzeug"] > div' + ).should("have.class", "self-evaluation-unknown"); + cy.get( '[data-cy="test-lehrgang-lp-circle-analyse-lc-rafael-fasel-wechselt-sein-auto"]' ).click(); @@ -43,12 +47,30 @@ describe("circle page", () => { cy.get('[data-cy="ln-title"]').should("contain", "Fachcheck Fahrzeug"); 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="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="test-lehrgang-lp-circle-analyse-lc-rafael-fasel-wechselt-sein-auto"] > .cy-checkbox-checked' ).should("have.class", "cy-checkbox-checked"); cy.get( '[data-cy="test-lehrgang-lp-circle-analyse-lc-fachcheck-fahrzeug"] > .cy-checkbox-checked' ).should("have.class", "cy-checkbox-checked"); + + cy.get( + '[data-cy="test-lehrgang-lp-circle-analyse-lu-fahrzeug"] > div' + ).should("have.class", "self-evaluation-success"); }); it("continue button works", () => {