vbv/cypress/e2e/settings.cy.js

47 lines
1.5 KiB
JavaScript

import { EXPERT_COCKPIT_URL, login } from "./helpers";
describe("settings.cy.js", () => {
beforeEach(() => {
cy.manageCommand("cypress_reset");
cy.intercept("/server/graphql").as("graphql");
});
describe("with circle documents enabled", () => {
it("student can see circle documents", () => {
login("test-student1@example.com", "test");
cy.visit("/course/test-lehrgang/learn/fahrzeug");
cy.wait(["@graphql", "@graphql"]);
cy.get('[data-cy="circle-document-section"]').should("exist");
});
it("trainer can see circle documents", () => {
login("test-trainer1@example.com", "test");
cy.visit(EXPERT_COCKPIT_URL);
cy.wait(["@graphql", "@graphql"]);
cy.get('[data-cy="circle-documents"]').should("exist");
});
});
describe("with circle documents disabled", () => {
beforeEach(() => {
cy.manageCommand("cypress_reset --no-enable-circle-documents");
});
it("student cannot see circle documents", () => {
login("test-student1@example.com", "test");
cy.visit("/course/test-lehrgang/learn/fahrzeug");
cy.wait(["@graphql", "@graphql"]);
cy.get('[data-cy="circle-title"]').should("contain", "Fahrzeug");
cy.get('[data-cy="circle-document-section"]').should("not.exist");
});
it("trainer cannot see circle documents", () => {
login("test-trainer1@example.com", "test");
cy.visit(EXPERT_COCKPIT_URL);
cy.wait(["@graphql", "@graphql"]);
cy.get('[data-cy="circle-documents"]').should("not.exist");
});
});
});