Add cypress tests
This commit is contained in:
parent
401c44dbc7
commit
aa4f0a0d92
|
|
@ -106,7 +106,12 @@ function evaluationForTask(task: AssignmentEvaluationTask) {
|
|||
return expertData;
|
||||
}
|
||||
|
||||
const maxPoints = computed(() => maxAssignmentPoints(props.assignment));
|
||||
const maxPoints = computed(() => {
|
||||
if (props.assignmentCompletion.completion_status === "EVALUATION_SUBMITTED") {
|
||||
return props.assignmentCompletion.evaluation_max_points;
|
||||
}
|
||||
return maxAssignmentPoints(props.assignment);
|
||||
});
|
||||
const userPoints = computed(() =>
|
||||
userAssignmentPoints(props.assignment, props.assignmentCompletion)
|
||||
);
|
||||
|
|
@ -128,22 +133,49 @@ const userPoints = computed(() =>
|
|||
</h3>
|
||||
<h3 v-else class="mb-6" data-cy="sub-title">{{ $t(text.evaluationSubmission) }}</h3>
|
||||
<section class="mb-6 border p-6" data-cy="result-section">
|
||||
<section
|
||||
v-if="props.assignment.assignment_type === 'CASEWORK'"
|
||||
class="flex items-center"
|
||||
>
|
||||
<div class="heading-1 py-4" data-cy="user-points">
|
||||
{{ userPoints }}
|
||||
<section v-if="props.assignment.assignment_type === 'CASEWORK'">
|
||||
<div class="flex items-center">
|
||||
<div class="heading-1 py-4" data-cy="user-points">
|
||||
<template
|
||||
v-if="
|
||||
props.assignmentCompletion.completion_status == 'EVALUATION_SUBMITTED'
|
||||
"
|
||||
>
|
||||
{{ props.assignmentCompletion.evaluation_points_final }}
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ userPoints }}
|
||||
</template>
|
||||
</div>
|
||||
<div class="pl-2" data-cy="total-points">
|
||||
{{ $t("assignment.von x Punkten", { x: maxPoints }) }}
|
||||
({{
|
||||
(
|
||||
((props.assignmentCompletion?.evaluation_points_final ?? 0) /
|
||||
(props.assignmentCompletion?.evaluation_max_points ?? 1)) *
|
||||
100
|
||||
).toFixed(0)
|
||||
}}%)
|
||||
</div>
|
||||
</div>
|
||||
<div class="pl-2" data-cy="total-points">
|
||||
{{ $t("assignment.von x Punkten", { x: maxPoints }) }}
|
||||
({{
|
||||
(
|
||||
((props.assignmentCompletion?.evaluation_points_final ?? 0) /
|
||||
(props.assignmentCompletion?.evaluation_max_points ?? 1)) *
|
||||
100
|
||||
).toFixed(0)
|
||||
}}%)
|
||||
|
||||
<div
|
||||
v-if="assignmentCompletion.evaluation_points_deducted > 0"
|
||||
data-cy="points-deducted"
|
||||
class="mb-4 text-gray-900"
|
||||
>
|
||||
<div>
|
||||
{{ $t("a.Punkte aus Bewertung") }}:
|
||||
{{ assignmentCompletion.evaluation_points }}
|
||||
</div>
|
||||
<div>
|
||||
{{ $t("a.Abgezogene Punkte") }}:
|
||||
{{ assignmentCompletion.evaluation_points_deducted }}
|
||||
</div>
|
||||
<div>
|
||||
{{ $t("a.Grund") }}:
|
||||
{{ assignmentCompletion.evaluation_points_deducted_reason }}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ const total = (metrics: AssignmentCompletionMetricsType) => {
|
|||
:items="courseStatistics.assignments.records"
|
||||
>
|
||||
<template #default="{ item }">
|
||||
<div class="flex justify-between">
|
||||
<div class="flex justify-between" :data-cy="item.assignment_title">
|
||||
<div>
|
||||
<h4 class="font-bold">
|
||||
{{ (item as AssignmentStatisticsRecordType).assignment_title }}
|
||||
|
|
|
|||
|
|
@ -191,7 +191,10 @@ async function startTest() {
|
|||
</span>
|
||||
</div>
|
||||
|
||||
<div v-if="assignmentCompletion.evaluation_points_deducted > 0" class="my-4">
|
||||
<div
|
||||
v-if="assignmentCompletion.evaluation_points_deducted > 0"
|
||||
class="my-4 text-gray-900"
|
||||
>
|
||||
<div>
|
||||
{{ $t("a.Punkte aus Bewertung") }}:
|
||||
{{ assignmentCompletion.evaluation_points }}
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ describe("competenceCertificate.cy.js", () => {
|
|||
|
||||
it("check with finished passed edoniq test", () => {
|
||||
cy.manageCommand(
|
||||
"cypress_reset --create-assignment-completion --create-edoniq-test-results 19 24"
|
||||
"cypress_reset --create-assignment-completion --create-edoniq-test-results 19 24 0"
|
||||
);
|
||||
login("test-student1@example.com", "test");
|
||||
cy.visit("/course/test-lehrgang/competence");
|
||||
|
|
@ -108,7 +108,7 @@ describe("competenceCertificate.cy.js", () => {
|
|||
|
||||
it("check with finished failed edoniq test", () => {
|
||||
cy.manageCommand(
|
||||
"cypress_reset --create-assignment-completion --create-edoniq-test-results 10 24"
|
||||
"cypress_reset --create-assignment-completion --create-edoniq-test-results 10 24 0"
|
||||
);
|
||||
login("test-student1@example.com", "test");
|
||||
|
||||
|
|
@ -144,7 +144,7 @@ describe("competenceCertificate.cy.js", () => {
|
|||
|
||||
it("check with finished edoniq test and finished casework", () => {
|
||||
cy.manageCommand(
|
||||
"cypress_reset --create-assignment-evaluation --create-edoniq-test-results 19 24"
|
||||
"cypress_reset --create-assignment-evaluation --create-edoniq-test-results 19 24 0"
|
||||
);
|
||||
login("test-student1@example.com", "test");
|
||||
cy.visit("/course/test-lehrgang/competence");
|
||||
|
|
@ -197,6 +197,110 @@ describe("competenceCertificate.cy.js", () => {
|
|||
.and("contain", "Bewertung freigegeben");
|
||||
});
|
||||
|
||||
it("check with finished edoniq test with deducted points", () => {
|
||||
cy.manageCommand(
|
||||
"cypress_reset --create-assignment-completion --create-edoniq-test-results 19 24 8"
|
||||
);
|
||||
login("test-student1@example.com", "test");
|
||||
|
||||
// go to certificate detail page
|
||||
cy.visit(
|
||||
"/course/test-lehrgang/competence/certificates/kompetenznachweis-1"
|
||||
);
|
||||
|
||||
cy.get(
|
||||
'[data-cy="certificate-test-lehrgang-competencenavi-certificates-kompetenznachweis-1-grade"]'
|
||||
).should("contain", "Note: 3.5");
|
||||
cy.get(
|
||||
'[data-cy="certificate-test-lehrgang-competencenavi-certificates-kompetenznachweis-1-grade-percent"]'
|
||||
).should("contain", "Ungerundete Note: 3.29");
|
||||
|
||||
cy.get(
|
||||
'[data-cy="assignment-test-lehrgang-assignment-edoniq-wissens-und-verständisfragen-circle-fahrzeug-demo"]'
|
||||
)
|
||||
.should("contain", "11")
|
||||
.and("contain", "Bewertung freigegeben")
|
||||
.and("contain", "46%")
|
||||
.and("contain", "mit Abzug")
|
||||
.and("contain", "Nicht bestanden");
|
||||
|
||||
// it can open learning content page directly
|
||||
cy.get(
|
||||
'[data-cy="assignment-test-lehrgang-assignment-edoniq-wissens-und-verständisfragen-circle-fahrzeug-demo"] [data-cy="open-learning-content"]'
|
||||
).click();
|
||||
cy.get('[data-cy="test-result"]')
|
||||
.should("contain", "11 von 24 Punkten")
|
||||
.and("contain", "46%")
|
||||
.and("contain", "Punkte aus Bewertung: 19")
|
||||
.and("contain", "Abgezogene Punkte: 8")
|
||||
.and("contain", "Grund: Edoniq Punkteabzug Test")
|
||||
.and("contain", "Nicht bestanden");
|
||||
});
|
||||
|
||||
it("check with finished casework and points deducted", () => {
|
||||
cy.manageCommand(
|
||||
"cypress_reset --create-assignment-evaluation --assignment-evaluation-scores 4,6,4,3,2 --assignment-points-deducted 5"
|
||||
);
|
||||
login("test-student1@example.com", "test");
|
||||
cy.visit("/course/test-lehrgang/competence");
|
||||
|
||||
cy.get('[data-cy="certificate-total-points-text"]').contains(
|
||||
"Erfahrungsnote üK: 4"
|
||||
);
|
||||
|
||||
cy.get(
|
||||
'[data-cy="certificate-test-lehrgang-competencenavi-certificates-kompetenznachweis-1"]'
|
||||
)
|
||||
.should("contain", "Note: 4")
|
||||
.and("contain", "1 von 2 Kompetenznachweis-Elementen");
|
||||
|
||||
// check on certificates page
|
||||
cy.get('[data-cy="certificates-show-all-button"]').click();
|
||||
cy.get('[data-cy="certificate-total-points-text"]')
|
||||
.should("contain", "Erfahrungsnote üK")
|
||||
.and("contain", "Note: 4")
|
||||
.and("contain", "Zwischenstand");
|
||||
|
||||
cy.get(
|
||||
'[data-cy="certificate-test-lehrgang-competencenavi-certificates-kompetenznachweis-1"]'
|
||||
)
|
||||
.and("contain", "Zwischenstand")
|
||||
.and("contain", "1 von 2 Kompetenznachweis-Elementen");
|
||||
cy.get(
|
||||
'[data-cy="certificate-test-lehrgang-competencenavi-certificates-kompetenznachweis-1-grade"]'
|
||||
).should("contain", "Note: 4");
|
||||
cy.get(
|
||||
'[data-cy="certificate-test-lehrgang-competencenavi-certificates-kompetenznachweis-1-grade-percent"]'
|
||||
).should("contain", "Ungerundete Note: 3.92");
|
||||
|
||||
// check certificate detail page
|
||||
cy.get(
|
||||
'[data-cy="certificate-test-lehrgang-competencenavi-certificates-kompetenznachweis-1-detail-link"]'
|
||||
).click();
|
||||
|
||||
cy.get(
|
||||
'[data-cy="assignment-test-lehrgang-assignment-überprüfen-einer-motorfahrzeugs-versicherungspolice"]'
|
||||
)
|
||||
.should("contain", "14")
|
||||
.and("contain", "von 24 Punkten")
|
||||
.and("contain", "58%")
|
||||
.and("contain", "mit Abzug")
|
||||
.and("contain", "Bewertung freigegeben");
|
||||
|
||||
cy.get(
|
||||
'[data-cy="assignment-test-lehrgang-assignment-überprüfen-einer-motorfahrzeugs-versicherungspolice"] [data-cy="open-learning-content"]'
|
||||
).click();
|
||||
cy.get('[data-cy="user-points"]').should("contain", "14");
|
||||
cy.get('[data-cy="total-points"]').should(
|
||||
"contain",
|
||||
"von 24 Punkten (58%)"
|
||||
);
|
||||
cy.get('[data-cy="points-deducted"]')
|
||||
.should("contain", "Punkte aus Bewertung: 19")
|
||||
.and("contain", "Abgezogene Punkte: 5")
|
||||
.and("contain", "Grund: Assignment Punkteabzug Test");
|
||||
});
|
||||
|
||||
it("should display link to details", () => {
|
||||
cy.manageCommand("cypress_reset");
|
||||
login("test-student1@example.com", "test");
|
||||
|
|
|
|||
|
|
@ -13,88 +13,122 @@ const clickOnDetailsLink = (within) => {
|
|||
};
|
||||
|
||||
describe("dashboardSupervisor.cy.js", () => {
|
||||
beforeEach(() => {
|
||||
cy.manageCommand(
|
||||
"cypress_reset --create-assignment-evaluation --create-feedback-responses --create-course-completion-performance-criteria --create-attendance-days"
|
||||
);
|
||||
login("test-supervisor1@example.com", "test");
|
||||
cy.visit("/");
|
||||
describe("with data", () => {
|
||||
beforeEach(() => {
|
||||
cy.manageCommand(
|
||||
"cypress_reset --create-assignment-evaluation --create-feedback-responses --create-course-completion-performance-criteria --create-attendance-days"
|
||||
);
|
||||
login("test-supervisor1@example.com", "test");
|
||||
cy.visit("/");
|
||||
});
|
||||
|
||||
describe("assignment summary box", () => {
|
||||
it("contains correct numbers", () => {
|
||||
// we have no completed assignments, but some are in progress
|
||||
// -> makes sure that the numbers are correct
|
||||
getDashboardStatistics("assignments.completed").should(
|
||||
"have.text",
|
||||
"1"
|
||||
);
|
||||
getDashboardStatistics("assignments.passed").should("have.text", "34%");
|
||||
});
|
||||
|
||||
it("contains correct details link", () => {
|
||||
clickOnDetailsLink("assignments");
|
||||
|
||||
// might be improved: roughly check
|
||||
// that the correct data is displayed
|
||||
cy.contains("Noch nicht bestätigt");
|
||||
cy.contains("Überprüfen einer Motorfahrzeugs-Versicherungspolice");
|
||||
cy.contains("Test Bern 2022 a");
|
||||
});
|
||||
});
|
||||
|
||||
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/test-lehrgang/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("feedback summary box", () => {
|
||||
it("contains correct numbers", () => {
|
||||
getDashboardStatistics("feedback.average").should("have.text", "3.3");
|
||||
getDashboardStatistics("feedback.count").should("have.text", "6");
|
||||
});
|
||||
it("contains correct details link", () => {
|
||||
clickOnDetailsLink("feedback");
|
||||
cy.url().should("contain", "/statistic/test-lehrgang/feedback");
|
||||
|
||||
// might be improved: roughly check
|
||||
// that the correct data is displayed
|
||||
cy.contains("3.3 von 4");
|
||||
cy.contains("Test Trainer1");
|
||||
cy.contains("Durchführung «Test Bern 2022 a»");
|
||||
cy.contains("Circle «Fahrzeug»");
|
||||
});
|
||||
});
|
||||
|
||||
describe("competence summary box", () => {
|
||||
it("contains correct numbers", () => {
|
||||
getDashboardStatistics("competence.success").should("have.text", "1");
|
||||
getDashboardStatistics("competence.fail").should("have.text", "0");
|
||||
});
|
||||
it("contains correct details link", () => {
|
||||
clickOnDetailsLink("competence");
|
||||
cy.url().should("contain", "/statistic/test-lehrgang/competence");
|
||||
|
||||
// might be improved: roughly check
|
||||
// that the correct data is displayed
|
||||
cy.contains("Selbsteinschätzung: Vorbereitung");
|
||||
cy.contains("Durchführung «Test Bern 2022 a»");
|
||||
cy.contains("Circle «Fahrzeug»");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("assignment summary box", () => {
|
||||
it("contains correct numbers", () => {
|
||||
describe("with deducted points", () => {
|
||||
beforeEach(() => {
|
||||
cy.manageCommand(
|
||||
"cypress_reset --create-assignment-evaluation --assignment-evaluation-scores 4,6,4,3,2 --assignment-points-deducted 5 --create-edoniq-test-results 19 24 8"
|
||||
);
|
||||
login("test-supervisor1@example.com", "test");
|
||||
cy.visit("/");
|
||||
});
|
||||
|
||||
it("contains numbers with deduction", () => {
|
||||
// we have no completed assignments, but some are in progress
|
||||
// -> makes sure that the numbers are correct
|
||||
getDashboardStatistics("assignments.completed").should("have.text", "1");
|
||||
getDashboardStatistics("assignments.passed").should("have.text", "34%");
|
||||
});
|
||||
getDashboardStatistics("assignments.completed").should("have.text", "2");
|
||||
getDashboardStatistics("assignments.passed").should("have.text", "17%");
|
||||
|
||||
it("contains correct details link", () => {
|
||||
clickOnDetailsLink("assignments");
|
||||
// check data on the details page
|
||||
cy.get(
|
||||
'[data-cy="dashboard.stats.assignments"] [data-cy="basebox.detailsLink"]'
|
||||
).click();
|
||||
cy.get(
|
||||
'[data-cy="Edoniq Wissens- und Verständisfragen - Circle Fahrzeug (Demo)"]'
|
||||
).should("contain", "0 von 3 bestanden");
|
||||
|
||||
// might be improved: roughly check
|
||||
// that the correct data is displayed
|
||||
cy.contains("Noch nicht bestätigt");
|
||||
cy.contains("Überprüfen einer Motorfahrzeugs-Versicherungspolice");
|
||||
cy.contains("Test Bern 2022 a");
|
||||
});
|
||||
});
|
||||
|
||||
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/test-lehrgang/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("feedback summary box", () => {
|
||||
it("contains correct numbers", () => {
|
||||
getDashboardStatistics("feedback.average").should("have.text", "3.3");
|
||||
getDashboardStatistics("feedback.count").should("have.text", "6");
|
||||
});
|
||||
it("contains correct details link", () => {
|
||||
clickOnDetailsLink("feedback");
|
||||
cy.url().should("contain", "/statistic/test-lehrgang/feedback");
|
||||
|
||||
// might be improved: roughly check
|
||||
// that the correct data is displayed
|
||||
cy.contains("3.3 von 4");
|
||||
cy.contains("Test Trainer1");
|
||||
cy.contains("Durchführung «Test Bern 2022 a»");
|
||||
cy.contains("Circle «Fahrzeug»");
|
||||
});
|
||||
});
|
||||
|
||||
describe("competence summary box", () => {
|
||||
it("contains correct numbers", () => {
|
||||
getDashboardStatistics("competence.success").should("have.text", "1");
|
||||
getDashboardStatistics("competence.fail").should("have.text", "0");
|
||||
});
|
||||
it("contains correct details link", () => {
|
||||
clickOnDetailsLink("competence");
|
||||
cy.url().should("contain", "/statistic/test-lehrgang/competence");
|
||||
|
||||
// might be improved: roughly check
|
||||
// that the correct data is displayed
|
||||
cy.contains("Selbsteinschätzung: Vorbereitung");
|
||||
cy.contains("Durchführung «Test Bern 2022 a»");
|
||||
cy.contains("Circle «Fahrzeug»");
|
||||
cy.get(
|
||||
'[data-cy="Überprüfen einer Motorfahrzeugs-Versicherungspolice"]'
|
||||
).should("contain", "1 von 3 bestanden");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ from vbv_lernwelt.self_evaluation_feedback.models import (
|
|||
@click.option(
|
||||
"--create-edoniq-test-results",
|
||||
type=(int, int, float),
|
||||
default=(None, None, 0),
|
||||
default=(None, None, 0.0),
|
||||
metavar="USER_POINTS MAX_POINTS POINTS_DEDUCTED",
|
||||
help="Create edoniq result data for test-student1@example.com with user points and max points",
|
||||
)
|
||||
|
|
|
|||
|
|
@ -403,7 +403,7 @@ def create_test_assignment_evaluation_data(
|
|||
# take the last input score as deduction if there is one left...
|
||||
if points_deducted > 0:
|
||||
ac.evaluation_points_deducted = points_deducted
|
||||
ac.evaluation_points_deducted_reason = "Assignment Punkteabug Test"
|
||||
ac.evaluation_points_deducted_reason = "Assignment Punkteabzug Test"
|
||||
ac.save()
|
||||
|
||||
|
||||
|
|
@ -434,7 +434,7 @@ def create_edoniq_test_result_data(
|
|||
|
||||
if evaluation_points_deducted > 0:
|
||||
ac.evaluation_points_deducted = evaluation_points_deducted
|
||||
ac.evaluation_points_deducted_reason = "Edoniq Punkteabug Test"
|
||||
ac.evaluation_points_deducted_reason = "Edoniq Punkteabzug Test"
|
||||
ac.save()
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue