wip: Add student tests, change submission page
This commit is contained in:
parent
0fc428ff06
commit
6f9ef0f79f
|
|
@ -77,18 +77,24 @@ const completionTaskData = computed(() => {
|
|||
return props.assignmentCompletion?.task_completion_data ?? {};
|
||||
});
|
||||
|
||||
const canSubmit = computed(() => {
|
||||
const cannotSubmit = computed(() => {
|
||||
return (
|
||||
!state.confirmInput ||
|
||||
(!state.confirmInput && !isPraxisAssignment.value) ||
|
||||
(props.assignment.assignment_type === "CASEWORK" && !state.confirmPerson)
|
||||
);
|
||||
});
|
||||
|
||||
const isCasework = computed(() =>
|
||||
(
|
||||
["CASEWORK", "PRAXIS_ASSIGNMENT"] as AssignmentAssignmentAssignmentTypeChoices[]
|
||||
).includes(props.assignment.assignment_type)
|
||||
function checkAssignmentType(
|
||||
assignmentType: AssignmentAssignmentAssignmentTypeChoices[]
|
||||
) {
|
||||
return assignmentType.includes(props.assignment.assignment_type);
|
||||
}
|
||||
|
||||
const isCasework = computed(() => checkAssignmentType(["CASEWORK"]));
|
||||
const mayBeEvaluated = computed(() =>
|
||||
checkAssignmentType(["CASEWORK", "PRAXIS_ASSIGNMENT"])
|
||||
);
|
||||
const isPraxisAssignment = computed(() => checkAssignmentType(["PRAXIS_ASSIGNMENT"]));
|
||||
|
||||
const upsertAssignmentCompletionMutation = useMutation(
|
||||
UPSERT_ASSIGNMENT_COMPLETION_MUTATION
|
||||
|
|
@ -127,6 +133,7 @@ const onSubmit = async () => {
|
|||
|
||||
<div v-if="completionStatus === 'IN_PROGRESS'">
|
||||
<ItCheckbox
|
||||
v-if="!isPraxisAssignment"
|
||||
class="w-full border-b border-gray-400 py-10 sm:py-6"
|
||||
:checkbox-item="{
|
||||
label: $t('assignment.confirmSubmitResults'),
|
||||
|
|
@ -136,11 +143,14 @@ const onSubmit = async () => {
|
|||
data-cy="confirm-submit-results"
|
||||
@toggle="state.confirmInput = !state.confirmInput"
|
||||
></ItCheckbox>
|
||||
<div v-if="isCasework" class="w-full border-b border-gray-400">
|
||||
<div v-if="mayBeEvaluated" class="w-full border-b border-gray-400">
|
||||
<ItCheckbox
|
||||
v-if="mayBeEvaluated"
|
||||
class="py-6"
|
||||
:checkbox-item="{
|
||||
label: $t('assignment.confirmSubmitPerson'),
|
||||
label: isPraxisAssignment
|
||||
? $t('a.confirmSubmitPersonPraxisAssignment')
|
||||
: $t('assignment.confirmSubmitPerson'),
|
||||
value: 'value',
|
||||
checked: state.confirmPerson,
|
||||
}"
|
||||
|
|
@ -165,7 +175,7 @@ const onSubmit = async () => {
|
|||
{{ $t("assignment.showAssessmentDocument") }}
|
||||
</a>
|
||||
</div>
|
||||
<p v-if="isCasework && props.submissionDeadlineStart" class="pt-6">
|
||||
<p v-if="mayBeEvaluated && props.submissionDeadlineStart" class="pt-6">
|
||||
{{ $t("assignment.dueDateSubmission") }}
|
||||
<DateEmbedding
|
||||
:single-date="dayjs(props.submissionDeadlineStart)"
|
||||
|
|
@ -175,7 +185,7 @@ const onSubmit = async () => {
|
|||
class="mt-6"
|
||||
variant="blue"
|
||||
size="large"
|
||||
:disabled="canSubmit"
|
||||
:disabled="cannotSubmit"
|
||||
data-cy="submit-assignment"
|
||||
@click="onSubmit"
|
||||
>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,121 @@
|
|||
import { TEST_STUDENT1_USER_ID } from "../../consts";
|
||||
import { login } from "../helpers";
|
||||
|
||||
function completePraxisAssignment(selectExpert = false) {
|
||||
cy.visit("/course/test-lehrgang/learn/reisen/mein-kundenstamm");
|
||||
cy.learningContentMultiLayoutNextStep();
|
||||
cy.testLearningContentTitle(
|
||||
"Teilaufgabe 1: Filtere nach Kundeneigenschaften"
|
||||
);
|
||||
cy.get('[data-cy="it-textarea-user-text-input-1"]')
|
||||
.clear()
|
||||
.type("Hallo Teilaufgabe 1.1");
|
||||
cy.wait(550);
|
||||
cy.get('[data-cy="it-textarea-user-text-input-2"]')
|
||||
.clear()
|
||||
.type("Hallo Teilaufgabe 1.2");
|
||||
cy.wait(550);
|
||||
cy.get('[data-cy="it-textarea-user-text-input-3"]')
|
||||
.clear()
|
||||
.type("Hallo Teilaufgabe 1.3");
|
||||
cy.wait(550);
|
||||
cy.get('[data-cy="it-textarea-user-text-input-4"]')
|
||||
.clear()
|
||||
.type("Hallo Teilaufgabe 1.4");
|
||||
cy.wait(550);
|
||||
cy.get('[data-cy="it-textarea-user-text-input-5"]')
|
||||
.clear()
|
||||
.type("Hallo Teilaufgabe 1.5");
|
||||
// wait because of input debounce
|
||||
cy.wait(550);
|
||||
cy.learningContentMultiLayoutNextStep();
|
||||
|
||||
// step 2
|
||||
cy.testLearningContentTitle("Teilaufgabe 2: Filtere nach Versicherungen");
|
||||
cy.get('[data-cy="it-textarea-user-text-input-1"]')
|
||||
.clear()
|
||||
.type("Hallo Teilaufgabe 2.1");
|
||||
cy.wait(550);
|
||||
cy.get('[data-cy="it-textarea-user-text-input-2"]')
|
||||
.clear()
|
||||
.type("Hallo Teilaufgabe 2.2");
|
||||
cy.wait(550);
|
||||
cy.get('[data-cy="it-textarea-user-text-input-3"]')
|
||||
.clear()
|
||||
.type("Hallo Teilaufgabe 2.3");
|
||||
cy.wait(550);
|
||||
cy.get('[data-cy="it-textarea-user-text-input-4"]')
|
||||
.clear()
|
||||
.type("Hallo Teilaufgabe 2.4");
|
||||
// wait because of input debounce
|
||||
cy.wait(550);
|
||||
cy.learningContentMultiLayoutNextStep();
|
||||
|
||||
// check that results are stored on server
|
||||
// load AssignmentCompletion from DB and check
|
||||
cy.loadAssignmentCompletion("assignment_user_id", TEST_STUDENT1_USER_ID).then(
|
||||
(ac) => {
|
||||
expect(ac.completion_status).to.equal("IN_PROGRESS");
|
||||
expect(JSON.stringify(ac.completion_data)).to.include(
|
||||
"Hallo Teilaufgabe 2.1"
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
// step 3
|
||||
cy.testLearningContentTitle(
|
||||
"Teilaufgabe 3: Filtere nach besonderen Ereignissen"
|
||||
);
|
||||
cy.get('[data-cy="it-textarea-user-text-input-1"]')
|
||||
.clear()
|
||||
.type("Hallo Teilaufgabe 3.1");
|
||||
cy.wait(550);
|
||||
cy.get('[data-cy="it-textarea-user-text-input-2"]')
|
||||
.clear()
|
||||
.type("Hallo Teilaufgabe 3.2");
|
||||
// wait because of input debounce
|
||||
cy.wait(550);
|
||||
cy.learningContentMultiLayoutNextStep();
|
||||
|
||||
// step 4
|
||||
cy.testLearningContentTitle("Teilaufgabe 4: Kundentelefonate");
|
||||
cy.get('[data-cy="it-textarea-user-text-input-0"]')
|
||||
.clear()
|
||||
.type("Hallo Teilaufgabe 4.1");
|
||||
// wait because of input debounce
|
||||
cy.wait(550);
|
||||
cy.learningContentMultiLayoutNextStep();
|
||||
|
||||
// step 5
|
||||
cy.testLearningContentTitle("Teilaufgabe 5: Kundentelefonate2");
|
||||
cy.get('[data-cy="it-textarea-user-text-input-0"]')
|
||||
.clear()
|
||||
.type("Hallo Teilaufgabe 5.1");
|
||||
// wait because of input debounce
|
||||
cy.wait(550);
|
||||
cy.learningContentMultiLayoutNextStep();
|
||||
|
||||
cy.get('[data-cy="confirm-submit-results"]').should("not.exist");
|
||||
cy.get('[data-cy="confirm-submit-person"]').should(
|
||||
"contain",
|
||||
"Folgende Person soll mir Feedback zu meinen Ergebnissen geben."
|
||||
);
|
||||
if (selectExpert) {
|
||||
cy.get('[data-cy="confirm-submit-person"]').click();
|
||||
}
|
||||
cy.get('[data-cy="submit-assignment"]').click();
|
||||
cy.get('[data-cy="success-text"]').should("exist");
|
||||
|
||||
// app goes back to circle view -> check if assignment is marked as completed
|
||||
cy.url().should((url) => {
|
||||
expect(url).to.match(/\/reisen#lu-reisen?$/);
|
||||
});
|
||||
cy.reload();
|
||||
cy.get(
|
||||
'[data-cy="test-lehrgang-lp-circle-reisen-lc-mein-kundenstamm-checkbox"]'
|
||||
).should("have.class", "cy-checked");
|
||||
}
|
||||
|
||||
describe("assignmentStudent.cy.js", () => {
|
||||
beforeEach(() => {
|
||||
cy.manageCommand("cypress_reset");
|
||||
|
|
@ -10,234 +125,247 @@ describe("assignmentStudent.cy.js", () => {
|
|||
);
|
||||
});
|
||||
|
||||
it("can open assignment", () => {
|
||||
cy.testLearningContentTitle("Einleitung");
|
||||
cy.testLearningContentSubtitle(
|
||||
"Überprüfen einer Motorfahrzeugs-Versicherungspolice"
|
||||
);
|
||||
});
|
||||
|
||||
it("can navigate through assignment", () => {
|
||||
// 1 Step forward
|
||||
cy.learningContentMultiLayoutNextStep();
|
||||
cy.testLearningContentTitle(
|
||||
"Teilaufgabe 1: Beispiel einer Versicherungspolice finden"
|
||||
);
|
||||
|
||||
cy.learningContentMultiLayoutNextStep();
|
||||
cy.testLearningContentTitle(
|
||||
"Teilaufgabe 2: Kundensituation und Ausgangslage"
|
||||
);
|
||||
|
||||
cy.learningContentMultiLayoutNextStep();
|
||||
cy.testLearningContentTitle("Teilaufgabe 3: Aktuelle Versicherung");
|
||||
|
||||
cy.learningContentMultiLayoutPreviousStep();
|
||||
|
||||
cy.testLearningContentTitle(
|
||||
"Teilaufgabe 2: Kundensituation und Ausgangslage"
|
||||
);
|
||||
});
|
||||
|
||||
it("can save confirmation", () => {
|
||||
// 1 Step forward
|
||||
cy.learningContentMultiLayoutNextStep();
|
||||
cy.testLearningContentTitle(
|
||||
"Teilaufgabe 1: Beispiel einer Versicherungspolice finden"
|
||||
);
|
||||
// Click confirmation
|
||||
cy.get('[data-cy="it-checkbox-confirmation-1"]').click();
|
||||
|
||||
cy.reload();
|
||||
cy.get('[data-cy="it-checkbox-confirmation-1"]').should(
|
||||
"have.class",
|
||||
"cy-checked"
|
||||
);
|
||||
});
|
||||
|
||||
it("can save text", () => {
|
||||
// 2 Steps forward
|
||||
cy.learningContentMultiLayoutNextStep();
|
||||
cy.learningContentMultiLayoutNextStep();
|
||||
cy.testLearningContentTitle(
|
||||
"Teilaufgabe 2: Kundensituation und Ausgangslage"
|
||||
);
|
||||
// Enter text
|
||||
cy.get('[data-cy="it-textarea-user-text-input-1"]')
|
||||
.clear()
|
||||
.type("Hallovelo");
|
||||
// wait because of input debounce
|
||||
cy.wait(550);
|
||||
cy.reload();
|
||||
|
||||
cy.get('[data-cy="it-textarea-user-text-input-1"]').should(
|
||||
"have.value",
|
||||
"Hallovelo"
|
||||
);
|
||||
});
|
||||
|
||||
it("can visit sub step directly via url", () => {
|
||||
cy.visit(
|
||||
"/course/test-lehrgang/learn/fahrzeug/überprüfen-einer-motorfahrzeug-versicherungspolice?step=3"
|
||||
);
|
||||
cy.testLearningContentTitle("Teilaufgabe 3: Aktuelle Versicherung");
|
||||
});
|
||||
|
||||
it("can visit sub step by clicking navigation bar", () => {
|
||||
cy.get('[data-cy="nav-progress-step-4"]').click();
|
||||
cy.testLearningContentTitle("Teilaufgabe 4: Deine Empfehlungen");
|
||||
});
|
||||
|
||||
it("can submit assignment", () => {
|
||||
cy.visit(
|
||||
"/course/test-lehrgang/learn/fahrzeug/überprüfen-einer-motorfahrzeug-versicherungspolice?step=7"
|
||||
);
|
||||
cy.get('[data-cy="confirm-submit-results"] label').click();
|
||||
cy.get('[data-cy="confirm-submit-person"]').click();
|
||||
cy.get('[data-cy="submit-assignment"]').click();
|
||||
cy.get('[data-cy="success-text"]').should("exist");
|
||||
|
||||
// Check if trainer received notification
|
||||
cy.clearLocalStorage();
|
||||
cy.clearCookies();
|
||||
cy.reload(true);
|
||||
login("test-trainer1@example.com", "test");
|
||||
cy.visit("/notifications");
|
||||
cy.get(`[data-cy=notification-idx-0]`).within(() => {
|
||||
cy.get('[data-cy="unread"]').should("exist");
|
||||
cy.get('[data-cy="notification-target-idx-0-verb"]').contains(
|
||||
"Test Student1 hat die geleitete Fallarbeit «Überprüfen einer Motorfahrzeugs-Versicherungspolice» abgegeben."
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
it("can make complete assignment", () => {
|
||||
cy.learningContentMultiLayoutNextStep();
|
||||
cy.testLearningContentTitle(
|
||||
"Teilaufgabe 1: Beispiel einer Versicherungspolice finden"
|
||||
);
|
||||
// Click confirmation
|
||||
cy.get('[data-cy="it-checkbox-confirmation-1"]').click();
|
||||
cy.learningContentMultiLayoutNextStep();
|
||||
|
||||
// step 2
|
||||
cy.testLearningContentTitle(
|
||||
"Teilaufgabe 2: Kundensituation und Ausgangslage"
|
||||
);
|
||||
cy.get('[data-cy="it-textarea-user-text-input-1"]')
|
||||
.clear()
|
||||
.type("Hallo Teilaufgabe 2");
|
||||
// wait because of input debounce
|
||||
cy.wait(550);
|
||||
cy.learningContentMultiLayoutNextStep();
|
||||
|
||||
// check that results are stored on server
|
||||
// load AssignmentCompletion from DB and check
|
||||
cy.loadAssignmentCompletion(
|
||||
"assignment_user_id",
|
||||
TEST_STUDENT1_USER_ID
|
||||
).then((ac) => {
|
||||
expect(ac.completion_status).to.equal("IN_PROGRESS");
|
||||
expect(JSON.stringify(ac.completion_data)).to.include(
|
||||
"Hallo Teilaufgabe 2"
|
||||
describe("Assignment", () => {
|
||||
it("can open assignment", () => {
|
||||
cy.testLearningContentTitle("Einleitung");
|
||||
cy.testLearningContentSubtitle(
|
||||
"Überprüfen einer Motorfahrzeugs-Versicherungspolice"
|
||||
);
|
||||
});
|
||||
|
||||
// step 3
|
||||
cy.testLearningContentTitle("Teilaufgabe 3: Aktuelle Versicherung");
|
||||
cy.get('[data-cy="it-textarea-user-text-input-1"]')
|
||||
.clear()
|
||||
.type("Hallo Teilaufgabe 3");
|
||||
// wait because of input debounce
|
||||
cy.wait(550);
|
||||
cy.learningContentMultiLayoutNextStep();
|
||||
it("can navigate through assignment", () => {
|
||||
// 1 Step forward
|
||||
cy.learningContentMultiLayoutNextStep();
|
||||
cy.testLearningContentTitle(
|
||||
"Teilaufgabe 1: Beispiel einer Versicherungspolice finden"
|
||||
);
|
||||
|
||||
// step 4
|
||||
cy.testLearningContentTitle("Teilaufgabe 4: Deine Empfehlungen");
|
||||
cy.get('[data-cy="it-textarea-user-text-input-1"]')
|
||||
.clear()
|
||||
.type("Hallo Teilaufgabe 4.1");
|
||||
cy.wait(550);
|
||||
cy.get('[data-cy="it-textarea-user-text-input-2"]')
|
||||
.clear()
|
||||
.type("Hallo Teilaufgabe 4.2");
|
||||
cy.wait(550);
|
||||
cy.get('[data-cy="it-textarea-user-text-input-3"]')
|
||||
.clear()
|
||||
.type("Hallo Teilaufgabe 4.3");
|
||||
// wait because of input debounce
|
||||
cy.wait(550);
|
||||
cy.learningContentMultiLayoutNextStep();
|
||||
cy.learningContentMultiLayoutNextStep();
|
||||
cy.testLearningContentTitle(
|
||||
"Teilaufgabe 2: Kundensituation und Ausgangslage"
|
||||
);
|
||||
|
||||
// step 5
|
||||
cy.testLearningContentTitle("Teilaufgabe 5: Reflexion");
|
||||
cy.get('[data-cy="it-textarea-user-text-input-1"]')
|
||||
.clear()
|
||||
.type("Hallo Teilaufgabe 5.1");
|
||||
cy.wait(550);
|
||||
cy.get('[data-cy="it-textarea-user-text-input-2"]')
|
||||
.clear()
|
||||
.type("Hallo Teilaufgabe 5.2");
|
||||
cy.wait(550);
|
||||
cy.get('[data-cy="it-textarea-user-text-input-3"]')
|
||||
.clear()
|
||||
.type("Hallo Teilaufgabe 5.3");
|
||||
// wait because of input debounce
|
||||
cy.wait(550);
|
||||
cy.learningContentMultiLayoutNextStep();
|
||||
cy.learningContentMultiLayoutNextStep();
|
||||
cy.testLearningContentTitle("Teilaufgabe 3: Aktuelle Versicherung");
|
||||
|
||||
// step 6
|
||||
cy.testLearningContentTitle("Teilaufgabe 6: Learnings");
|
||||
cy.get('[data-cy="it-textarea-user-text-input-1"]')
|
||||
.clear()
|
||||
.type("Hallo Teilaufgabe 6.1");
|
||||
cy.wait(550);
|
||||
cy.get('[data-cy="it-textarea-user-text-input-2"]')
|
||||
.clear()
|
||||
.type("Hallo Teilaufgabe 6.2");
|
||||
// wait because of input debounce
|
||||
cy.wait(550);
|
||||
cy.learningContentMultiLayoutNextStep();
|
||||
cy.learningContentMultiLayoutPreviousStep();
|
||||
|
||||
cy.get('[data-cy="confirm-submit-results"] label').click();
|
||||
cy.get('[data-cy="confirm-submit-person"]').click();
|
||||
cy.get('[data-cy="submit-assignment"]').click();
|
||||
cy.get('[data-cy="success-text"]').should("exist");
|
||||
|
||||
// app goes back to circle view -> check if assignment is marked as completed
|
||||
cy.url().should((url) => {
|
||||
expect(url).to.match(/\/fahrzeug#lu-transfer?$/);
|
||||
cy.testLearningContentTitle(
|
||||
"Teilaufgabe 2: Kundensituation und Ausgangslage"
|
||||
);
|
||||
});
|
||||
cy.reload();
|
||||
cy.get(
|
||||
'[data-cy="test-lehrgang-lp-circle-fahrzeug-lc-überprüfen-einer-motorfahrzeug-versicherungspolice-checkbox"]'
|
||||
).should("have.class", "cy-checked");
|
||||
|
||||
// reopening page should get directly to last step
|
||||
cy.visit(
|
||||
"/course/test-lehrgang/learn/fahrzeug/überprüfen-einer-motorfahrzeug-versicherungspolice"
|
||||
);
|
||||
cy.url().should("include", "step=7");
|
||||
it("can save confirmation", () => {
|
||||
// 1 Step forward
|
||||
cy.learningContentMultiLayoutNextStep();
|
||||
cy.testLearningContentTitle(
|
||||
"Teilaufgabe 1: Beispiel einer Versicherungspolice finden"
|
||||
);
|
||||
// Click confirmation
|
||||
cy.get('[data-cy="it-checkbox-confirmation-1"]').click();
|
||||
|
||||
// load AssignmentCompletion from DB and check
|
||||
cy.loadAssignmentCompletion(
|
||||
"assignment_user_id",
|
||||
TEST_STUDENT1_USER_ID
|
||||
).then((ac) => {
|
||||
expect(ac.completion_status).to.equal("SUBMITTED");
|
||||
expect(ac.evaluation_max_points).to.equal(24);
|
||||
const completionString = JSON.stringify(ac.completion_data);
|
||||
console.log(completionString);
|
||||
expect(completionString).to.include("Hallo Teilaufgabe 2");
|
||||
expect(completionString).to.include("Hallo Teilaufgabe 3");
|
||||
expect(completionString).to.include("Hallo Teilaufgabe 4.1");
|
||||
expect(completionString).to.include("Hallo Teilaufgabe 4.2");
|
||||
expect(completionString).to.include("Hallo Teilaufgabe 4.3");
|
||||
expect(completionString).to.include("Hallo Teilaufgabe 5.1");
|
||||
expect(completionString).to.include("Hallo Teilaufgabe 5.2");
|
||||
expect(completionString).to.include("Hallo Teilaufgabe 5.3");
|
||||
expect(completionString).to.include("Hallo Teilaufgabe 6.1");
|
||||
expect(completionString).to.include("Hallo Teilaufgabe 6.2");
|
||||
cy.reload();
|
||||
cy.get('[data-cy="it-checkbox-confirmation-1"]').should(
|
||||
"have.class",
|
||||
"cy-checked"
|
||||
);
|
||||
});
|
||||
|
||||
it("can save text", () => {
|
||||
// 2 Steps forward
|
||||
cy.learningContentMultiLayoutNextStep();
|
||||
cy.learningContentMultiLayoutNextStep();
|
||||
cy.testLearningContentTitle(
|
||||
"Teilaufgabe 2: Kundensituation und Ausgangslage"
|
||||
);
|
||||
// Enter text
|
||||
cy.get('[data-cy="it-textarea-user-text-input-1"]')
|
||||
.clear()
|
||||
.type("Hallovelo");
|
||||
// wait because of input debounce
|
||||
cy.wait(550);
|
||||
cy.reload();
|
||||
|
||||
cy.get('[data-cy="it-textarea-user-text-input-1"]').should(
|
||||
"have.value",
|
||||
"Hallovelo"
|
||||
);
|
||||
});
|
||||
|
||||
it("can visit sub step directly via url", () => {
|
||||
cy.visit(
|
||||
"/course/test-lehrgang/learn/fahrzeug/überprüfen-einer-motorfahrzeug-versicherungspolice?step=3"
|
||||
);
|
||||
cy.testLearningContentTitle("Teilaufgabe 3: Aktuelle Versicherung");
|
||||
});
|
||||
|
||||
it("can visit sub step by clicking navigation bar", () => {
|
||||
cy.get('[data-cy="nav-progress-step-4"]').click();
|
||||
cy.testLearningContentTitle("Teilaufgabe 4: Deine Empfehlungen");
|
||||
});
|
||||
|
||||
it("can submit assignment", () => {
|
||||
cy.visit(
|
||||
"/course/test-lehrgang/learn/fahrzeug/überprüfen-einer-motorfahrzeug-versicherungspolice?step=7"
|
||||
);
|
||||
cy.get('[data-cy="confirm-submit-results"] label').click();
|
||||
cy.get('[data-cy="confirm-submit-person"]').click();
|
||||
cy.get('[data-cy="submit-assignment"]').click();
|
||||
cy.get('[data-cy="success-text"]').should("exist");
|
||||
|
||||
// Check if trainer received notification
|
||||
cy.clearLocalStorage();
|
||||
cy.clearCookies();
|
||||
cy.reload(true);
|
||||
login("test-trainer1@example.com", "test");
|
||||
cy.visit("/notifications");
|
||||
cy.get(`[data-cy=notification-idx-0]`).within(() => {
|
||||
cy.get('[data-cy="unread"]').should("exist");
|
||||
cy.get('[data-cy="notification-target-idx-0-verb"]').contains(
|
||||
"Test Student1 hat die geleitete Fallarbeit «Überprüfen einer Motorfahrzeugs-Versicherungspolice» abgegeben."
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
it("can make complete assignment", () => {
|
||||
cy.learningContentMultiLayoutNextStep();
|
||||
cy.testLearningContentTitle(
|
||||
"Teilaufgabe 1: Beispiel einer Versicherungspolice finden"
|
||||
);
|
||||
// Click confirmation
|
||||
cy.get('[data-cy="it-checkbox-confirmation-1"]').click();
|
||||
cy.learningContentMultiLayoutNextStep();
|
||||
|
||||
// step 2
|
||||
cy.testLearningContentTitle(
|
||||
"Teilaufgabe 2: Kundensituation und Ausgangslage"
|
||||
);
|
||||
cy.get('[data-cy="it-textarea-user-text-input-1"]')
|
||||
.clear()
|
||||
.type("Hallo Teilaufgabe 2");
|
||||
// wait because of input debounce
|
||||
cy.wait(550);
|
||||
cy.learningContentMultiLayoutNextStep();
|
||||
|
||||
// check that results are stored on server
|
||||
// load AssignmentCompletion from DB and check
|
||||
cy.loadAssignmentCompletion(
|
||||
"assignment_user_id",
|
||||
TEST_STUDENT1_USER_ID
|
||||
).then((ac) => {
|
||||
expect(ac.completion_status).to.equal("IN_PROGRESS");
|
||||
expect(JSON.stringify(ac.completion_data)).to.include(
|
||||
"Hallo Teilaufgabe 2"
|
||||
);
|
||||
});
|
||||
|
||||
// step 3
|
||||
cy.testLearningContentTitle("Teilaufgabe 3: Aktuelle Versicherung");
|
||||
cy.get('[data-cy="it-textarea-user-text-input-1"]')
|
||||
.clear()
|
||||
.type("Hallo Teilaufgabe 3");
|
||||
// wait because of input debounce
|
||||
cy.wait(550);
|
||||
cy.learningContentMultiLayoutNextStep();
|
||||
|
||||
// step 4
|
||||
cy.testLearningContentTitle("Teilaufgabe 4: Deine Empfehlungen");
|
||||
cy.get('[data-cy="it-textarea-user-text-input-1"]')
|
||||
.clear()
|
||||
.type("Hallo Teilaufgabe 4.1");
|
||||
cy.wait(550);
|
||||
cy.get('[data-cy="it-textarea-user-text-input-2"]')
|
||||
.clear()
|
||||
.type("Hallo Teilaufgabe 4.2");
|
||||
cy.wait(550);
|
||||
cy.get('[data-cy="it-textarea-user-text-input-3"]')
|
||||
.clear()
|
||||
.type("Hallo Teilaufgabe 4.3");
|
||||
// wait because of input debounce
|
||||
cy.wait(550);
|
||||
cy.learningContentMultiLayoutNextStep();
|
||||
|
||||
// step 5
|
||||
cy.testLearningContentTitle("Teilaufgabe 5: Reflexion");
|
||||
cy.get('[data-cy="it-textarea-user-text-input-1"]')
|
||||
.clear()
|
||||
.type("Hallo Teilaufgabe 5.1");
|
||||
cy.wait(550);
|
||||
cy.get('[data-cy="it-textarea-user-text-input-2"]')
|
||||
.clear()
|
||||
.type("Hallo Teilaufgabe 5.2");
|
||||
cy.wait(550);
|
||||
cy.get('[data-cy="it-textarea-user-text-input-3"]')
|
||||
.clear()
|
||||
.type("Hallo Teilaufgabe 5.3");
|
||||
// wait because of input debounce
|
||||
cy.wait(550);
|
||||
cy.learningContentMultiLayoutNextStep();
|
||||
|
||||
// step 6
|
||||
cy.testLearningContentTitle("Teilaufgabe 6: Learnings");
|
||||
cy.get('[data-cy="it-textarea-user-text-input-1"]')
|
||||
.clear()
|
||||
.type("Hallo Teilaufgabe 6.1");
|
||||
cy.wait(550);
|
||||
cy.get('[data-cy="it-textarea-user-text-input-2"]')
|
||||
.clear()
|
||||
.type("Hallo Teilaufgabe 6.2");
|
||||
// wait because of input debounce
|
||||
cy.wait(550);
|
||||
cy.learningContentMultiLayoutNextStep();
|
||||
|
||||
cy.get('[data-cy="confirm-submit-person"]').should(
|
||||
"contain",
|
||||
"Ja, die folgende Person soll meine Ergebnisse bewerten."
|
||||
);
|
||||
cy.get('[data-cy="confirm-submit-results"] label').click();
|
||||
cy.get('[data-cy="confirm-submit-person"]').click();
|
||||
cy.get('[data-cy="submit-assignment"]').click();
|
||||
cy.get('[data-cy="success-text"]').should("exist");
|
||||
|
||||
// app goes back to circle view -> check if assignment is marked as completed
|
||||
cy.url().should((url) => {
|
||||
expect(url).to.match(/\/fahrzeug#lu-transfer?$/);
|
||||
});
|
||||
cy.reload();
|
||||
cy.get(
|
||||
'[data-cy="test-lehrgang-lp-circle-fahrzeug-lc-überprüfen-einer-motorfahrzeug-versicherungspolice-checkbox"]'
|
||||
).should("have.class", "cy-checked");
|
||||
|
||||
// reopening page should get directly to last step
|
||||
cy.visit(
|
||||
"/course/test-lehrgang/learn/fahrzeug/überprüfen-einer-motorfahrzeug-versicherungspolice"
|
||||
);
|
||||
cy.url().should("include", "step=7");
|
||||
|
||||
// load AssignmentCompletion from DB and check
|
||||
cy.loadAssignmentCompletion(
|
||||
"assignment_user_id",
|
||||
TEST_STUDENT1_USER_ID
|
||||
).then((ac) => {
|
||||
expect(ac.completion_status).to.equal("SUBMITTED");
|
||||
expect(ac.evaluation_max_points).to.equal(24);
|
||||
const completionString = JSON.stringify(ac.completion_data);
|
||||
console.log(completionString);
|
||||
expect(completionString).to.include("Hallo Teilaufgabe 2");
|
||||
expect(completionString).to.include("Hallo Teilaufgabe 3");
|
||||
expect(completionString).to.include("Hallo Teilaufgabe 4.1");
|
||||
expect(completionString).to.include("Hallo Teilaufgabe 4.2");
|
||||
expect(completionString).to.include("Hallo Teilaufgabe 4.3");
|
||||
expect(completionString).to.include("Hallo Teilaufgabe 5.1");
|
||||
expect(completionString).to.include("Hallo Teilaufgabe 5.2");
|
||||
expect(completionString).to.include("Hallo Teilaufgabe 5.3");
|
||||
expect(completionString).to.include("Hallo Teilaufgabe 6.1");
|
||||
expect(completionString).to.include("Hallo Teilaufgabe 6.2");
|
||||
});
|
||||
});
|
||||
});
|
||||
describe.only("Praxis Assignment", () => {
|
||||
it("can make complete assignment without expert", () =>
|
||||
completePraxisAssignment());
|
||||
|
||||
it("can make complete assignment with expert", () =>
|
||||
completePraxisAssignment(true));
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,7 +1,3 @@
|
|||
from wagtail.blocks import StreamValue
|
||||
from wagtail.blocks.list_block import ListBlock, ListValue
|
||||
from wagtail.rich_text import RichText
|
||||
|
||||
from vbv_lernwelt.assignment.models import (
|
||||
AssignmentListPage,
|
||||
AssignmentType,
|
||||
|
|
@ -24,6 +20,9 @@ from vbv_lernwelt.course.consts import (
|
|||
COURSE_VERSICHERUNGSVERMITTLERIN_ID,
|
||||
)
|
||||
from vbv_lernwelt.course.models import CoursePage
|
||||
from wagtail.blocks import StreamValue
|
||||
from wagtail.blocks.list_block import ListBlock, ListValue
|
||||
from wagtail.rich_text import RichText
|
||||
|
||||
|
||||
def create_uk_fahrzeug_casework(course_id=COURSE_UK, competence_certificate=None):
|
||||
|
|
|
|||
|
|
@ -9,7 +9,8 @@ from vbv_lernwelt.assignment.creators.create_assignments import (
|
|||
create_uk_condition_acceptance,
|
||||
create_uk_fahrzeug_casework,
|
||||
create_uk_fahrzeug_prep_assignment,
|
||||
create_uk_reflection, create_vv_gewinnen_casework,
|
||||
create_uk_reflection,
|
||||
create_vv_gewinnen_casework,
|
||||
)
|
||||
from vbv_lernwelt.assignment.models import (
|
||||
Assignment,
|
||||
|
|
@ -112,9 +113,7 @@ def create_test_course(include_uk=True, include_vv=True, with_sessions=False):
|
|||
)
|
||||
|
||||
if include_vv:
|
||||
create_vv_gewinnen_casework(
|
||||
course_id=COURSE_TEST_ID
|
||||
)
|
||||
create_vv_gewinnen_casework(course_id=COURSE_TEST_ID)
|
||||
|
||||
create_test_learning_path(include_uk=include_uk, include_vv=include_vv)
|
||||
create_test_media_library()
|
||||
|
|
|
|||
Loading…
Reference in New Issue