71 lines
1.6 KiB
TypeScript
71 lines
1.6 KiB
TypeScript
import { getMinimalMe } from '../../../support/helpers';
|
|
|
|
describe('Displays Edit Room Entry Page', () => {
|
|
const MeQuery = getMinimalMe();
|
|
const roomEntry = {
|
|
id: 1,
|
|
slug: 'hello',
|
|
title: 'A Room Entry',
|
|
comments: [],
|
|
author: {
|
|
id: MeQuery.me.id,
|
|
},
|
|
};
|
|
const content = {
|
|
id: '4885f806-1096-46a3-bfb1-fcf33bdec045',
|
|
type: 'subtitle',
|
|
value: {
|
|
text: 'I like turtles!',
|
|
},
|
|
};
|
|
const operations = {
|
|
MeQuery,
|
|
RoomEntryQuery: {
|
|
roomEntry: {
|
|
room: {
|
|
slug: 'some-room',
|
|
},
|
|
comments: undefined,
|
|
...roomEntry,
|
|
contents: [content],
|
|
},
|
|
},
|
|
RoomEntriesQuery: {
|
|
room: {
|
|
roomEntries: {
|
|
edges: [
|
|
{
|
|
node: roomEntry,
|
|
},
|
|
],
|
|
},
|
|
},
|
|
},
|
|
};
|
|
|
|
beforeEach(() => {
|
|
cy.setup();
|
|
cy.mockGraphqlOps({
|
|
operations,
|
|
});
|
|
});
|
|
|
|
it('visits the page and fills out the form', () => {
|
|
cy.visit('/room/some-room');
|
|
|
|
cy.getByDataCy('room-entry').within(() => {
|
|
cy.getByDataCy('toggle-more-actions-menu').click();
|
|
cy.getByDataCy('edit-room-entry').click();
|
|
});
|
|
|
|
cy.getByDataCy('content-form-title-section').within(() => {
|
|
cy.getByDataCy('input-with-label-input').should('contain.value', roomEntry.title);
|
|
});
|
|
|
|
cy.getByDataCy('content-form-section-title').should('contain', 'Untertitel');
|
|
cy.getByDataCy('subtitle-form-input').within(() => {
|
|
cy.getByDataCy('input-with-label-input').should('contain.value', content.value.text);
|
|
});
|
|
});
|
|
});
|