60 lines
1.3 KiB
JavaScript
60 lines
1.3 KiB
JavaScript
import minimalMe from '../../fixtures/me.minimal';
|
|
import module from '../../fixtures/module.minimal';
|
|
import mocks from '../../fixtures/mocks';
|
|
|
|
const me = isTeacher => ({
|
|
...minimalMe,
|
|
isTeacher,
|
|
});
|
|
|
|
const operations = isTeacher => ({
|
|
operations: {
|
|
MeQuery: {
|
|
me: me(isTeacher),
|
|
},
|
|
ModuleDetailsQuery: {
|
|
module,
|
|
},
|
|
},
|
|
});
|
|
|
|
describe('Snapshot', () => {
|
|
beforeEach(() => {
|
|
cy.server();
|
|
|
|
cy.task('getSchema').then(schema => {
|
|
cy.mockGraphql({
|
|
schema,
|
|
mocks,
|
|
});
|
|
});
|
|
|
|
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');
|
|
});
|
|
|
|
it('Applies Snapshot', () => {
|
|
cy.fakeLogin('nico.zickgraf', 'test');
|
|
|
|
cy.mockGraphqlOps(operations(true));
|
|
cy.visit('module/miteinander-reden/snapshots');
|
|
cy.get('Not Implemented');
|
|
});
|
|
});
|