import { checkNavigationLink, login, PARTICIPANT_LOGIN, visitCoursePage, } from "./helpers"; describe("preview.cy.js", () => { beforeEach(() => { cy.manageCommand("cypress_reset"); }); describe("Expert / Trainer", () => { beforeEach(() => { login("test-trainer1@example.com", "test"); }); it("should show course preview on learn", () => { visitCoursePage("learn"); cy.get('[data-cy="course-preview-bar"]').should("exist"); }); it("should show course preview on competence", () => { visitCoursePage("competence"); cy.get('[data-cy="course-preview-bar"]').should("exist"); }); it("should have correct course preview navigation", () => { visitCoursePage("learn"); checkNavigationLink("preview-learn-path-link", "learn"); checkNavigationLink("preview-competence-profile-link", "competence"); }); }); describe("Participant", () => { before(() => { login(...PARTICIPANT_LOGIN); }); it("should not show course preview on learn path", () => { visitCoursePage("learn"); cy.get('[data-cy="course-preview-bar"]').should("not.exist"); }); it("should not show course preview on competence", () => { visitCoursePage("competence"); cy.get('[data-cy="course-preview-bar"]').should("not.exist"); }); }); });