chore: cypress tests supervisor dashboard
This commit is contained in:
parent
2e0c8205ee
commit
3748ce44fa
|
|
@ -18,20 +18,30 @@ const progressRecord = computed(() => {
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<BaseBox :details-link="'/statistic/attendance'">
|
||||
<BaseBox :details-link="'/statistic/attendance'" data-cy="dashboard.stats.attendance">
|
||||
<template #title>{{ $t("a.Anwesenheit") }}</template>
|
||||
<template #content>
|
||||
<div class="flex items-center">
|
||||
<i18next :translation="$t('a.NUMBER Präsenztage abgeschlossen')">
|
||||
<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>
|
||||
</i18next>
|
||||
</div>
|
||||
<div class="flex items-center">
|
||||
<i18next :translation="$t('a.NUMBER Teilnehmer anwesend')">
|
||||
<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>
|
||||
</i18next>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -17,6 +17,24 @@ describe("dashboardSupervisor.cy.js", () => {
|
|||
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", () => {
|
||||
it("contains correct numbers (members, experts etc.)", () => {
|
||||
getDashboardStatistics("participant.count").should("have.text", "4");
|
||||
|
|
@ -55,8 +73,9 @@ describe("dashboardSupervisor.cy.js", () => {
|
|||
|
||||
// might be improved: roughly check
|
||||
// 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("Circle «Fahrzeug»")
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
from datetime import timedelta
|
||||
from datetime import datetime
|
||||
|
||||
import djclick as click
|
||||
from django.utils import timezone
|
||||
|
||||
from vbv_lernwelt.assignment.models import Assignment, AssignmentCompletion
|
||||
from vbv_lernwelt.competence.models import PerformanceCriteria
|
||||
from vbv_lernwelt.core.constants import (
|
||||
TEST_COURSE_SESSION_BERN_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_submitted_data,
|
||||
)
|
||||
from vbv_lernwelt.course.creators.test_utils import (
|
||||
create_attendance_course,
|
||||
create_performance_criteria_page,
|
||||
)
|
||||
from vbv_lernwelt.course.models import (
|
||||
Course,
|
||||
CourseCompletion,
|
||||
CourseCompletionStatus,
|
||||
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.services.attendance import AttendanceUserStatus
|
||||
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
|
||||
|
||||
|
||||
|
|
@ -88,7 +87,8 @@ def command(
|
|||
Notification.objects.all().delete()
|
||||
AssignmentCompletion.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(additional_json_data={})
|
||||
|
||||
|
|
@ -202,21 +202,13 @@ def command(
|
|||
|
||||
if create_course_completion_performance_criteria:
|
||||
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)
|
||||
|
||||
# circle, _ = create_circle(
|
||||
# title="How to circle like a pro!", course_page=course.coursepage
|
||||
# )
|
||||
|
||||
circle = Circle.objects.get(slug="überbetriebliche-kurse-lp-circle-kickoff")
|
||||
page = PerformanceCriteria.objects.get(
|
||||
slug="test-lehrgang-competencenavi-competences-crit-x11-allgemein"
|
||||
)
|
||||
|
||||
mark_course_completion(
|
||||
page=create_performance_criteria_page(
|
||||
course=course,
|
||||
course_page=course.coursepage,
|
||||
circle=circle,
|
||||
),
|
||||
page=page,
|
||||
user=member,
|
||||
course_session=course_session,
|
||||
completion_status=CourseCompletionStatus.SUCCESS.value,
|
||||
|
|
@ -224,25 +216,30 @@ def command(
|
|||
|
||||
if create_attendance_days:
|
||||
course_session = CourseSession.objects.get(id=TEST_COURSE_SESSION_BERN_ID)
|
||||
course = course_session.course
|
||||
|
||||
# circle, _ = create_circle(
|
||||
# title="Circle to attend", course_page=course_session.course.coursepage
|
||||
# )
|
||||
circle = Circle.objects.get(slug="überbetriebliche-kurse-lp-circle-kickoff")
|
||||
attendance_user_list = [
|
||||
{
|
||||
"user_id": TEST_STUDENT1_USER_ID,
|
||||
"status": AttendanceUserStatus.PRESENT.value,
|
||||
},
|
||||
{
|
||||
"user_id": TEST_STUDENT2_USER_ID,
|
||||
"status": AttendanceUserStatus.ABSENT.value,
|
||||
},
|
||||
]
|
||||
|
||||
create_attendance_course(
|
||||
attendance_course = CourseSessionAttendanceCourse.objects.get(
|
||||
course_session=course_session,
|
||||
circle=circle,
|
||||
due_date_end=timezone.now() - timedelta(hours=2),
|
||||
attendance_user_list=[
|
||||
{
|
||||
"user_id": TEST_STUDENT1_USER_ID,
|
||||
"status": AttendanceUserStatus.PRESENT.value,
|
||||
},
|
||||
{
|
||||
"user_id": TEST_STUDENT2_USER_ID,
|
||||
"status": AttendanceUserStatus.ABSENT.value,
|
||||
},
|
||||
],
|
||||
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