vbv/cypress/e2e/learningMentor/overview/memberOnly.cy.js

95 lines
2.6 KiB
JavaScript

import { login } from "../../helpers";
import {
MAIN_NAVIGATION_MENTOR_LINK,
MEMBER_DASHBOARD_LINK,
MENTEE_INVITE_MENTOR,
MENTEE_MENTOR_LIST_ITEM,
MENTEE_MENTOR_REMOVE,
MENTEE_MENTORS_TITLE,
MENTOR_MENTEES_NAVIGATION_LINK,
MENTOR_MENTEES_URL_UK,
MENTOR_MENTEES_URL_VV,
MENTOR_MY_MENTEES,
MENTOR_MY_MENTORS,
MENTOR_OVERVIEW_NAVIGATION_LINK,
MENTOR_TASKS_URL_VV,
} from "../constants";
describe("memberOnly.cy.js", () => {
beforeEach(() => {
cy.manageCommand("cypress_reset --create-learning-mentor");
login("student-vv@eiger-versicherungen.ch", "test");
});
it("shows the correct dashboard", () => {
cy.visit("/");
cy.get(MEMBER_DASHBOARD_LINK).should("exist");
});
it("shows NO mentees navigation link", () => {
cy.visit(MENTOR_TASKS_URL_VV);
cy.get(MENTOR_MENTEES_NAVIGATION_LINK).should("not.exist");
});
it("shows NO overview navigation link", () => {
cy.visit(MENTOR_TASKS_URL_VV);
cy.get(MENTOR_OVERVIEW_NAVIGATION_LINK).should("not.exist");
});
it("shows NO mentees", () => {
cy.visit(MENTOR_MENTEES_URL_VV);
cy.get(MENTOR_MY_MENTEES).should("not.exist");
});
it("shows my mentors", () => {
cy.visit(MENTOR_MENTEES_URL_VV);
cy.get(MENTOR_MY_MENTORS).should("exist");
});
it("can remove a mentor", () => {
// given
const mentor = "Micheala Weber-Mentor";
// when
cy.visit(MENTOR_MENTEES_URL_VV);
cy.contains(MENTEE_MENTOR_LIST_ITEM, mentor)
.find(MENTEE_MENTOR_REMOVE)
.click();
// then
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 Lernbegleitung");
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"
);
});
});