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

59 lines
1.5 KiB
JavaScript

import {login} from "../../helpers";
import {
MEMBER_DASHBOARD_LINK,
MENTEE_MENTOR_LIST_ITEM,
MENTEE_MENTOR_REMOVE,
MENTOR_MENTEES_NAVIGATION_LINK,
MENTOR_MENTEES_URL,
MENTOR_MY_MENTEES,
MENTOR_MY_MENTORS,
MENTOR_OVERVIEW_NAVIGATION_LINK,
MENTOR_OVERVIEW_URL
} 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_OVERVIEW_URL);
cy.get(MENTOR_MENTEES_NAVIGATION_LINK).should("not.exist");
})
it("shows NO overview navigation link", () => {
cy.visit(MENTOR_OVERVIEW_URL);
cy.get(MENTOR_OVERVIEW_NAVIGATION_LINK).should("not.exist");
})
it("shows NO mentees", () => {
cy.visit(MENTOR_MENTEES_URL);
cy.get(MENTOR_MY_MENTEES).should("not.exist");
});
it("shows my mentors", () => {
cy.visit(MENTOR_MENTEES_URL);
cy.get(MENTOR_MY_MENTORS).should("exist");
});
it("can remove a mentor", () => {
// given
const mentor = "Micheala Weber-Mentor";
// when
cy.visit(MENTOR_MENTEES_URL);
cy.contains(MENTEE_MENTOR_LIST_ITEM, mentor)
.find(MENTEE_MENTOR_REMOVE)
.click();
// then
cy.contains(MENTOR_MY_MENTORS, mentor).should("not.exist");
})
});