65 lines
1.3 KiB
JavaScript
65 lines
1.3 KiB
JavaScript
import minimalMe from '../../fixtures/me.minimal';
|
|
|
|
const me = isTeacher => ({
|
|
...minimalMe,
|
|
isTeacher,
|
|
});
|
|
|
|
const module = () => ({
|
|
title: 'title',
|
|
metaTitle: 'metaTitle',
|
|
heroImage: 'heroImage',
|
|
teaser: 'teaser',
|
|
intro: 'intro',
|
|
assignments: {},
|
|
objectiveGroups: [],
|
|
id: '',
|
|
chapters: [],
|
|
});
|
|
|
|
const operations = isTeacher => ({
|
|
operations: {
|
|
MeQuery: {
|
|
me: me(isTeacher),
|
|
},
|
|
ModuleDetailsQuery: {
|
|
module: module(),
|
|
},
|
|
},
|
|
});
|
|
|
|
describe('Snapshot', () => {
|
|
beforeEach(() => {
|
|
cy.server();
|
|
|
|
cy.task('getSchema').then(schema => {
|
|
cy.mockGraphql({
|
|
schema,
|
|
mocks: {
|
|
UUID: () => '123-456-789',
|
|
GenericStreamFieldType: () => 'GenericStreamFieldType',
|
|
},
|
|
});
|
|
});
|
|
|
|
cy.viewport('macbook-15');
|
|
});
|
|
|
|
it('Menu is visible for teacher', () => {
|
|
cy.fakeLogin('nico.zickgraf', 'test');
|
|
|
|
cy.mockGraphqlOps(operations(true));
|
|
cy.visit('module/miteinander-reden/');
|
|
cy.getByDataCy('snapshot-menu').should('be.visible');
|
|
});
|
|
|
|
it('Menu is not visible for student', () => {
|
|
cy.fakeLogin('rahel.cueni', 'test');
|
|
cy.mockGraphqlOps(operations(false));
|
|
cy.visit('module/miteinander-reden/');
|
|
|
|
cy.getByDataCy('module-title').should('be.visible');
|
|
cy.getByDataCy('snapshot-menu').should('not.exist');
|
|
});
|
|
});
|