Add tests
This commit is contained in:
parent
6bb08ab316
commit
01c288f686
|
|
@ -63,8 +63,8 @@ const showDuration = computed(() => {
|
|||
return false;
|
||||
});
|
||||
|
||||
const show_document_section = computed(() => {
|
||||
return lpQueryResult.course.value.enable_circle_documents && !props.readonly;
|
||||
const showDocumentSection = computed(() => {
|
||||
return lpQueryResult.course.value?.enable_circle_documents && !props.readonly;
|
||||
});
|
||||
|
||||
watch(
|
||||
|
|
@ -193,7 +193,7 @@ watch(
|
|||
{{ $t("circlePage.learnMore") }}
|
||||
</button>
|
||||
</div>
|
||||
<DocumentSection v-if="show_document_section" :circle="circle" />
|
||||
<DocumentSection v-if="showDocumentSection" :circle="circle" />
|
||||
<div v-if="!props.readonly" class="expert mt-8 border p-6">
|
||||
<h3 class="text-blue-dark">{{ $t("circlePage.gotQuestions") }}</h3>
|
||||
<div class="mt-4 leading-relaxed">
|
||||
|
|
|
|||
|
|
@ -0,0 +1,40 @@
|
|||
import { login } from "./helpers";
|
||||
|
||||
describe("settings.cy.js", () => {
|
||||
beforeEach(() => {
|
||||
cy.manageCommand("cypress_reset");
|
||||
});
|
||||
|
||||
describe("with circle documents enabled", () => {
|
||||
it("student can see circle documents", () => {
|
||||
login("test-student1@example.com", "test");
|
||||
cy.visit("/course/test-lehrgang/learn/fahrzeug");
|
||||
cy.get('[data-cy="circle-document-section"]').should("exist");
|
||||
});
|
||||
|
||||
it("trainer can see circle documents", () => {
|
||||
login("test-trainer1@example.com", "test");
|
||||
cy.visit("/course/test-lehrgang/cockpit");
|
||||
cy.get('[data-cy="circle-documents"]').should("exist");
|
||||
});
|
||||
});
|
||||
|
||||
describe("with circle documents disabled", () => {
|
||||
beforeEach(() => {
|
||||
cy.manageCommand("cypress_reset --no-enable-circle-documents");
|
||||
});
|
||||
|
||||
it("student cannot see circle documents", () => {
|
||||
login("test-student1@example.com", "test");
|
||||
cy.visit("/course/test-lehrgang/learn/fahrzeug");
|
||||
cy.get('[data-cy="circle-title"]').should("contain", "Fahrzeug");
|
||||
cy.get('[data-cy="circle-document-section"]').should("not.exist");
|
||||
});
|
||||
|
||||
it("trainer cannot see circle documents", () => {
|
||||
login("test-trainer1@example.com", "test");
|
||||
cy.visit("/course/test-lehrgang/cockpit");
|
||||
cy.get('[data-cy="circle-documents"]').should("not.exist");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
@ -60,6 +60,7 @@ Cypress.Commands.add("manageCommand", (command, preCommand = "") => {
|
|||
let pythonPaths = [
|
||||
"/Users/daniel/workspace/vbv_lernwelt/.direnv/python-3.10.6/bin",
|
||||
"/Users/eliabieri/iterativ/vbv_lernwelt/.direnv/python-3.10.6/bin",
|
||||
"/Users/christiancueni/workspace/vbv_lernwelt/.direnv/python-3.10.6/bin",
|
||||
];
|
||||
let bashCommand = `PATH=${pythonPaths.join(":")}:$PATH && ${execCommand}`;
|
||||
return cy
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ from vbv_lernwelt.core.constants import (
|
|||
TEST_TRAINER1_USER_ID,
|
||||
)
|
||||
from vbv_lernwelt.core.models import User
|
||||
from vbv_lernwelt.course.consts import COURSE_TEST_ID
|
||||
from vbv_lernwelt.course.creators.test_course import (
|
||||
create_edoniq_test_result_data,
|
||||
create_feedback_response_data,
|
||||
|
|
@ -20,6 +21,7 @@ from vbv_lernwelt.course.creators.test_course import (
|
|||
create_test_assignment_submitted_data,
|
||||
)
|
||||
from vbv_lernwelt.course.models import (
|
||||
Course,
|
||||
CourseCompletion,
|
||||
CourseCompletionStatus,
|
||||
CourseSession,
|
||||
|
|
@ -73,6 +75,11 @@ from vbv_lernwelt.notify.models import Notification
|
|||
default=False,
|
||||
help="will create attendance days data",
|
||||
)
|
||||
@click.option(
|
||||
"--enable-circle-documents/--no-enable-circle-documents",
|
||||
default=True,
|
||||
help="will enable circle documents for test course",
|
||||
)
|
||||
def command(
|
||||
create_assignment_completion,
|
||||
create_assignment_evaluation,
|
||||
|
|
@ -81,6 +88,7 @@ def command(
|
|||
create_feedback_responses,
|
||||
create_course_completion_performance_criteria,
|
||||
create_attendance_days,
|
||||
enable_circle_documents,
|
||||
):
|
||||
print("cypress reset data")
|
||||
CourseCompletion.objects.all().delete()
|
||||
|
|
@ -243,3 +251,7 @@ def command(
|
|||
datetime(year=2000, month=10, day=31, hour=11)
|
||||
)
|
||||
attendance_course.save()
|
||||
|
||||
course = Course.objects.get(id=COURSE_TEST_ID)
|
||||
course.enable_circle_documents = enable_circle_documents
|
||||
course.save()
|
||||
|
|
|
|||
Loading…
Reference in New Issue