From 1a3d9afd319a34c8fdf46852083ddfc78a3190e5 Mon Sep 17 00:00:00 2001 From: Ramon Wenger Date: Tue, 31 Aug 2021 18:50:35 +0200 Subject: [PATCH] Fix cypress test --- .../frontend/read-only/room.spec.js | 71 ++++++++++--------- .../frontend/rooms/room-page.spec.js | 2 +- client/src/pages/room.vue | 1 - 3 files changed, 38 insertions(+), 36 deletions(-) diff --git a/client/cypress/integration/frontend/read-only/room.spec.js b/client/cypress/integration/frontend/read-only/room.spec.js index 74c5db8e..5bc7e0af 100644 --- a/client/cypress/integration/frontend/read-only/room.spec.js +++ b/client/cypress/integration/frontend/read-only/room.spec.js @@ -1,51 +1,54 @@ -import mocks from '../../../fixtures/mocks'; +import {getMinimalMe} from '../../../support/helpers'; const SELECTED_CLASS_ID = 'selectedClassId'; -const getOperations = ({readOnly, classReadOnly}) => ({ - MeQuery: { - me: { - readOnly, - isTeacher: true, - selectedClass: { - id: SELECTED_CLASS_ID, - readOnly: classReadOnly, +const getOperations = ({readOnly, classReadOnly}) => { + const {me} = getMinimalMe({readOnly, classReadOnly, isTeacher: true}); + return { + MeQuery: { + me: { + ...me, + readOnly, + selectedClass: { + id: SELECTED_CLASS_ID, + readOnly: classReadOnly, + }, }, }, - }, - RoomEntriesQuery: { - room: { - id: 'roomId', - slug: '', - title: 'room title', - entryCount: 3, - appearance: 'blue', - description: 'room description', - schoolClass: { - id: SELECTED_CLASS_ID, - name: 'selected class', - }, - roomEntries: { - edges: [ - { - node: { - id: 'entryId', + RoomEntriesQuery: { + room: { + id: 'roomId', + slug: '', + title: 'room title', + entryCount: 3, + appearance: 'blue', + description: 'room description', + schoolClass: { + id: SELECTED_CLASS_ID, + name: 'selected class', + }, + roomEntries: { + edges: [ + { + node: { + id: 'entryId', slug: '', title: 'entry title', contents: [], author: { - id: 'authorId', + id: btoa('PublicUserNode:authorId'), firstName: 'first', lastName: 'last', - avatarUrl: '' - } + avatarUrl: '', + }, + }, }, - }, - ], + ], + }, }, }, - }, -}); + }; +}; const checkRoomReadOnly = ({editable, readOnly, classReadOnly = false}) => { const operations = getOperations({readOnly, classReadOnly}); diff --git a/client/cypress/integration/frontend/rooms/room-page.spec.js b/client/cypress/integration/frontend/rooms/room-page.spec.js index 18cd123f..aea0bc6c 100644 --- a/client/cypress/integration/frontend/rooms/room-page.spec.js +++ b/client/cypress/integration/frontend/rooms/room-page.spec.js @@ -232,7 +232,7 @@ describe('The Room Page', () => { }); cy.visit(`/room/${slug}`); - cy.getByDataCy('add-room-entry').click(); + cy.getByDataCy('add-room-entry-button').click(); cy.getByDataCy('add-room-entry-modal').should('exist'); }); }); diff --git a/client/src/pages/room.vue b/client/src/pages/room.vue index e467ee73..63c0ae75 100644 --- a/client/src/pages/room.vue +++ b/client/src/pages/room.vue @@ -30,7 +30,6 @@