50 lines
1023 B
JavaScript
50 lines
1023 B
JavaScript
const schema = require('../fixtures/schema.json');
|
|
const me = require('../fixtures/me.join-class.json');
|
|
|
|
describe('The Rooms Page', () => {
|
|
beforeEach(() => {
|
|
cy.server();
|
|
cy.mockGraphql({
|
|
schema: schema,
|
|
});
|
|
});
|
|
|
|
// todo: mock all the graphql queries and mutations
|
|
it('goes to the rooms page', () => {
|
|
let teacher = Object.assign({}, {
|
|
...me
|
|
},
|
|
{
|
|
me: {
|
|
permissions: ['users.can_manage_school_class_content']
|
|
}
|
|
});
|
|
|
|
cy.mockGraphqlOps({
|
|
schema: schema,
|
|
operations: {
|
|
MeQuery: teacher
|
|
}
|
|
});
|
|
|
|
cy.apolloLogin('nico.zickgraf', 'test');
|
|
cy.visit('/rooms');
|
|
|
|
cy.get('[data-cy=add-room]').should('exist');
|
|
});
|
|
|
|
it('add room should not exist for student', () => {
|
|
cy.mockGraphqlOps({
|
|
schema: schema,
|
|
operations: {
|
|
MeQuery: me
|
|
}
|
|
});
|
|
|
|
cy.apolloLogin('rahel.cueni', 'test');
|
|
cy.visit('/rooms');
|
|
|
|
cy.get('[data-cy=add-room]').should('not.exist');
|
|
});
|
|
});
|