Fix tests, add links
This commit is contained in:
parent
8b6a623f07
commit
1b378fafcc
|
|
@ -7,7 +7,7 @@ import AssignmentSummary from "@/components/dashboard/AssignmentSummary.vue";
|
|||
import MentorOpenTasksCount from "@/components/dashboard/MentorOpenTasksCount.vue";
|
||||
import MentorMenteeCount from "@/components/dashboard/MentorMenteeCount.vue";
|
||||
import MentorCompetenceSummary from "@/components/dashboard/MentorCompetenceSummary.vue";
|
||||
import { getLearningPathUrl } from "@/utils/utils";
|
||||
import { getCockpitUrl, getLearningMentorUrl, getLearningPathUrl } from "@/utils/utils";
|
||||
import UkStatistics from "@/components/dashboard/UkStatistics.vue";
|
||||
|
||||
const mentorWidgets = [
|
||||
|
|
@ -50,15 +50,21 @@ const actionButtonProps = computed<{ href: string; text: string; cyKey: string }
|
|||
};
|
||||
} else if (props.courseConfig?.role_key === "Expert") {
|
||||
return {
|
||||
href: "expertlink",
|
||||
href: getCockpitUrl(props.courseConfig?.course_slug),
|
||||
text: "Cockpit anschauen",
|
||||
cyKey: "",
|
||||
cyKey: "cockpit-dashboard-link",
|
||||
};
|
||||
} else if (props.courseConfig?.role_key === "Supervisor") {
|
||||
return {
|
||||
href: "supervisorlink",
|
||||
href: getCockpitUrl(props.courseConfig?.course_slug),
|
||||
text: "Cockpit anschauen",
|
||||
cyKey: "Cockpit anschauen",
|
||||
cyKey: "cockpit-dashboard-link",
|
||||
};
|
||||
} else if (props.courseConfig?.role_key === "MentorVV") {
|
||||
return {
|
||||
href: getLearningMentorUrl(props.courseConfig?.course_slug),
|
||||
text: "a.Übersicht anschauen",
|
||||
cyKey: "lm-dashboard-link",
|
||||
};
|
||||
}
|
||||
return {
|
||||
|
|
@ -86,7 +92,7 @@ function hasActionButton(): boolean {
|
|||
class="btn-blue"
|
||||
:data-cy="actionButtonProps.cyKey"
|
||||
>
|
||||
{{ actionButtonProps.text }}
|
||||
{{ $t(actionButtonProps.text) }}
|
||||
</a>
|
||||
</div>
|
||||
<p>
|
||||
|
|
|
|||
|
|
@ -63,14 +63,6 @@ describe("dashboardSupervisor.cy.js", () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe("overall summary box", () => {
|
||||
it("contains correct numbers (members, experts etc.)", () => {
|
||||
getDashboardStatistics("participant.count").should("have.text", "4");
|
||||
getDashboardStatistics("expert.count").should("have.text", "2");
|
||||
getDashboardStatistics("session.count").should("have.text", "2");
|
||||
});
|
||||
});
|
||||
|
||||
describe("feedback summary box", () => {
|
||||
it("contains correct numbers", () => {
|
||||
getDashboardStatistics("feedback.average").should("have.text", "3.3");
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
export const MENTOR_OVERVIEW_URL =
|
||||
export const MENTOR_TASKS_URL =
|
||||
"/course/versicherungsvermittler-in/learning-mentor/tasks";
|
||||
export const MENTOR_MENTEES_URL =
|
||||
"/course/versicherungsvermittler-in/learning-mentor";
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import {
|
|||
MENTOR_MY_MENTEES,
|
||||
MENTOR_MY_MENTORS,
|
||||
MENTOR_OVERVIEW_NAVIGATION_LINK,
|
||||
MENTOR_OVERVIEW_URL
|
||||
MENTOR_TASKS_URL,
|
||||
} from "../constants";
|
||||
|
||||
describe("memberOnly.cy.js", () => {
|
||||
|
|
@ -23,14 +23,14 @@ describe("memberOnly.cy.js", () => {
|
|||
});
|
||||
|
||||
it("shows NO mentees navigation link", () => {
|
||||
cy.visit(MENTOR_OVERVIEW_URL);
|
||||
cy.visit(MENTOR_TASKS_URL);
|
||||
cy.get(MENTOR_MENTEES_NAVIGATION_LINK).should("not.exist");
|
||||
})
|
||||
});
|
||||
|
||||
it("shows NO overview navigation link", () => {
|
||||
cy.visit(MENTOR_OVERVIEW_URL);
|
||||
cy.visit(MENTOR_TASKS_URL);
|
||||
cy.get(MENTOR_OVERVIEW_NAVIGATION_LINK).should("not.exist");
|
||||
})
|
||||
});
|
||||
|
||||
it("shows NO mentees", () => {
|
||||
cy.visit(MENTOR_MENTEES_URL);
|
||||
|
|
@ -54,5 +54,5 @@ describe("memberOnly.cy.js", () => {
|
|||
|
||||
// then
|
||||
cy.contains(MENTOR_MY_MENTORS, mentor).should("not.exist");
|
||||
})
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import {
|
|||
MENTOR_MY_MENTEES,
|
||||
MENTOR_MY_MENTORS,
|
||||
MENTOR_OVERVIEW_NAVIGATION_LINK,
|
||||
MENTOR_OVERVIEW_URL
|
||||
MENTOR_TASKS_URL,
|
||||
} from "../constants";
|
||||
|
||||
describe("mentorAndMember.cy.js", () => {
|
||||
|
|
@ -27,21 +27,21 @@ describe("mentorAndMember.cy.js", () => {
|
|||
});
|
||||
|
||||
it("shows the learning mentor navigation", () => {
|
||||
cy.visit(MENTOR_OVERVIEW_URL);
|
||||
cy.visit(MENTOR_TASKS_URL);
|
||||
cy.get(MENTOR_MAIN_NAVIGATION).should("exist");
|
||||
});
|
||||
|
||||
it("shows the mentees navigation link", () => {
|
||||
cy.visit(MENTOR_OVERVIEW_URL);
|
||||
cy.visit(MENTOR_TASKS_URL);
|
||||
cy.get(MENTOR_MENTEES_NAVIGATION_LINK).click();
|
||||
cy.url().should("include", MENTOR_MENTEES_URL);
|
||||
})
|
||||
});
|
||||
|
||||
it("shows the overview navigation link", () => {
|
||||
cy.visit(MENTOR_OVERVIEW_URL);
|
||||
cy.visit(MENTOR_TASKS_URL);
|
||||
cy.get(MENTOR_OVERVIEW_NAVIGATION_LINK).click();
|
||||
cy.url().should("include", MENTOR_OVERVIEW_URL);
|
||||
})
|
||||
cy.url().should("include", MENTOR_TASKS_URL);
|
||||
});
|
||||
|
||||
it("shows my mentees", () => {
|
||||
cy.visit(MENTOR_MENTEES_URL);
|
||||
|
|
@ -69,10 +69,11 @@ describe("mentorAndMember.cy.js", () => {
|
|||
.click();
|
||||
|
||||
// then
|
||||
const expectedMenteeProfileUrl = "/course/versicherungsvermittler-in/profile/5ff59857-8de5-415e-a387-4449f9a0337a"
|
||||
const expectedMenteeProfileUrl =
|
||||
"/course/versicherungsvermittler-in/profile/5ff59857-8de5-415e-a387-4449f9a0337a";
|
||||
cy.url().should("include", expectedMenteeProfileUrl);
|
||||
cy.contains(mentee).should("exist");
|
||||
})
|
||||
});
|
||||
|
||||
it("can remove a mentee", () => {
|
||||
// given
|
||||
|
|
@ -86,14 +87,16 @@ describe("mentorAndMember.cy.js", () => {
|
|||
|
||||
// then
|
||||
cy.contains(MENTOR_MENTEE_LIST_ITEM, mentee).should("not.exist");
|
||||
cy.contains("Aktuell begleitest du niemanden als Lernbegleitung").should("exist");
|
||||
})
|
||||
cy.contains("Aktuell begleitest du niemanden als Lernbegleitung").should(
|
||||
"exist"
|
||||
);
|
||||
});
|
||||
|
||||
it("shows the correct mentors", () => {
|
||||
const mentor = "Micheala Weber-Mentor";
|
||||
cy.visit(MENTOR_MENTEES_URL);
|
||||
cy.get(MENTOR_MY_MENTORS).should("contain", mentor);
|
||||
})
|
||||
});
|
||||
|
||||
it("can remove a mentor", () => {
|
||||
// given
|
||||
|
|
@ -107,6 +110,8 @@ describe("mentorAndMember.cy.js", () => {
|
|||
|
||||
// then
|
||||
cy.contains(MENTOR_MY_MENTORS, mentor).should("not.exist");
|
||||
cy.contains("Aktuell hast du noch keine Person als Lernbegleitung eingeladen").should("exist");
|
||||
})
|
||||
cy.contains(
|
||||
"Aktuell hast du noch keine Person als Lernbegleitung eingeladen"
|
||||
).should("exist");
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import {
|
|||
MENTOR_MY_MENTEES,
|
||||
MENTOR_MY_MENTORS,
|
||||
MENTOR_OVERVIEW_NAVIGATION_LINK,
|
||||
MENTOR_OVERVIEW_URL
|
||||
MENTOR_TASKS_URL,
|
||||
} from "../constants";
|
||||
|
||||
describe("mentorOnly.cy.js", () => {
|
||||
|
|
@ -22,25 +22,25 @@ describe("mentorOnly.cy.js", () => {
|
|||
it("shows the correct dashboard", () => {
|
||||
cy.visit("/");
|
||||
cy.get(MENTOR_DASHBOARD_LINK).click();
|
||||
cy.url().should("include", MENTOR_OVERVIEW_URL);
|
||||
cy.url().should("include", MENTOR_MENTEES_URL);
|
||||
});
|
||||
|
||||
it("shows the learning mentor navigation", () => {
|
||||
cy.visit(MENTOR_OVERVIEW_URL);
|
||||
cy.visit(MENTOR_MENTEES_URL);
|
||||
cy.get(MENTOR_MAIN_NAVIGATION).should("exist");
|
||||
});
|
||||
|
||||
it("shows the mentees navigation link", () => {
|
||||
cy.visit(MENTOR_OVERVIEW_URL);
|
||||
cy.visit(MENTOR_TASKS_URL);
|
||||
cy.get(MENTOR_MENTEES_NAVIGATION_LINK).click();
|
||||
cy.url().should("include", MENTOR_MENTEES_URL);
|
||||
})
|
||||
});
|
||||
|
||||
it("shows the overview navigation link", () => {
|
||||
cy.visit(MENTOR_OVERVIEW_URL);
|
||||
cy.visit(MENTOR_TASKS_URL);
|
||||
cy.get(MENTOR_OVERVIEW_NAVIGATION_LINK).click();
|
||||
cy.url().should("include", MENTOR_OVERVIEW_URL);
|
||||
})
|
||||
cy.url().should("include", MENTOR_TASKS_URL);
|
||||
});
|
||||
|
||||
it("shows my mentees", () => {
|
||||
cy.visit(MENTOR_MENTEES_URL);
|
||||
|
|
@ -69,10 +69,11 @@ describe("mentorOnly.cy.js", () => {
|
|||
.click();
|
||||
|
||||
// then
|
||||
const expectedMenteeProfileUrl = "/course/versicherungsvermittler-in/profile/5ff59857-8de5-415e-a387-4449f9a0337a"
|
||||
const expectedMenteeProfileUrl =
|
||||
"/course/versicherungsvermittler-in/profile/5ff59857-8de5-415e-a387-4449f9a0337a";
|
||||
cy.url().should("include", expectedMenteeProfileUrl);
|
||||
cy.contains(mentee).should("exist");
|
||||
})
|
||||
});
|
||||
|
||||
it("can remove a mentee", () => {
|
||||
// given
|
||||
|
|
@ -86,6 +87,8 @@ describe("mentorOnly.cy.js", () => {
|
|||
|
||||
// then
|
||||
cy.contains(MENTOR_MENTEE_LIST_ITEM, mentee).should("not.exist");
|
||||
cy.contains(MENTOR_MENTEE_LIST_ITEM, "Robert Student-plus-Mentor").should("exist")
|
||||
})
|
||||
cy.contains(MENTOR_MENTEE_LIST_ITEM, "Robert Student-plus-Mentor").should(
|
||||
"exist"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ from vbv_lernwelt.course.factories import CoursePageFactory
|
|||
from vbv_lernwelt.course.models import (
|
||||
Course,
|
||||
CourseCategory,
|
||||
CourseConfiguration,
|
||||
CoursePage,
|
||||
CourseSession,
|
||||
CourseSessionUser,
|
||||
|
|
@ -109,7 +110,6 @@ def create_test_course(
|
|||
|
||||
course: Course = create_test_course_with_categories()
|
||||
course.configuration.enable_learning_mentor = False
|
||||
course.configuration.save()
|
||||
|
||||
competence_certificate = create_test_competence_navi()
|
||||
|
||||
|
|
@ -133,9 +133,13 @@ def create_test_course(
|
|||
title="Edoniq Wissens- und Verständisfragen - Circle Fahrzeug (Demo)",
|
||||
competence_certificate=competence_certificate,
|
||||
)
|
||||
course.configuration.is_uk = True
|
||||
|
||||
if include_vv:
|
||||
create_vv_gewinnen_casework(course_id=COURSE_TEST_ID)
|
||||
course.configuration.is_vv = True
|
||||
|
||||
course.configuration.save()
|
||||
|
||||
create_test_learning_path(
|
||||
include_uk=include_uk, include_vv=include_vv, with_documents=with_documents
|
||||
|
|
@ -422,6 +426,10 @@ def create_test_course_with_categories(apps=None, schema_editor=None):
|
|||
course.slug = course_page.slug
|
||||
course.save()
|
||||
|
||||
config = CourseConfiguration.objects.get_or_create(course=course)[0]
|
||||
config.is_uk = True
|
||||
config.save()
|
||||
|
||||
return course
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -207,6 +207,8 @@ def create_versicherungsvermittlerin_course(
|
|||
course_id=course_id,
|
||||
title=names[language],
|
||||
)
|
||||
course.configuration.is_vv = True
|
||||
course.configuration.save()
|
||||
|
||||
# assignments create assignments parent page
|
||||
_assignment_list_page = AssignmentListPageFactory(
|
||||
|
|
@ -354,6 +356,8 @@ def create_course_uk_de(course_id=COURSE_UK, lang="de"):
|
|||
"it": "Corsi interaziendali",
|
||||
}
|
||||
course = create_course_with_categories(course_id=course_id, title=names[lang])
|
||||
course.configuration.is_uk = True
|
||||
course.configuration.save()
|
||||
|
||||
# assignments create assignments parent page
|
||||
_assignment_list_page = AssignmentListPageFactory(
|
||||
|
|
@ -387,6 +391,8 @@ def create_course_uk_de(course_id=COURSE_UK, lang="de"):
|
|||
|
||||
def create_course_uk_de_course_sessions():
|
||||
course = Course.objects.get(id=COURSE_UK)
|
||||
course.configuration.is_uk = True
|
||||
course.configuration.save()
|
||||
|
||||
cs = CourseSession.objects.create(
|
||||
course_id=COURSE_UK,
|
||||
|
|
@ -500,6 +506,8 @@ def create_course_uk_fr():
|
|||
course = create_course_with_categories(
|
||||
course_id=COURSE_UK_FR, title="Cours interentreprises"
|
||||
)
|
||||
course.configuration.is_uk = True
|
||||
course.configuration.save()
|
||||
|
||||
# assignments create assignments parent page
|
||||
_assignment_list_page = AssignmentListPageFactory(
|
||||
|
|
@ -550,6 +558,8 @@ def create_course_uk_it():
|
|||
course = create_course_with_categories(
|
||||
course_id=COURSE_UK_IT, title="Corso interaziendale"
|
||||
)
|
||||
course.configuration.is_uk = True
|
||||
course.configuration.save()
|
||||
|
||||
# assignments create assignments parent page
|
||||
_assignment_list_page = AssignmentListPageFactory(
|
||||
|
|
@ -651,6 +661,8 @@ def create_course_training_de():
|
|||
course = create_course_with_categories(
|
||||
course_id=COURSE_UK_TRAINING, title="myVBV Training"
|
||||
)
|
||||
course.configuration.is_uk = True
|
||||
course.configuration.save()
|
||||
|
||||
# assignments create assignments parent page
|
||||
_assignment_list_page = AssignmentListPageFactory(
|
||||
|
|
@ -741,6 +753,8 @@ def create_course_training_fr():
|
|||
course = create_course_with_categories(
|
||||
course_id=COURSE_UK_TRAINING_FR, title="myVBV Training (FR)"
|
||||
)
|
||||
course.configuration.is_uk = True
|
||||
course.configuration.save()
|
||||
|
||||
# assignments create assignments parent page
|
||||
_assignment_list_page = AssignmentListPageFactory(
|
||||
|
|
@ -828,6 +842,8 @@ def create_course_training_it():
|
|||
course = create_course_with_categories(
|
||||
course_id=COURSE_UK_TRAINING_IT, title="myVBV Training (IT)"
|
||||
)
|
||||
course.configuration.is_uk = True
|
||||
course.configuration.save()
|
||||
|
||||
# assignments create assignments parent page
|
||||
_assignment_list_page = AssignmentListPageFactory(
|
||||
|
|
|
|||
|
|
@ -66,6 +66,10 @@ class DashboardQuery(graphene.ObjectType):
|
|||
expert__user=user, expert__role=CourseSessionUser.Role.EXPERT
|
||||
).values_list("id", flat=True)
|
||||
)
|
||||
|
||||
if not circle_ids:
|
||||
return None
|
||||
|
||||
course_session_ids = CourseSession.objects.filter(
|
||||
course=course,
|
||||
coursesessionuser__user=user,
|
||||
|
|
@ -75,8 +79,6 @@ class DashboardQuery(graphene.ObjectType):
|
|||
|
||||
# todo: if course_session_ids and circles are empty return none or 404 or 401
|
||||
|
||||
# return None
|
||||
|
||||
return CourseStatisticsType(
|
||||
_id=course.id, # noqa
|
||||
course_id=course.id, # noqa
|
||||
|
|
|
|||
|
|
@ -247,10 +247,10 @@ def get_widgets_for_course(
|
|||
|
||||
if is_mentor:
|
||||
widgets.append(WidgetType.MENTOR_PERSON_WIDGET.value)
|
||||
if is_vv:
|
||||
widgets.append(WidgetType.MENTOR_TASKS_WIDGET.value)
|
||||
if is_uk:
|
||||
widgets.append(WidgetType.MENTOR_COMPETENCE_WIDGET.value)
|
||||
if is_vv:
|
||||
widgets.append(WidgetType.MENTOR_TASKS_WIDGET.value)
|
||||
|
||||
return widgets
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue