skillbox/client/cypress/integration/frontend/rooms/rooms-page.spec.js

49 lines
1.2 KiB
JavaScript

import {getMinimalMe} from '../../../support/helpers';
describe('The Rooms Page', () => {
const getOperations = (isTeacher) => ({
MeQuery: getMinimalMe({isTeacher}),
RoomsQuery: {},
});
beforeEach(() => {
cy.setup();
});
it.only('shows the onboarding page', () => {
const operations = getOperations(true);
cy.mockGraphqlOps({
operations,
});
cy.visit('/rooms');
cy.getByDataCy('page-title').should('contain', 'Räume');
cy.getByDataCy('rooms-onboarding-text').should('contain', 'Hier können Sie Räume erstellen');
cy.getByDataCy('page-footer').should('not.exist');
cy.getByDataCy('create-room-button').should('contain', 'Raum erstellen').click();
cy.url().should('include', 'new-room');
});
it('goes to the rooms page', () => {
const operations = getOperations(true);
cy.mockGraphqlOps({
operations,
});
cy.visit('/rooms');
cy.get('[data-cy=add-room]').should('exist');
});
it('add room should not exist for student', () => {
const operations = getOperations(false);
cy.mockGraphqlOps({
operations,
});
cy.visit('/rooms');
cy.get('[data-cy=add-room]').should('not.exist');
});
});