chore: cypress tests supervisor dashboard
This commit is contained in:
parent
2e0c8205ee
commit
3748ce44fa
|
|
@ -18,20 +18,30 @@ const progressRecord = computed(() => {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<BaseBox :details-link="'/statistic/attendance'">
|
<BaseBox :details-link="'/statistic/attendance'" data-cy="dashboard.stats.attendance">
|
||||||
<template #title>{{ $t("a.Anwesenheit") }}</template>
|
<template #title>{{ $t("a.Anwesenheit") }}</template>
|
||||||
<template #content>
|
<template #content>
|
||||||
<div class="flex items-center">
|
<div class="flex items-center">
|
||||||
<i18next :translation="$t('a.NUMBER Präsenztage abgeschlossen')">
|
<i18next :translation="$t('a.NUMBER Präsenztage abgeschlossen')">
|
||||||
<template #NUMBER>
|
<template #NUMBER>
|
||||||
<span class="mr-3 text-4xl font-bold">{{ daysCompleted }}</span>
|
<span
|
||||||
|
class="mr-3 text-4xl font-bold"
|
||||||
|
data-cy="dashboard.stats.attendance.dayCompleted"
|
||||||
|
>
|
||||||
|
{{ daysCompleted }}
|
||||||
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</i18next>
|
</i18next>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex items-center">
|
<div class="flex items-center">
|
||||||
<i18next :translation="$t('a.NUMBER Teilnehmer anwesend')">
|
<i18next :translation="$t('a.NUMBER Teilnehmer anwesend')">
|
||||||
<template #NUMBER>
|
<template #NUMBER>
|
||||||
<span class="mr-3 text-4xl font-bold">{{ avgParticipantsPresent }}%</span>
|
<span
|
||||||
|
class="mr-3 text-4xl font-bold"
|
||||||
|
data-cy="dashboard.stats.attendance.participantsPresent"
|
||||||
|
>
|
||||||
|
{{ `${avgParticipantsPresent}%` }}
|
||||||
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</i18next>
|
</i18next>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,24 @@ describe("dashboardSupervisor.cy.js", () => {
|
||||||
cy.visit("/");
|
cy.visit("/");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe("attendance day summary box", () => {
|
||||||
|
it("contains correct numbers", () => {
|
||||||
|
getDashboardStatistics("attendance.dayCompleted").should("have.text", "1");
|
||||||
|
getDashboardStatistics("attendance.participantsPresent").should("have.text", "34%");
|
||||||
|
});
|
||||||
|
it("contains correct details link", () => {
|
||||||
|
clickOnDetailsLink("attendance");
|
||||||
|
cy.url().should("contain", "/statistic/attendance");
|
||||||
|
|
||||||
|
// might be improved: roughly check
|
||||||
|
// that the correct data is displayed
|
||||||
|
cy.contains("Durchführung «Test Bern 2022 a»");
|
||||||
|
cy.contains("Circle «Fahrzeug»");
|
||||||
|
cy.contains("Termin: 31. Oktober 2000");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
describe("overall summary box", () => {
|
describe("overall summary box", () => {
|
||||||
it("contains correct numbers (members, experts etc.)", () => {
|
it("contains correct numbers (members, experts etc.)", () => {
|
||||||
getDashboardStatistics("participant.count").should("have.text", "4");
|
getDashboardStatistics("participant.count").should("have.text", "4");
|
||||||
|
|
@ -55,8 +73,9 @@ describe("dashboardSupervisor.cy.js", () => {
|
||||||
|
|
||||||
// might be improved: roughly check
|
// might be improved: roughly check
|
||||||
// that the correct data is displayed
|
// that the correct data is displayed
|
||||||
cy.contains("Selbsteinschätzung: Learning Unit");
|
cy.contains("Selbsteinschätzung: Vorbereitung");
|
||||||
cy.contains("Durchführung «Test Bern 2022 a»");
|
cy.contains("Durchführung «Test Bern 2022 a»");
|
||||||
|
cy.contains("Circle «Fahrzeug»")
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,10 @@
|
||||||
from datetime import timedelta
|
from datetime import datetime
|
||||||
|
|
||||||
import djclick as click
|
import djclick as click
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
|
|
||||||
from vbv_lernwelt.assignment.models import Assignment, AssignmentCompletion
|
from vbv_lernwelt.assignment.models import Assignment, AssignmentCompletion
|
||||||
|
from vbv_lernwelt.competence.models import PerformanceCriteria
|
||||||
from vbv_lernwelt.core.constants import (
|
from vbv_lernwelt.core.constants import (
|
||||||
TEST_COURSE_SESSION_BERN_ID,
|
TEST_COURSE_SESSION_BERN_ID,
|
||||||
TEST_STUDENT1_USER_ID,
|
TEST_STUDENT1_USER_ID,
|
||||||
|
|
@ -18,12 +19,7 @@ from vbv_lernwelt.course.creators.test_course import (
|
||||||
create_test_assignment_evaluation_data,
|
create_test_assignment_evaluation_data,
|
||||||
create_test_assignment_submitted_data,
|
create_test_assignment_submitted_data,
|
||||||
)
|
)
|
||||||
from vbv_lernwelt.course.creators.test_utils import (
|
|
||||||
create_attendance_course,
|
|
||||||
create_performance_criteria_page,
|
|
||||||
)
|
|
||||||
from vbv_lernwelt.course.models import (
|
from vbv_lernwelt.course.models import (
|
||||||
Course,
|
|
||||||
CourseCompletion,
|
CourseCompletion,
|
||||||
CourseCompletionStatus,
|
CourseCompletionStatus,
|
||||||
CourseSession,
|
CourseSession,
|
||||||
|
|
@ -32,7 +28,10 @@ from vbv_lernwelt.course.services import mark_course_completion
|
||||||
from vbv_lernwelt.course_session.models import CourseSessionAttendanceCourse
|
from vbv_lernwelt.course_session.models import CourseSessionAttendanceCourse
|
||||||
from vbv_lernwelt.course_session.services.attendance import AttendanceUserStatus
|
from vbv_lernwelt.course_session.services.attendance import AttendanceUserStatus
|
||||||
from vbv_lernwelt.feedback.models import FeedbackResponse
|
from vbv_lernwelt.feedback.models import FeedbackResponse
|
||||||
from vbv_lernwelt.learnpath.models import Circle, LearningContentFeedback
|
from vbv_lernwelt.learnpath.models import (
|
||||||
|
LearningContentAttendanceCourse,
|
||||||
|
LearningContentFeedback,
|
||||||
|
)
|
||||||
from vbv_lernwelt.notify.models import Notification
|
from vbv_lernwelt.notify.models import Notification
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -88,7 +87,8 @@ def command(
|
||||||
Notification.objects.all().delete()
|
Notification.objects.all().delete()
|
||||||
AssignmentCompletion.objects.all().delete()
|
AssignmentCompletion.objects.all().delete()
|
||||||
FeedbackResponse.objects.all().delete()
|
FeedbackResponse.objects.all().delete()
|
||||||
CourseSessionAttendanceCourse.objects.all().delete()
|
CourseSessionAttendanceCourse.objects.all().update(attendance_user_list=[])
|
||||||
|
|
||||||
User.objects.all().update(language="de")
|
User.objects.all().update(language="de")
|
||||||
User.objects.all().update(additional_json_data={})
|
User.objects.all().update(additional_json_data={})
|
||||||
|
|
||||||
|
|
@ -202,21 +202,13 @@ def command(
|
||||||
|
|
||||||
if create_course_completion_performance_criteria:
|
if create_course_completion_performance_criteria:
|
||||||
member = User.objects.get(id=TEST_STUDENT1_USER_ID)
|
member = User.objects.get(id=TEST_STUDENT1_USER_ID)
|
||||||
course = Course.objects.get(slug="test-lehrgang")
|
|
||||||
course_session = CourseSession.objects.get(id=TEST_COURSE_SESSION_BERN_ID)
|
course_session = CourseSession.objects.get(id=TEST_COURSE_SESSION_BERN_ID)
|
||||||
|
page = PerformanceCriteria.objects.get(
|
||||||
# circle, _ = create_circle(
|
slug="test-lehrgang-competencenavi-competences-crit-x11-allgemein"
|
||||||
# title="How to circle like a pro!", course_page=course.coursepage
|
)
|
||||||
# )
|
|
||||||
|
|
||||||
circle = Circle.objects.get(slug="überbetriebliche-kurse-lp-circle-kickoff")
|
|
||||||
|
|
||||||
mark_course_completion(
|
mark_course_completion(
|
||||||
page=create_performance_criteria_page(
|
page=page,
|
||||||
course=course,
|
|
||||||
course_page=course.coursepage,
|
|
||||||
circle=circle,
|
|
||||||
),
|
|
||||||
user=member,
|
user=member,
|
||||||
course_session=course_session,
|
course_session=course_session,
|
||||||
completion_status=CourseCompletionStatus.SUCCESS.value,
|
completion_status=CourseCompletionStatus.SUCCESS.value,
|
||||||
|
|
@ -224,18 +216,8 @@ def command(
|
||||||
|
|
||||||
if create_attendance_days:
|
if create_attendance_days:
|
||||||
course_session = CourseSession.objects.get(id=TEST_COURSE_SESSION_BERN_ID)
|
course_session = CourseSession.objects.get(id=TEST_COURSE_SESSION_BERN_ID)
|
||||||
course = course_session.course
|
|
||||||
|
|
||||||
# circle, _ = create_circle(
|
attendance_user_list = [
|
||||||
# title="Circle to attend", course_page=course_session.course.coursepage
|
|
||||||
# )
|
|
||||||
circle = Circle.objects.get(slug="überbetriebliche-kurse-lp-circle-kickoff")
|
|
||||||
|
|
||||||
create_attendance_course(
|
|
||||||
course_session=course_session,
|
|
||||||
circle=circle,
|
|
||||||
due_date_end=timezone.now() - timedelta(hours=2),
|
|
||||||
attendance_user_list=[
|
|
||||||
{
|
{
|
||||||
"user_id": TEST_STUDENT1_USER_ID,
|
"user_id": TEST_STUDENT1_USER_ID,
|
||||||
"status": AttendanceUserStatus.PRESENT.value,
|
"status": AttendanceUserStatus.PRESENT.value,
|
||||||
|
|
@ -244,5 +226,20 @@ def command(
|
||||||
"user_id": TEST_STUDENT2_USER_ID,
|
"user_id": TEST_STUDENT2_USER_ID,
|
||||||
"status": AttendanceUserStatus.ABSENT.value,
|
"status": AttendanceUserStatus.ABSENT.value,
|
||||||
},
|
},
|
||||||
],
|
]
|
||||||
|
|
||||||
|
attendance_course = CourseSessionAttendanceCourse.objects.get(
|
||||||
|
course_session=course_session,
|
||||||
|
learning_content=LearningContentAttendanceCourse.objects.get(
|
||||||
|
slug="test-lehrgang-lp-circle-fahrzeug-lc-präsenzkurs-fahrzeug"
|
||||||
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
attendance_course.attendance_user_list = attendance_user_list
|
||||||
|
attendance_course.due_date.start = timezone.make_aware(
|
||||||
|
datetime(year=2000, month=10, day=31, hour=8)
|
||||||
|
)
|
||||||
|
attendance_course.due_date.end = timezone.make_aware(
|
||||||
|
datetime(year=2000, month=10, day=31, hour=11)
|
||||||
|
)
|
||||||
|
attendance_course.save()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue