79 lines
3.2 KiB
JavaScript
79 lines
3.2 KiB
JavaScript
import {login} from "./helpers";
|
|
|
|
describe("Navigation tests", () => {
|
|
beforeEach(() => {
|
|
cy.manageCommand("cypress_reset");
|
|
});
|
|
|
|
describe("Desktop view", () => {
|
|
beforeEach(() => {
|
|
cy.viewport(1280, 720);
|
|
});
|
|
|
|
describe("Expert / Trainer", () => {
|
|
beforeEach(() => {
|
|
login("test-trainer1@example.com", "test");
|
|
});
|
|
|
|
it("should show course preview on learn", () => {
|
|
cy.visit("/course/test-lehrgang/learn/");
|
|
cy.get('[data-cy="course-preview-bar"]').should("exist");
|
|
})
|
|
|
|
it("should show course preview on competence", () => {
|
|
cy.visit("/course/test-lehrgang/competence/");
|
|
cy.get('[data-cy="course-preview-bar"]').should("exist");
|
|
|
|
});
|
|
|
|
it("should have correct course preview navigation", () => {
|
|
cy.visit("/course/test-lehrgang/learn/");
|
|
|
|
it("should have see correct navigation", () => {
|
|
cy.get('[data-cy="preview-learn-path-link"]').should('have.attr', 'href').and('eq', '/course/test-lehrgang/cockpit');
|
|
cy.get('[data-cy="preview-competence-profile-link""]').should('have.attr', 'href').and('eq', '/course/test-lehrgang/learn');
|
|
})
|
|
})
|
|
|
|
it("should have correct expert navigation", () => {
|
|
// when course session is selected -> cockpit
|
|
cy.visit("/course/test-lehrgang/cockpit");
|
|
|
|
cy.get('[data-cy="navigation-cockpit-link"]').should('have.attr', 'href').and('eq', '/course/test-lehrgang/cockpit');
|
|
cy.get('[data-cy="navigation-preview-link"]').should('have.attr', 'href').and('eq', '/course/test-lehrgang/learn');
|
|
|
|
cy.get('[data-cy="navigation-learning-path-link"]').should("not.exist")
|
|
cy.get('[data-cy="navigation-competence-profile-link"]').should("not.exist")
|
|
});
|
|
});
|
|
|
|
describe("Participant", () => {
|
|
beforeEach(() => {
|
|
login("test-student1@example.com", "test");
|
|
});
|
|
|
|
it("should not show course preview on learn path", () => {
|
|
cy.visit("/course/test-lehrgang/learn");
|
|
cy.get('[data-cy="course-preview-bar"]').should("not.exist");
|
|
});
|
|
|
|
it("should not show course preview on learn path", () => {
|
|
cy.visit("/course/test-lehrgang/comptence");
|
|
cy.get('[data-cy="course-preview-bar"]').should("not.exist");
|
|
});
|
|
|
|
it("should have see correct navigation", () => {
|
|
// when course session is selected -> learn
|
|
cy.visit("/course/test-lehrgang/learn");
|
|
|
|
cy.get('[data-cy="navigation-competence-profile-link"]').should('have.attr', 'href').and('eq', '/course/test-lehrgang/competence');
|
|
cy.get('[data-cy="navigation-learning-path-link"]').should('have.attr', 'href').and('eq', '/course/test-lehrgang/learn');
|
|
|
|
cy.get('[data-cy="navigation-cockpit-link"]').should("not.exist")
|
|
cy.get('[data-cy="navigation-preview-lin"]').should("not.exist")
|
|
});
|
|
});
|
|
});
|
|
});
|
|
|