From a463f96167b5bad7572f2e7bd01df3f0ab57af14 Mon Sep 17 00:00:00 2001 From: Ramon Wenger Date: Mon, 27 Jun 2022 17:00:29 +0200 Subject: [PATCH] Update cypress test, fix it --- .../frontend/rooms/room-page.spec.js | 65 ++++++++++++------- client/src/components/rooms/RoomActions.vue | 2 - client/src/components/ui/PopoverLink.vue | 1 - 3 files changed, 42 insertions(+), 26 deletions(-) diff --git a/client/cypress/integration/frontend/rooms/room-page.spec.js b/client/cypress/integration/frontend/rooms/room-page.spec.js index e98dd005..c3520550 100644 --- a/client/cypress/integration/frontend/rooms/room-page.spec.js +++ b/client/cypress/integration/frontend/rooms/room-page.spec.js @@ -186,20 +186,36 @@ describe('The Room Page', () => { const {me} = MeQuery; const id = atob(me.id).split(':')[1]; const authorId = btoa(`PublicUserNode:${id}`); + const entrySlug = 'entry-slug'; + const roomEntry = { + id: 'entry-id', + slug: entrySlug, + title: 'My Entry', + contents: [ + { + type: 'text_block', + value: { + text: 'some text' + } + } + ], + comments: [], + author: { + ...me, + id: authorId, + firstName: 'Hans', + lastName: 'Was Heiri', + avatarUrl: '' + }, + }; const room = { id: 'some-room', + slug, + // schoolClass: me.selectedClass, roomEntries: { edges: [ { - node: { - id: '', - slug: '', - contents: [], - author: { - ...me, - id: authorId, - }, - }, + node: roomEntry, }, ], }, @@ -209,7 +225,9 @@ describe('The Room Page', () => { RoomEntriesQuery: { room, }, - RoomEntryQuery: {}, + RoomEntryQuery: { + roomEntry + }, }; cy.mockGraphqlOps({ operations, @@ -217,6 +235,7 @@ describe('The Room Page', () => { cy.visit(`/room/${slug}`); cy.getByDataCy('room-entry-actions').click(); cy.getByDataCy('edit-room-entry').click(); + cy.location('pathname').should('include', entrySlug); }); it('creates a room entry', () => { @@ -249,39 +268,39 @@ describe('The Room Page', () => { const otherClass = { id: btoa('SchoolClassNode:34'), name: 'Other Class', - readOnly: false + readOnly: false, }; let selectedClass = me.selectedClass; const operations = { MeQuery: () => { return { - me: { - ...me, - schoolClasses: [...me.schoolClasses, otherClass], - selectedClass - }, - }; + me: { + ...me, + schoolClasses: [...me.schoolClasses, otherClass], + selectedClass, + }, + }; }, RoomEntriesQuery, UpdateSettings() { selectedClass = otherClass; return { updateSettings: { - success: true - } + success: true, + }, }; }, ModuleDetailsQuery: {}, MySchoolClassQuery: () => { return { me: { - selectedClass - } + selectedClass, + }, }; }, RoomsQuery: { - rooms: [] - } + rooms: [], + }, }; cy.mockGraphqlOps({ diff --git a/client/src/components/rooms/RoomActions.vue b/client/src/components/rooms/RoomActions.vue index b0e409c4..5ff1b960 100644 --- a/client/src/components/rooms/RoomActions.vue +++ b/client/src/components/rooms/RoomActions.vue @@ -21,7 +21,6 @@