diff --git a/client/cypress/integration/frontend/rooms/room-page.spec.js b/client/cypress/integration/frontend/rooms/room-page.spec.js index a031d976..8186cbd8 100644 --- a/client/cypress/integration/frontend/rooms/room-page.spec.js +++ b/client/cypress/integration/frontend/rooms/room-page.spec.js @@ -173,4 +173,42 @@ describe('The Room Page', () => { cy.url().should('include', 'rooms'); cy.getByDataCy('room-widget').should('have.length', 1); }); + + it('edits own room entry', () => { + const MeQuery = getMinimalMe({isTeacher: false}); + const {me} = MeQuery; + const id = atob(me.id).split(':')[1]; + const authorId = btoa(`PublicUserNode:${id}`); + const room = { + id: 'some-room', + roomEntries: { + edges: [ + { + node: { + id: '', + slug: '', + contents: [], + author: { + ...me, + id: authorId + } + } + } + ] + } + }; + const operations = { + MeQuery: MeQuery, + RoomEntriesQuery: { + room + }, + RoomEntryQuery: {} + }; + cy.mockGraphqlOps({ + operations + }); + cy.visit(`/room/${slug}`); + cy.getByDataCy('room-entry-actions').click(); + cy.getByDataCy('edit-room-entry').click(); + }); }); diff --git a/client/cypress/support/helpers.js b/client/cypress/support/helpers.js index 0e3cce59..b24bce42 100644 --- a/client/cypress/support/helpers.js +++ b/client/cypress/support/helpers.js @@ -1,6 +1,6 @@ // todo: clean up this file -export const getMinimalMe = ({readOnly = false, classReadOnly = false, isTeacher = true}) => ({ +export const getMinimalMe = ({readOnly = false, classReadOnly = false, isTeacher = true} = {}) => ({ me: { id: btoa('PrivateUserNode:1'), readOnly, diff --git a/client/src/components/rooms/RoomEntry.vue b/client/src/components/rooms/RoomEntry.vue index f84ad4e8..2263755b 100644 --- a/client/src/components/rooms/RoomEntry.vue +++ b/client/src/components/rooms/RoomEntry.vue @@ -2,9 +2,12 @@