fix: Fix e2e tests
This commit is contained in:
parent
aa5077bf3c
commit
c3b2dde902
|
|
@ -1,86 +0,0 @@
|
|||
<template>
|
||||
<main v-if="feedbackData">
|
||||
<h1 class="mb-2">{{ $t("feedback.feedbackPageTitle") }}</h1>
|
||||
<p class="mb-10">
|
||||
<span class="font-bold" data-cy="feedback-data-amount">
|
||||
{{ feedbackData.amount }}
|
||||
</span>
|
||||
{{ $t("feedback.feedbackPageInfo") }}
|
||||
</p>
|
||||
<ol v-if="feedbackData.amount > 0">
|
||||
<li
|
||||
v-for="(question, i) in orderedQuestions"
|
||||
:key="i"
|
||||
:data-cy="`question-${i + 1}`"
|
||||
>
|
||||
<RatingScale
|
||||
v-if="ratingKeys.includes(question.key)"
|
||||
class="mb-8 bg-white"
|
||||
:ratings="feedbackData.questions[question.key]"
|
||||
:title="`${$t('feedback.questionTitle')} ${i + 1}`"
|
||||
:text="question.question"
|
||||
/>
|
||||
<VerticalBarChart
|
||||
v-else-if="verticalChartKeys.includes(question.key)"
|
||||
class="mb-8 bg-white"
|
||||
:title="`${$t('feedback.questionTitle')} ${i + 1}`"
|
||||
:ratings="feedbackData.questions[question.key]"
|
||||
:text="question.question"
|
||||
:ratio="0.2"
|
||||
/>
|
||||
<OpenFeedback
|
||||
v-else-if="
|
||||
openKeys.includes(question.key) && feedbackData.questions[question.key]
|
||||
"
|
||||
class="mb-8 bg-white"
|
||||
:title="`${$t('feedback.questionTitle')} ${i + 1}`"
|
||||
:text="question.question"
|
||||
:answers="feedbackData.questions[question.key].filter((a: string) => a !== '')"
|
||||
></OpenFeedback>
|
||||
<HorizontalBarChart
|
||||
v-else-if="
|
||||
horizontalChartKeys.includes(question.key) &&
|
||||
feedbackData.questions[question.key]
|
||||
"
|
||||
class="mb-8 bg-white"
|
||||
:title="`${$t('feedback.questionTitle')} ${i}`"
|
||||
:text="question.question"
|
||||
:items="feedbackData.questions[question.key].map((a: string) => `${a}%`)"
|
||||
/>
|
||||
</li>
|
||||
</ol>
|
||||
</main>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import HorizontalBarChart from "@/components/ui/HorizontalBarChart.vue";
|
||||
import OpenFeedback from "@/components/ui/OpenFeedback.vue";
|
||||
import RatingScale from "@/components/ui/RatingScale.vue";
|
||||
import VerticalBarChart from "@/components/ui/VerticalBarChart.vue";
|
||||
import type { FeedbackData } from "@/types";
|
||||
import * as log from "loglevel";
|
||||
|
||||
interface Props {
|
||||
orderedQuestions?: {
|
||||
key: string;
|
||||
question: string;
|
||||
}[];
|
||||
feedbackData: FeedbackData;
|
||||
ratingKeys?: string[];
|
||||
verticalChartKeys?: string[];
|
||||
horizontalChartKeys?: string[];
|
||||
openKeys?: string[];
|
||||
}
|
||||
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
orderedQuestions: () => [],
|
||||
ratingKeys: () => [],
|
||||
verticalChartKeys: () => [],
|
||||
horizontalChartKeys: () => [],
|
||||
openKeys: () => [],
|
||||
});
|
||||
|
||||
log.debug("FeedbackBasePage created");
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
||||
|
|
@ -10,17 +10,23 @@
|
|||
<span>{{ $t("general.back") }}</span>
|
||||
</router-link>
|
||||
</nav>
|
||||
<FeedbackPageVV
|
||||
v-if="feedbackData != undefined && feedbackType === 'vv'"
|
||||
:feedback-data="feedbackData"
|
||||
/>
|
||||
<FeedbackPageUK
|
||||
v-else-if="feedbackData != undefined && feedbackType === 'uk'"
|
||||
:feedback-data="feedbackData"
|
||||
/>
|
||||
<div v-else class="flex justify-center">
|
||||
<p>unknown FeedbackType</p>
|
||||
</div>
|
||||
<main v-if="feedbackData">
|
||||
<h1 class="mb-2">{{ $t("feedback.feedbackPageTitle") }}</h1>
|
||||
<p class="mb-10">
|
||||
<span class="font-bold" data-cy="feedback-data-amount">
|
||||
{{ feedbackData.amount }}
|
||||
</span>
|
||||
{{ $t("feedback.feedbackPageInfo") }}
|
||||
</p>
|
||||
<FeedbackPageVV
|
||||
v-if="feedbackData != undefined && feedbackType === 'vv'"
|
||||
:feedback-data="feedbackData"
|
||||
/>
|
||||
<FeedbackPageUK
|
||||
v-else-if="feedbackData != undefined && feedbackType === 'uk'"
|
||||
:feedback-data="feedbackData"
|
||||
/>
|
||||
</main>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<FeedbackBasePage
|
||||
<FeedbackResults
|
||||
:ordered-questions="orderedQuestions"
|
||||
:feedback-data="feedbackData"
|
||||
:rating-keys="ratingKeys"
|
||||
|
|
@ -10,7 +10,7 @@
|
|||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import FeedbackBasePage from "@/pages/cockpit/FeedbackBasePage.vue";
|
||||
import FeedbackResults from "@/pages/cockpit/FeedbackResults.vue";
|
||||
import type { FeedbackData } from "@/types";
|
||||
import * as log from "loglevel";
|
||||
import { useTranslation } from "i18next-vue";
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<FeedbackBasePage
|
||||
<FeedbackResults
|
||||
:ordered-questions="orderedQuestions"
|
||||
:feedback-data="feedbackData"
|
||||
:rating-keys="ratingKeys"
|
||||
|
|
@ -10,7 +10,7 @@
|
|||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import FeedbackBasePage from "@/pages/cockpit/FeedbackBasePage.vue";
|
||||
import FeedbackResults from "@/pages/cockpit/FeedbackResults.vue";
|
||||
import type { FeedbackData } from "@/types";
|
||||
import * as log from "loglevel";
|
||||
import { useTranslation } from "i18next-vue";
|
||||
|
|
|
|||
|
|
@ -0,0 +1,77 @@
|
|||
<template>
|
||||
<ol v-if="feedbackData.amount > 0">
|
||||
<li
|
||||
v-for="(question, i) in orderedQuestions"
|
||||
:key="i"
|
||||
:data-cy="`question-${i + 1}`"
|
||||
>
|
||||
<RatingScale
|
||||
v-if="ratingKeys.includes(question.key)"
|
||||
class="mb-8 bg-white"
|
||||
:ratings="feedbackData.questions[question.key]"
|
||||
:title="`${$t('feedback.questionTitle')} ${i + 1}`"
|
||||
:text="question.question"
|
||||
/>
|
||||
<VerticalBarChart
|
||||
v-else-if="verticalChartKeys.includes(question.key)"
|
||||
class="mb-8 bg-white"
|
||||
:title="`${$t('feedback.questionTitle')} ${i + 1}`"
|
||||
:ratings="feedbackData.questions[question.key]"
|
||||
:text="question.question"
|
||||
:ratio="0.2"
|
||||
/>
|
||||
<OpenFeedback
|
||||
v-else-if="
|
||||
openKeys.includes(question.key) && feedbackData.questions[question.key]
|
||||
"
|
||||
class="mb-8 bg-white"
|
||||
:title="`${$t('feedback.questionTitle')} ${i + 1}`"
|
||||
:text="question.question"
|
||||
:answers="feedbackData.questions[question.key].filter((a: string) => a !== '')"
|
||||
></OpenFeedback>
|
||||
<HorizontalBarChart
|
||||
v-else-if="
|
||||
horizontalChartKeys.includes(question.key) &&
|
||||
feedbackData.questions[question.key]
|
||||
"
|
||||
class="mb-8 bg-white"
|
||||
:title="`${$t('feedback.questionTitle')} ${i + 1}`"
|
||||
:text="question.question"
|
||||
:items="feedbackData.questions[question.key].map((a: string) => `${a}%`)"
|
||||
/>
|
||||
</li>
|
||||
</ol>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import HorizontalBarChart from "@/components/ui/HorizontalBarChart.vue";
|
||||
import OpenFeedback from "@/components/ui/OpenFeedback.vue";
|
||||
import RatingScale from "@/components/ui/RatingScale.vue";
|
||||
import VerticalBarChart from "@/components/ui/VerticalBarChart.vue";
|
||||
import type { FeedbackData } from "@/types";
|
||||
import * as log from "loglevel";
|
||||
|
||||
interface Props {
|
||||
orderedQuestions?: {
|
||||
key: string;
|
||||
question: string;
|
||||
}[];
|
||||
feedbackData: FeedbackData;
|
||||
ratingKeys?: string[];
|
||||
verticalChartKeys?: string[];
|
||||
horizontalChartKeys?: string[];
|
||||
openKeys?: string[];
|
||||
}
|
||||
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
orderedQuestions: () => [],
|
||||
ratingKeys: () => [],
|
||||
verticalChartKeys: () => [],
|
||||
horizontalChartKeys: () => [],
|
||||
openKeys: () => [],
|
||||
});
|
||||
|
||||
log.debug("FeedbackBasePage created");
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
||||
|
|
@ -156,6 +156,7 @@ describe("feedbackStudent.cy.js", () => {
|
|||
proficiency: 80,
|
||||
satisfaction: 4,
|
||||
would_recommend: true,
|
||||
feedback_type: "uk",
|
||||
});
|
||||
}
|
||||
);
|
||||
|
|
@ -283,6 +284,7 @@ describe("feedbackStudent.cy.js", () => {
|
|||
proficiency: 80,
|
||||
satisfaction: 4,
|
||||
would_recommend: false,
|
||||
feedback_type: "vv",
|
||||
});
|
||||
}
|
||||
);
|
||||
|
|
|
|||
|
|
@ -16,77 +16,216 @@ describe("feedbackTrainer.cy.js", () => {
|
|||
cy.get('[data-cy="feedback-data-amount"]').should("contain", "0");
|
||||
});
|
||||
|
||||
it("can open feedback results page with results", () => {
|
||||
cy.manageCommand("cypress_reset --create-feedback-responses");
|
||||
login("test-trainer1@example.com", "test");
|
||||
cy.visit("/course/test-lehrgang/cockpit");
|
||||
cy.get(
|
||||
'[data-cy="show-feedback-btn-test-lehrgang-lp-circle-fahrzeug-lc-feedback"]'
|
||||
).click();
|
||||
describe("FeedbackUK", function () {
|
||||
it("can open feedback results page with results", () => {
|
||||
cy.manageCommand("cypress_reset --create-feedback-responses");
|
||||
login("test-trainer1@example.com", "test");
|
||||
cy.visit("/course/test-lehrgang/cockpit");
|
||||
cy.get(
|
||||
'[data-cy="show-feedback-btn-test-lehrgang-lp-circle-fahrzeug-lc-feedback"]'
|
||||
).click();
|
||||
|
||||
cy.get('[data-cy="feedback-data-amount"]').should("contain", "3");
|
||||
cy.get('[data-cy="feedback-data-amount"]').should("contain", "3");
|
||||
|
||||
cy.get('[data-cy="question-1"]')
|
||||
.find('[data-cy="rating-scale-average"]')
|
||||
.should("contain", "3.3");
|
||||
// check titles of questions
|
||||
cy.get('[data-cy="question-1"]').should(
|
||||
"contain",
|
||||
"Zufriedenheit insgesamt"
|
||||
);
|
||||
cy.get('[data-cy="question-2"]').should(
|
||||
"contain",
|
||||
"Zielerreichung insgesamt"
|
||||
);
|
||||
cy.get('[data-cy="question-3"]').should(
|
||||
"contain",
|
||||
"Wie beurteilst du deine Sicherheit bezüglichen den Themen nach dem Kurs?"
|
||||
);
|
||||
cy.get('[data-cy="question-4"]').should(
|
||||
"contain",
|
||||
"Waren die Vorbereitungsaufträge klar und verständlich?"
|
||||
);
|
||||
cy.get('[data-cy="question-5"]').should(
|
||||
"contain",
|
||||
"Wie beurteilst du die Themensicherheit und Fachkompetenz des Kursleiters/der Kursleiterin?"
|
||||
);
|
||||
cy.get('[data-cy="question-6"]').should(
|
||||
"contain",
|
||||
"Wurden Fragen und Anregungen der Kursteilnehmenden ernst genommen und aufgegriffen?"
|
||||
);
|
||||
cy.get('[data-cy="question-7"]').should(
|
||||
"contain",
|
||||
"Was möchtest du dem Kursleiter/der Kursleiterin sonst noch sagen?"
|
||||
);
|
||||
cy.get('[data-cy="question-8"]').should(
|
||||
"contain",
|
||||
"Würdest du den Kurs weiterempfehlen?"
|
||||
);
|
||||
cy.get('[data-cy="question-9"]').should(
|
||||
"contain",
|
||||
"Wo siehst du Verbesserungspotential?"
|
||||
);
|
||||
cy.get('[data-cy="question-10"]').should(
|
||||
"contain",
|
||||
"Was hat dir besonders gut gefallen?"
|
||||
);
|
||||
|
||||
cy.get('[data-cy="question-2"]')
|
||||
.find('[data-cy="rating-scale-average"]')
|
||||
.should("contain", "3.0");
|
||||
cy.get('[data-cy="question-1"]')
|
||||
.find('[data-cy="rating-scale-average"]')
|
||||
.should("contain", "3.3");
|
||||
|
||||
cy.get('[data-cy="question-3"]')
|
||||
.find('[data-cy="percentage-value-40%"]')
|
||||
.should("contain", "33.3");
|
||||
cy.get('[data-cy="question-3"]')
|
||||
.find('[data-cy="percentage-value-80%"]')
|
||||
.should("contain", "33.3");
|
||||
cy.get('[data-cy="question-3"]')
|
||||
.find('[data-cy="percentage-value-100%"]')
|
||||
.should("contain", "33.3");
|
||||
cy.get('[data-cy="question-2"]')
|
||||
.find('[data-cy="rating-scale-average"]')
|
||||
.should("contain", "3.0");
|
||||
|
||||
cy.get('[data-cy="question-4"]')
|
||||
.find('[data-cy="popover-yes"]')
|
||||
.click()
|
||||
.find('[data-cy="num-yes"]')
|
||||
.should("contain", "3");
|
||||
cy.get('[data-cy="question-4"]')
|
||||
.find('[data-cy="popover-no"]')
|
||||
.click()
|
||||
.find('[data-cy="num-no"]')
|
||||
.should("contain", "0");
|
||||
cy.get('[data-cy="question-3"]')
|
||||
.find('[data-cy="percentage-value-40%"]')
|
||||
.should("contain", "33.3");
|
||||
cy.get('[data-cy="question-3"]')
|
||||
.find('[data-cy="percentage-value-80%"]')
|
||||
.should("contain", "33.3");
|
||||
cy.get('[data-cy="question-3"]')
|
||||
.find('[data-cy="percentage-value-100%"]')
|
||||
.should("contain", "33.3");
|
||||
|
||||
cy.get('[data-cy="question-5"]')
|
||||
.find('[data-cy="rating-scale-average"]')
|
||||
.should("contain", "2.7");
|
||||
cy.get('[data-cy="question-4"]')
|
||||
.find('[data-cy="popover-yes"]')
|
||||
.click()
|
||||
.find('[data-cy="num-yes"]')
|
||||
.should("contain", "3");
|
||||
cy.get('[data-cy="question-4"]')
|
||||
.find('[data-cy="popover-no"]')
|
||||
.click()
|
||||
.find('[data-cy="num-no"]')
|
||||
.should("contain", "0");
|
||||
|
||||
cy.get('[data-cy="question-6"]')
|
||||
.find('[data-cy="rating-scale-average"]')
|
||||
.should("contain", "3.0");
|
||||
cy.get('[data-cy="question-5"]')
|
||||
.find('[data-cy="rating-scale-average"]')
|
||||
.should("contain", "2.7");
|
||||
|
||||
cy.get('[data-cy="question-7"]')
|
||||
.should("contain", "Super Kurs!")
|
||||
.should("contain", "Super, bin begeistert")
|
||||
.should("contain", "Ok, entspricht den Erwartungen");
|
||||
cy.get('[data-cy="question-6"]')
|
||||
.find('[data-cy="rating-scale-average"]')
|
||||
.should("contain", "3.0");
|
||||
|
||||
cy.get('[data-cy="question-8"]')
|
||||
.find('[data-cy="popover-yes"]')
|
||||
.click()
|
||||
.find('[data-cy="num-yes"]')
|
||||
.should("contain", "2");
|
||||
cy.get('[data-cy="question-8"]')
|
||||
.find('[data-cy="popover-no"]')
|
||||
.click()
|
||||
.find('[data-cy="num-no"]')
|
||||
.should("contain", "1");
|
||||
cy.get('[data-cy="question-7"]')
|
||||
.should("contain", "Super Kurs!")
|
||||
.should("contain", "Super, bin begeistert")
|
||||
.should("contain", "Ok, entspricht den Erwartungen");
|
||||
|
||||
cy.get('[data-cy="question-9"]')
|
||||
.should("contain", "Nichts Schlechtes")
|
||||
.should("contain", "Es wäre praktisch, Zugang zu einer FAQ zu haben.")
|
||||
.should("contain", "Mehr Videos wären schön.");
|
||||
cy.get('[data-cy="question-8"]')
|
||||
.find('[data-cy="popover-yes"]')
|
||||
.click()
|
||||
.find('[data-cy="num-yes"]')
|
||||
.should("contain", "2");
|
||||
cy.get('[data-cy="question-8"]')
|
||||
.find('[data-cy="popover-no"]')
|
||||
.click()
|
||||
.find('[data-cy="num-no"]')
|
||||
.should("contain", "1");
|
||||
|
||||
cy.get('[data-cy="question-10"]')
|
||||
.should("contain", "Nur Gutes.")
|
||||
.should("contain", "Das Beispiel mit der Katze fand ich sehr gut")
|
||||
.should("contain", "Die Präsentation war super");
|
||||
cy.get('[data-cy="question-9"]')
|
||||
.should("contain", "Nichts Schlechtes")
|
||||
.should("contain", "Es wäre praktisch, Zugang zu einer FAQ zu haben.")
|
||||
.should("contain", "Mehr Videos wären schön.");
|
||||
|
||||
cy.get('[data-cy="question-10"]')
|
||||
.should("contain", "Nur Gutes.")
|
||||
.should("contain", "Das Beispiel mit der Katze fand ich sehr gut")
|
||||
.should("contain", "Die Präsentation war super");
|
||||
});
|
||||
});
|
||||
|
||||
describe("FeedbackVV", function () {
|
||||
it("can open feedback results page with results", () => {
|
||||
cy.manageCommand("cypress_reset --create-feedback-responses");
|
||||
login("test-trainer1@example.com", "test");
|
||||
cy.visit("/course/test-lehrgang/cockpit");
|
||||
cy.get('[data-cy="dropdown-select"]').click();
|
||||
cy.get('[data-cy="dropdown-select-option-Reisen"]').click();
|
||||
cy.get(
|
||||
'[data-cy="show-feedback-btn-test-lehrgang-lp-circle-reisen-lc-feedback"]'
|
||||
).click();
|
||||
|
||||
cy.get('[data-cy="feedback-data-amount"]').should("contain", "3");
|
||||
|
||||
// check titles of questions
|
||||
cy.get('[data-cy="question-1"]').should(
|
||||
"contain",
|
||||
"Zufriedenheit insgesamt"
|
||||
);
|
||||
cy.get('[data-cy="question-2"]').should(
|
||||
"contain",
|
||||
"Zielerreichung insgesamt"
|
||||
);
|
||||
cy.get('[data-cy="question-3"]').should(
|
||||
"contain",
|
||||
"Wie beurteilst du deine Sicherheit bezüglichen den Themen nach dem Circle?"
|
||||
);
|
||||
cy.get('[data-cy="question-4"]').should(
|
||||
"contain",
|
||||
"Waren die Praxisaufträge klar und verständlich?"
|
||||
);
|
||||
cy.get('[data-cy="question-5"]').should(
|
||||
"contain",
|
||||
"Würdest du den Circle weiterempfehlen?"
|
||||
);
|
||||
cy.get('[data-cy="question-6"]').should(
|
||||
"contain",
|
||||
"Wo siehst du Verbesserungspotential?"
|
||||
);
|
||||
cy.get('[data-cy="question-7"]').should(
|
||||
"contain",
|
||||
"Was hat dir besonders gut gefallen?"
|
||||
);
|
||||
|
||||
cy.get('[data-cy="question-1"]')
|
||||
.find('[data-cy="rating-scale-average"]')
|
||||
.should("contain", "3.3");
|
||||
|
||||
cy.get('[data-cy="question-2"]')
|
||||
.find('[data-cy="rating-scale-average"]')
|
||||
.should("contain", "3.0");
|
||||
|
||||
cy.get('[data-cy="question-3"]')
|
||||
.find('[data-cy="percentage-value-40%"]')
|
||||
.should("contain", "33.3");
|
||||
cy.get('[data-cy="question-3"]')
|
||||
.find('[data-cy="percentage-value-80%"]')
|
||||
.should("contain", "33.3");
|
||||
cy.get('[data-cy="question-3"]')
|
||||
.find('[data-cy="percentage-value-100%"]')
|
||||
.should("contain", "33.3");
|
||||
|
||||
cy.get('[data-cy="question-4"]')
|
||||
.find('[data-cy="popover-yes"]')
|
||||
.click()
|
||||
.find('[data-cy="num-yes"]')
|
||||
.should("contain", "3");
|
||||
cy.get('[data-cy="question-4"]')
|
||||
.find('[data-cy="popover-no"]')
|
||||
.click()
|
||||
.find('[data-cy="num-no"]')
|
||||
.should("contain", "0");
|
||||
|
||||
cy.get('[data-cy="question-5"]')
|
||||
.find('[data-cy="popover-yes"]')
|
||||
.click()
|
||||
.find('[data-cy="num-yes"]')
|
||||
.should("contain", "2");
|
||||
cy.get('[data-cy="question-5"]')
|
||||
.find('[data-cy="popover-no"]')
|
||||
.click()
|
||||
.find('[data-cy="num-no"]')
|
||||
.should("contain", "1");
|
||||
|
||||
cy.get('[data-cy="question-6"]')
|
||||
.should("contain", "Nichts Schlechtes")
|
||||
.should("contain", "Es wäre praktisch, Zugang zu einer FAQ zu haben.")
|
||||
.should("contain", "Mehr Videos wären schön.");
|
||||
|
||||
cy.get('[data-cy="question-7"]')
|
||||
.should("contain", "Nur Gutes.")
|
||||
.should("contain", "Das Beispiel mit der Katze fand ich sehr gut")
|
||||
.should("contain", "Die Präsentation war super");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ class CourseFeedbackSerializerUK(serializers.Serializer):
|
|||
|
||||
|
||||
class CourseFeedbackSerializerVV(serializers.Serializer):
|
||||
feedback_type = serializers.ChoiceField(choices=FEEDBACK_TYPES)
|
||||
satisfaction = FeedbackIntegerField()
|
||||
goal_attainment = FeedbackIntegerField()
|
||||
proficiency = serializers.IntegerField(required=False, allow_null=True)
|
||||
|
|
|
|||
Loading…
Reference in New Issue