Check learning mentor term in uk and vv

This commit is contained in:
Christian Cueni 2024-04-18 08:28:40 +02:00
parent 1b378fafcc
commit bc909ae1b6
6 changed files with 95 additions and 37 deletions

View File

@ -75,10 +75,11 @@ const { myLearningMentors, inviteLearningMentor, noLearningMentors } = useMentor
<template> <template>
<div v-if="!isLoading" class="bg-gray-200"> <div v-if="!isLoading" class="bg-gray-200">
<div class="flex flex-row items-center justify-between py-6"> <div class="flex flex-row items-center justify-between py-6">
<h2 class="heading-2">{{ $t(myLearningMentors) }}</h2> <h2 data-cy="lm-my-lms-title" class="heading-2">{{ $t(myLearningMentors) }}</h2>
<div> <div>
<button <button
class="btn-secondary flex items-center" class="btn-secondary flex items-center"
data-cy="lm-invite-mentor-button"
@click="showInvitationModal = true" @click="showInvitationModal = true"
> >
<it-icon-add class="it-icon mr-2 h-6 w-6" /> <it-icon-add class="it-icon mr-2 h-6 w-6" />

View File

@ -1,7 +1,11 @@
export const MENTOR_TASKS_URL = export const MENTOR_TASKS_URL_VV =
"/course/versicherungsvermittler-in/learning-mentor/tasks"; "/course/versicherungsvermittler-in/learning-mentor/tasks";
export const MENTOR_MENTEES_URL = export const MENTOR_MENTEES_URL_VV =
"/course/versicherungsvermittler-in/learning-mentor"; "/course/versicherungsvermittler-in/learning-mentor";
export const MENTOR_MENTEES_URL_UK = "/course/test-lehrgang/learning-mentor";
export const MAIN_NAVIGATION_MENTOR_LINK =
"[data-cy=navigation-learning-mentor-link]";
export const MENTOR_DASHBOARD_LINK = "[data-cy=lm-dashboard-link]"; export const MENTOR_DASHBOARD_LINK = "[data-cy=lm-dashboard-link]";
export const MEMBER_DASHBOARD_LINK = export const MEMBER_DASHBOARD_LINK =
@ -22,3 +26,5 @@ export const MENTOR_MENTEE_PROFILE = "[data-cy=lm-my-mentee-profile]";
export const MENTEE_MENTOR_LIST_ITEM = "[data-cy=lm-my-mentor-list-item]"; export const MENTEE_MENTOR_LIST_ITEM = "[data-cy=lm-my-mentor-list-item]";
export const MENTEE_MENTOR_REMOVE = "[data-cy=lm-my-mentor-remove]"; export const MENTEE_MENTOR_REMOVE = "[data-cy=lm-my-mentor-remove]";
export const MENTEE_MENTORS_TITLE = "[data-cy=lm-my-lms-title]";
export const MENTEE_INVITE_MENTOR = "[data-cy=lm-invite-mentor-button]";

View File

@ -1,14 +1,18 @@
import { login } from "../../helpers"; import { login } from "../../helpers";
import { import {
MAIN_NAVIGATION_MENTOR_LINK,
MEMBER_DASHBOARD_LINK, MEMBER_DASHBOARD_LINK,
MENTEE_INVITE_MENTOR,
MENTEE_MENTOR_LIST_ITEM, MENTEE_MENTOR_LIST_ITEM,
MENTEE_MENTOR_REMOVE, MENTEE_MENTOR_REMOVE,
MENTEE_MENTORS_TITLE,
MENTOR_MENTEES_NAVIGATION_LINK, MENTOR_MENTEES_NAVIGATION_LINK,
MENTOR_MENTEES_URL, MENTOR_MENTEES_URL_UK,
MENTOR_MENTEES_URL_VV,
MENTOR_MY_MENTEES, MENTOR_MY_MENTEES,
MENTOR_MY_MENTORS, MENTOR_MY_MENTORS,
MENTOR_OVERVIEW_NAVIGATION_LINK, MENTOR_OVERVIEW_NAVIGATION_LINK,
MENTOR_TASKS_URL, MENTOR_TASKS_URL_VV,
} from "../constants"; } from "../constants";
describe("memberOnly.cy.js", () => { describe("memberOnly.cy.js", () => {
@ -23,22 +27,22 @@ describe("memberOnly.cy.js", () => {
}); });
it("shows NO mentees navigation link", () => { it("shows NO mentees navigation link", () => {
cy.visit(MENTOR_TASKS_URL); cy.visit(MENTOR_TASKS_URL_VV);
cy.get(MENTOR_MENTEES_NAVIGATION_LINK).should("not.exist"); cy.get(MENTOR_MENTEES_NAVIGATION_LINK).should("not.exist");
}); });
it("shows NO overview navigation link", () => { it("shows NO overview navigation link", () => {
cy.visit(MENTOR_TASKS_URL); cy.visit(MENTOR_TASKS_URL_VV);
cy.get(MENTOR_OVERVIEW_NAVIGATION_LINK).should("not.exist"); cy.get(MENTOR_OVERVIEW_NAVIGATION_LINK).should("not.exist");
}); });
it("shows NO mentees", () => { it("shows NO mentees", () => {
cy.visit(MENTOR_MENTEES_URL); cy.visit(MENTOR_MENTEES_URL_VV);
cy.get(MENTOR_MY_MENTEES).should("not.exist"); cy.get(MENTOR_MY_MENTEES).should("not.exist");
}); });
it("shows my mentors", () => { it("shows my mentors", () => {
cy.visit(MENTOR_MENTEES_URL); cy.visit(MENTOR_MENTEES_URL_VV);
cy.get(MENTOR_MY_MENTORS).should("exist"); cy.get(MENTOR_MY_MENTORS).should("exist");
}); });
@ -47,7 +51,7 @@ describe("memberOnly.cy.js", () => {
const mentor = "Micheala Weber-Mentor"; const mentor = "Micheala Weber-Mentor";
// when // when
cy.visit(MENTOR_MENTEES_URL); cy.visit(MENTOR_MENTEES_URL_VV);
cy.contains(MENTEE_MENTOR_LIST_ITEM, mentor) cy.contains(MENTEE_MENTOR_LIST_ITEM, mentor)
.find(MENTEE_MENTOR_REMOVE) .find(MENTEE_MENTOR_REMOVE)
.click(); .click();
@ -55,4 +59,36 @@ describe("memberOnly.cy.js", () => {
// then // then
cy.contains(MENTOR_MY_MENTORS, mentor).should("not.exist"); cy.contains(MENTOR_MY_MENTORS, mentor).should("not.exist");
}); });
it("uses term Lernbegleitung in VV-course", () => {
cy.visit(MENTOR_MENTEES_URL_VV);
cy.get(MAIN_NAVIGATION_MENTOR_LINK).should("contain", "Lernbegleitung");
cy.get(MENTEE_MENTORS_TITLE).should("contain", "Meine Lernbegleiter");
cy.get(MENTEE_INVITE_MENTOR).should(
"contain",
"Neue Lernbegleitung einladen"
);
});
});
describe("memberOnly.cy.js üK", () => {
beforeEach(() => {
cy.manageCommand("cypress_reset --set-only-is-uk-flag");
login("test-student1@example.com", "test");
});
it("shows my mentors", () => {
cy.visit(MENTOR_MENTEES_URL_UK);
cy.get(MENTOR_MY_MENTORS).should("exist");
});
it("uses term Praxisbildner in UK-course", () => {
cy.visit(MENTOR_MENTEES_URL_UK);
cy.get(MAIN_NAVIGATION_MENTOR_LINK).should("contain", "Praxisbildner");
cy.get(MENTEE_MENTORS_TITLE).should("contain", "Meine Praxisbildner");
cy.get(MENTEE_INVITE_MENTOR).should(
"contain",
"Neuen Praxisbildner einladen"
);
});
}); });

View File

@ -8,11 +8,11 @@ import {
MENTOR_MENTEE_PROFILE, MENTOR_MENTEE_PROFILE,
MENTOR_MENTEE_REMOVE, MENTOR_MENTEE_REMOVE,
MENTOR_MENTEES_NAVIGATION_LINK, MENTOR_MENTEES_NAVIGATION_LINK,
MENTOR_MENTEES_URL, MENTOR_MENTEES_URL_VV,
MENTOR_MY_MENTEES, MENTOR_MY_MENTEES,
MENTOR_MY_MENTORS, MENTOR_MY_MENTORS,
MENTOR_OVERVIEW_NAVIGATION_LINK, MENTOR_OVERVIEW_NAVIGATION_LINK,
MENTOR_TASKS_URL, MENTOR_TASKS_URL_VV,
} from "../constants"; } from "../constants";
describe("mentorAndMember.cy.js", () => { describe("mentorAndMember.cy.js", () => {
@ -27,34 +27,34 @@ describe("mentorAndMember.cy.js", () => {
}); });
it("shows the learning mentor navigation", () => { it("shows the learning mentor navigation", () => {
cy.visit(MENTOR_TASKS_URL); cy.visit(MENTOR_TASKS_URL_VV);
cy.get(MENTOR_MAIN_NAVIGATION).should("exist"); cy.get(MENTOR_MAIN_NAVIGATION).should("exist");
}); });
it("shows the mentees navigation link", () => { it("shows the mentees navigation link", () => {
cy.visit(MENTOR_TASKS_URL); cy.visit(MENTOR_TASKS_URL_VV);
cy.get(MENTOR_MENTEES_NAVIGATION_LINK).click(); cy.get(MENTOR_MENTEES_NAVIGATION_LINK).click();
cy.url().should("include", MENTOR_MENTEES_URL); cy.url().should("include", MENTOR_MENTEES_URL_VV);
}); });
it("shows the overview navigation link", () => { it("shows the overview navigation link", () => {
cy.visit(MENTOR_TASKS_URL); cy.visit(MENTOR_TASKS_URL_VV);
cy.get(MENTOR_OVERVIEW_NAVIGATION_LINK).click(); cy.get(MENTOR_OVERVIEW_NAVIGATION_LINK).click();
cy.url().should("include", MENTOR_TASKS_URL); cy.url().should("include", MENTOR_TASKS_URL_VV);
}); });
it("shows my mentees", () => { it("shows my mentees", () => {
cy.visit(MENTOR_MENTEES_URL); cy.visit(MENTOR_MENTEES_URL_VV);
cy.get(MENTOR_MY_MENTEES).should("exist"); cy.get(MENTOR_MY_MENTEES).should("exist");
}); });
it("shows my mentors", () => { it("shows my mentors", () => {
cy.visit(MENTOR_MENTEES_URL); cy.visit(MENTOR_MENTEES_URL_VV);
cy.get(MENTOR_MY_MENTORS).should("exist"); cy.get(MENTOR_MY_MENTORS).should("exist");
}); });
it("shows the correct mentees", () => { it("shows the correct mentees", () => {
cy.visit(MENTOR_MENTEES_URL); cy.visit(MENTOR_MENTEES_URL_VV);
cy.get(MENTOR_MY_MENTEES).should("contain", "Viktor Vollgas"); cy.get(MENTOR_MY_MENTEES).should("contain", "Viktor Vollgas");
}); });
@ -63,7 +63,7 @@ describe("mentorAndMember.cy.js", () => {
const mentee = "Viktor Vollgas"; const mentee = "Viktor Vollgas";
// when // when
cy.visit(MENTOR_MENTEES_URL); cy.visit(MENTOR_MENTEES_URL_VV);
cy.contains(MENTOR_MENTEE_LIST_ITEM, mentee) cy.contains(MENTOR_MENTEE_LIST_ITEM, mentee)
.find(MENTOR_MENTEE_PROFILE) .find(MENTOR_MENTEE_PROFILE)
.click(); .click();
@ -80,7 +80,7 @@ describe("mentorAndMember.cy.js", () => {
const mentee = "Viktor Vollgas"; const mentee = "Viktor Vollgas";
// when // when
cy.visit(MENTOR_MENTEES_URL); cy.visit(MENTOR_MENTEES_URL_VV);
cy.contains(MENTOR_MENTEE_LIST_ITEM, mentee) cy.contains(MENTOR_MENTEE_LIST_ITEM, mentee)
.find(MENTOR_MENTEE_REMOVE) .find(MENTOR_MENTEE_REMOVE)
.click(); .click();
@ -94,7 +94,7 @@ describe("mentorAndMember.cy.js", () => {
it("shows the correct mentors", () => { it("shows the correct mentors", () => {
const mentor = "Micheala Weber-Mentor"; const mentor = "Micheala Weber-Mentor";
cy.visit(MENTOR_MENTEES_URL); cy.visit(MENTOR_MENTEES_URL_VV);
cy.get(MENTOR_MY_MENTORS).should("contain", mentor); cy.get(MENTOR_MY_MENTORS).should("contain", mentor);
}); });
@ -103,7 +103,7 @@ describe("mentorAndMember.cy.js", () => {
const mentor = "Micheala Weber-Mentor"; const mentor = "Micheala Weber-Mentor";
// when // when
cy.visit(MENTOR_MENTEES_URL); cy.visit(MENTOR_MENTEES_URL_VV);
cy.contains(MENTEE_MENTOR_LIST_ITEM, mentor) cy.contains(MENTEE_MENTOR_LIST_ITEM, mentor)
.find(MENTEE_MENTOR_REMOVE) .find(MENTEE_MENTOR_REMOVE)
.click(); .click();

View File

@ -6,11 +6,11 @@ import {
MENTOR_MENTEE_PROFILE, MENTOR_MENTEE_PROFILE,
MENTOR_MENTEE_REMOVE, MENTOR_MENTEE_REMOVE,
MENTOR_MENTEES_NAVIGATION_LINK, MENTOR_MENTEES_NAVIGATION_LINK,
MENTOR_MENTEES_URL, MENTOR_MENTEES_URL_VV,
MENTOR_MY_MENTEES, MENTOR_MY_MENTEES,
MENTOR_MY_MENTORS, MENTOR_MY_MENTORS,
MENTOR_OVERVIEW_NAVIGATION_LINK, MENTOR_OVERVIEW_NAVIGATION_LINK,
MENTOR_TASKS_URL, MENTOR_TASKS_URL_VV,
} from "../constants"; } from "../constants";
describe("mentorOnly.cy.js", () => { describe("mentorOnly.cy.js", () => {
@ -22,38 +22,38 @@ describe("mentorOnly.cy.js", () => {
it("shows the correct dashboard", () => { it("shows the correct dashboard", () => {
cy.visit("/"); cy.visit("/");
cy.get(MENTOR_DASHBOARD_LINK).click(); cy.get(MENTOR_DASHBOARD_LINK).click();
cy.url().should("include", MENTOR_MENTEES_URL); cy.url().should("include", MENTOR_MENTEES_URL_VV);
}); });
it("shows the learning mentor navigation", () => { it("shows the learning mentor navigation", () => {
cy.visit(MENTOR_MENTEES_URL); cy.visit(MENTOR_MENTEES_URL_VV);
cy.get(MENTOR_MAIN_NAVIGATION).should("exist"); cy.get(MENTOR_MAIN_NAVIGATION).should("exist");
}); });
it("shows the mentees navigation link", () => { it("shows the mentees navigation link", () => {
cy.visit(MENTOR_TASKS_URL); cy.visit(MENTOR_TASKS_URL_VV);
cy.get(MENTOR_MENTEES_NAVIGATION_LINK).click(); cy.get(MENTOR_MENTEES_NAVIGATION_LINK).click();
cy.url().should("include", MENTOR_MENTEES_URL); cy.url().should("include", MENTOR_MENTEES_URL_VV);
}); });
it("shows the overview navigation link", () => { it("shows the overview navigation link", () => {
cy.visit(MENTOR_TASKS_URL); cy.visit(MENTOR_TASKS_URL_VV);
cy.get(MENTOR_OVERVIEW_NAVIGATION_LINK).click(); cy.get(MENTOR_OVERVIEW_NAVIGATION_LINK).click();
cy.url().should("include", MENTOR_TASKS_URL); cy.url().should("include", MENTOR_TASKS_URL_VV);
}); });
it("shows my mentees", () => { it("shows my mentees", () => {
cy.visit(MENTOR_MENTEES_URL); cy.visit(MENTOR_MENTEES_URL_VV);
cy.get(MENTOR_MY_MENTEES).should("exist"); cy.get(MENTOR_MY_MENTEES).should("exist");
}); });
it("shows no mentors", () => { it("shows no mentors", () => {
cy.visit(MENTOR_MENTEES_URL); cy.visit(MENTOR_MENTEES_URL_VV);
cy.get(MENTOR_MY_MENTORS).should("not.exist"); cy.get(MENTOR_MY_MENTORS).should("not.exist");
}); });
it("shows the correct mentees", () => { it("shows the correct mentees", () => {
cy.visit(MENTOR_MENTEES_URL); cy.visit(MENTOR_MENTEES_URL_VV);
cy.get(MENTOR_MY_MENTEES).should("contain", "Robert Student-plus-Mentor"); cy.get(MENTOR_MY_MENTEES).should("contain", "Robert Student-plus-Mentor");
cy.get(MENTOR_MY_MENTEES).should("contain", "Viktor Vollgas"); cy.get(MENTOR_MY_MENTEES).should("contain", "Viktor Vollgas");
}); });
@ -63,7 +63,7 @@ describe("mentorOnly.cy.js", () => {
const mentee = "Viktor Vollgas"; const mentee = "Viktor Vollgas";
// when // when
cy.visit(MENTOR_MENTEES_URL); cy.visit(MENTOR_MENTEES_URL_VV);
cy.contains(MENTOR_MENTEE_LIST_ITEM, mentee) cy.contains(MENTOR_MENTEE_LIST_ITEM, mentee)
.find(MENTOR_MENTEE_PROFILE) .find(MENTOR_MENTEE_PROFILE)
.click(); .click();
@ -80,7 +80,7 @@ describe("mentorOnly.cy.js", () => {
const mentee = "Viktor Vollgas"; const mentee = "Viktor Vollgas";
// when // when
cy.visit(MENTOR_MENTEES_URL); cy.visit(MENTOR_MENTEES_URL_VV);
cy.contains(MENTOR_MENTEE_LIST_ITEM, mentee) cy.contains(MENTOR_MENTEE_LIST_ITEM, mentee)
.find(MENTOR_MENTEE_REMOVE) .find(MENTOR_MENTEE_REMOVE)
.click(); .click();

View File

@ -98,6 +98,11 @@ from vbv_lernwelt.self_evaluation_feedback.models import (
default=False, default=False,
help="Will create a learning mentor for test user", help="Will create a learning mentor for test user",
) )
@click.option(
"--set-only-is-uk-flag/--no-set-only-is-uk-flag",
default=False,
help="Will set only the is_uk flag for the test course and enable learning mentors for the course",
)
def command( def command(
create_assignment_completion, create_assignment_completion,
create_assignment_evaluation, create_assignment_evaluation,
@ -108,6 +113,7 @@ def command(
create_attendance_days, create_attendance_days,
enable_circle_documents, enable_circle_documents,
create_learning_mentor, create_learning_mentor,
set_only_is_uk_flag,
): ):
print("cypress reset data") print("cypress reset data")
CourseCompletion.objects.all().delete() CourseCompletion.objects.all().delete()
@ -391,4 +397,13 @@ def command(
course = Course.objects.get(id=COURSE_TEST_ID) course = Course.objects.get(id=COURSE_TEST_ID)
course.configuration.enable_circle_documents = enable_circle_documents course.configuration.enable_circle_documents = enable_circle_documents
course.configuration.is_uk = True
if set_only_is_uk_flag:
course.configuration.is_vv = False
course.configuration.enable_learning_mentors = True
else:
course.configuration.is_vv = True
course.configuration.enable_learning_mentors = False
course.configuration.save() course.configuration.save()