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

62 lines
1.5 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 operations = {
MeQuery: getMinimalMe({}),
RoomEntriesQuery: {
room: {
slug,
roomEntries: {
edges: [],
},
},
},
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');
});
});