85 lines
2.0 KiB
JavaScript
85 lines
2.0 KiB
JavaScript
import {getMinimalMe} from '../../../support/helpers';
|
|
|
|
describe('The Room Page', () => {
|
|
const entryText = 'something should be here';
|
|
const entryTitle = 'some title';
|
|
const slug = 'ein-historisches-festival';
|
|
|
|
const RoomEntriesQuery = {
|
|
room: {
|
|
slug,
|
|
roomEntries: {
|
|
edges: [],
|
|
},
|
|
},
|
|
};
|
|
|
|
const operations = {
|
|
MeQuery: getMinimalMe({}),
|
|
RoomEntriesQuery,
|
|
AddRoomEntry: {
|
|
addRoomEntry: {
|
|
roomEntry: {
|
|
title: entryTitle,
|
|
contents: [
|
|
{
|
|
type: 'text_block',
|
|
value: {
|
|
text: entryText
|
|
}
|
|
}
|
|
],
|
|
author: {
|
|
firstName: 'Rachel',
|
|
lastName: 'Green',
|
|
id: 'rachels-id',
|
|
},
|
|
},
|
|
errors: [],
|
|
},
|
|
},
|
|
};
|
|
|
|
beforeEach(() => {
|
|
cy.setup();
|
|
});
|
|
|
|
it('displays new room entry with author name', () => {
|
|
cy.mockGraphqlOps({
|
|
operations,
|
|
});
|
|
cy.visit(`/room/${slug}`);
|
|
|
|
cy.get('[data-cy=add-room-entry-button]').click();
|
|
cy.get('.add-content-element:first-of-type').click();
|
|
cy.get('[data-cy=choose-text-widget]').click();
|
|
cy.get('[data-cy=modal-title-input] > .modal-input__inputfield').type(entryTitle);
|
|
|
|
cy.get('[data-cy=text-form-input]').type(entryText);
|
|
cy.get('[data-cy=modal-save-button]').click();
|
|
|
|
cy.get('.room-entry__content:first').should('contain', entryText).should('contain', 'Rachel Green');
|
|
});
|
|
|
|
it('changes visibility of a room', () => {
|
|
const MeQuery = getMinimalMe({
|
|
isTeacher: true
|
|
});
|
|
const operations = {
|
|
MeQuery,
|
|
RoomEntriesQuery
|
|
};
|
|
|
|
cy.mockGraphqlOps({
|
|
operations,
|
|
});
|
|
|
|
cy.visit(`/room/${slug}`);
|
|
cy.getByDataCy('toggle-room-actions-menu').click();
|
|
cy.getByDataCy('change-visibility').click();
|
|
cy.getByDataCy('modal-title').should('contain', 'Sichtbarkeit anpassen');
|
|
cy.getByDataCy('select-option').eq(1).click();
|
|
cy.getByDataCy('save').click();
|
|
});
|
|
});
|