diff --git a/client/cypress/e2e/frontend/rooms/edit-room-entry.cy.ts b/client/cypress/e2e/frontend/rooms/edit-room-entry.cy.ts new file mode 100644 index 00000000..d1b6ca99 --- /dev/null +++ b/client/cypress/e2e/frontend/rooms/edit-room-entry.cy.ts @@ -0,0 +1,70 @@ +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); + }); + }); +}); diff --git a/client/src/router/room.routes.ts b/client/src/router/room.routes.ts index edb1576c..bd64a84b 100644 --- a/client/src/router/room.routes.ts +++ b/client/src/router/room.routes.ts @@ -42,6 +42,7 @@ export default [ path: '/room/:slug/edit/:entrySlug', name: UPDATE_ROOM_ENTRY_PAGE, component: editRoomEntry, + props: true, meta: { matomoUrlCallback: matomoRoomWithSlugCallback }, }, {