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 ?? {};
|
return props.assignmentCompletion?.task_completion_data ?? {};
|
||||||
});
|
});
|
||||||
|
|
||||||
const canSubmit = computed(() => {
|
const cannotSubmit = computed(() => {
|
||||||
return (
|
return (
|
||||||
!state.confirmInput ||
|
(!state.confirmInput && !isPraxisAssignment.value) ||
|
||||||
(props.assignment.assignment_type === "CASEWORK" && !state.confirmPerson)
|
(props.assignment.assignment_type === "CASEWORK" && !state.confirmPerson)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
const isCasework = computed(() =>
|
function checkAssignmentType(
|
||||||
(
|
assignmentType: AssignmentAssignmentAssignmentTypeChoices[]
|
||||||
["CASEWORK", "PRAXIS_ASSIGNMENT"] as AssignmentAssignmentAssignmentTypeChoices[]
|
) {
|
||||||
).includes(props.assignment.assignment_type)
|
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(
|
const upsertAssignmentCompletionMutation = useMutation(
|
||||||
UPSERT_ASSIGNMENT_COMPLETION_MUTATION
|
UPSERT_ASSIGNMENT_COMPLETION_MUTATION
|
||||||
|
|
@ -127,6 +133,7 @@ const onSubmit = async () => {
|
||||||
|
|
||||||
<div v-if="completionStatus === 'IN_PROGRESS'">
|
<div v-if="completionStatus === 'IN_PROGRESS'">
|
||||||
<ItCheckbox
|
<ItCheckbox
|
||||||
|
v-if="!isPraxisAssignment"
|
||||||
class="w-full border-b border-gray-400 py-10 sm:py-6"
|
class="w-full border-b border-gray-400 py-10 sm:py-6"
|
||||||
:checkbox-item="{
|
:checkbox-item="{
|
||||||
label: $t('assignment.confirmSubmitResults'),
|
label: $t('assignment.confirmSubmitResults'),
|
||||||
|
|
@ -136,11 +143,14 @@ const onSubmit = async () => {
|
||||||
data-cy="confirm-submit-results"
|
data-cy="confirm-submit-results"
|
||||||
@toggle="state.confirmInput = !state.confirmInput"
|
@toggle="state.confirmInput = !state.confirmInput"
|
||||||
></ItCheckbox>
|
></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
|
<ItCheckbox
|
||||||
|
v-if="mayBeEvaluated"
|
||||||
class="py-6"
|
class="py-6"
|
||||||
:checkbox-item="{
|
:checkbox-item="{
|
||||||
label: $t('assignment.confirmSubmitPerson'),
|
label: isPraxisAssignment
|
||||||
|
? $t('a.confirmSubmitPersonPraxisAssignment')
|
||||||
|
: $t('assignment.confirmSubmitPerson'),
|
||||||
value: 'value',
|
value: 'value',
|
||||||
checked: state.confirmPerson,
|
checked: state.confirmPerson,
|
||||||
}"
|
}"
|
||||||
|
|
@ -165,7 +175,7 @@ const onSubmit = async () => {
|
||||||
{{ $t("assignment.showAssessmentDocument") }}
|
{{ $t("assignment.showAssessmentDocument") }}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<p v-if="isCasework && props.submissionDeadlineStart" class="pt-6">
|
<p v-if="mayBeEvaluated && props.submissionDeadlineStart" class="pt-6">
|
||||||
{{ $t("assignment.dueDateSubmission") }}
|
{{ $t("assignment.dueDateSubmission") }}
|
||||||
<DateEmbedding
|
<DateEmbedding
|
||||||
:single-date="dayjs(props.submissionDeadlineStart)"
|
:single-date="dayjs(props.submissionDeadlineStart)"
|
||||||
|
|
@ -175,7 +185,7 @@ const onSubmit = async () => {
|
||||||
class="mt-6"
|
class="mt-6"
|
||||||
variant="blue"
|
variant="blue"
|
||||||
size="large"
|
size="large"
|
||||||
:disabled="canSubmit"
|
:disabled="cannotSubmit"
|
||||||
data-cy="submit-assignment"
|
data-cy="submit-assignment"
|
||||||
@click="onSubmit"
|
@click="onSubmit"
|
||||||
>
|
>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,121 @@
|
||||||
import { TEST_STUDENT1_USER_ID } from "../../consts";
|
import { TEST_STUDENT1_USER_ID } from "../../consts";
|
||||||
import { login } from "../helpers";
|
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", () => {
|
describe("assignmentStudent.cy.js", () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.manageCommand("cypress_reset");
|
cy.manageCommand("cypress_reset");
|
||||||
|
|
@ -10,234 +125,247 @@ describe("assignmentStudent.cy.js", () => {
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("can open assignment", () => {
|
describe("Assignment", () => {
|
||||||
cy.testLearningContentTitle("Einleitung");
|
it("can open assignment", () => {
|
||||||
cy.testLearningContentSubtitle(
|
cy.testLearningContentTitle("Einleitung");
|
||||||
"Überprüfen einer Motorfahrzeugs-Versicherungspolice"
|
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"
|
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
// step 3
|
it("can navigate through assignment", () => {
|
||||||
cy.testLearningContentTitle("Teilaufgabe 3: Aktuelle Versicherung");
|
// 1 Step forward
|
||||||
cy.get('[data-cy="it-textarea-user-text-input-1"]')
|
cy.learningContentMultiLayoutNextStep();
|
||||||
.clear()
|
cy.testLearningContentTitle(
|
||||||
.type("Hallo Teilaufgabe 3");
|
"Teilaufgabe 1: Beispiel einer Versicherungspolice finden"
|
||||||
// wait because of input debounce
|
);
|
||||||
cy.wait(550);
|
|
||||||
cy.learningContentMultiLayoutNextStep();
|
|
||||||
|
|
||||||
// step 4
|
cy.learningContentMultiLayoutNextStep();
|
||||||
cy.testLearningContentTitle("Teilaufgabe 4: Deine Empfehlungen");
|
cy.testLearningContentTitle(
|
||||||
cy.get('[data-cy="it-textarea-user-text-input-1"]')
|
"Teilaufgabe 2: Kundensituation und Ausgangslage"
|
||||||
.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.learningContentMultiLayoutNextStep();
|
||||||
cy.testLearningContentTitle("Teilaufgabe 5: Reflexion");
|
cy.testLearningContentTitle("Teilaufgabe 3: Aktuelle Versicherung");
|
||||||
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.learningContentMultiLayoutPreviousStep();
|
||||||
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-results"] label').click();
|
cy.testLearningContentTitle(
|
||||||
cy.get('[data-cy="confirm-submit-person"]').click();
|
"Teilaufgabe 2: Kundensituation und Ausgangslage"
|
||||||
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
|
it("can save confirmation", () => {
|
||||||
cy.visit(
|
// 1 Step forward
|
||||||
"/course/test-lehrgang/learn/fahrzeug/überprüfen-einer-motorfahrzeug-versicherungspolice"
|
cy.learningContentMultiLayoutNextStep();
|
||||||
);
|
cy.testLearningContentTitle(
|
||||||
cy.url().should("include", "step=7");
|
"Teilaufgabe 1: Beispiel einer Versicherungspolice finden"
|
||||||
|
);
|
||||||
|
// Click confirmation
|
||||||
|
cy.get('[data-cy="it-checkbox-confirmation-1"]').click();
|
||||||
|
|
||||||
// load AssignmentCompletion from DB and check
|
cy.reload();
|
||||||
cy.loadAssignmentCompletion(
|
cy.get('[data-cy="it-checkbox-confirmation-1"]').should(
|
||||||
"assignment_user_id",
|
"have.class",
|
||||||
TEST_STUDENT1_USER_ID
|
"cy-checked"
|
||||||
).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");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
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 (
|
from vbv_lernwelt.assignment.models import (
|
||||||
AssignmentListPage,
|
AssignmentListPage,
|
||||||
AssignmentType,
|
AssignmentType,
|
||||||
|
|
@ -24,6 +20,9 @@ from vbv_lernwelt.course.consts import (
|
||||||
COURSE_VERSICHERUNGSVERMITTLERIN_ID,
|
COURSE_VERSICHERUNGSVERMITTLERIN_ID,
|
||||||
)
|
)
|
||||||
from vbv_lernwelt.course.models import CoursePage
|
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):
|
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_condition_acceptance,
|
||||||
create_uk_fahrzeug_casework,
|
create_uk_fahrzeug_casework,
|
||||||
create_uk_fahrzeug_prep_assignment,
|
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 (
|
from vbv_lernwelt.assignment.models import (
|
||||||
Assignment,
|
Assignment,
|
||||||
|
|
@ -112,9 +113,7 @@ def create_test_course(include_uk=True, include_vv=True, with_sessions=False):
|
||||||
)
|
)
|
||||||
|
|
||||||
if include_vv:
|
if include_vv:
|
||||||
create_vv_gewinnen_casework(
|
create_vv_gewinnen_casework(course_id=COURSE_TEST_ID)
|
||||||
course_id=COURSE_TEST_ID
|
|
||||||
)
|
|
||||||
|
|
||||||
create_test_learning_path(include_uk=include_uk, include_vv=include_vv)
|
create_test_learning_path(include_uk=include_uk, include_vv=include_vv)
|
||||||
create_test_media_library()
|
create_test_media_library()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue