Fix cypress test

This commit is contained in:
Ramon Wenger 2021-08-31 18:50:35 +02:00
parent 94a13f4a15
commit 1a3d9afd31
3 changed files with 38 additions and 36 deletions

View File

@ -1,12 +1,14 @@
import mocks from '../../../fixtures/mocks';
import {getMinimalMe} from '../../../support/helpers';
const SELECTED_CLASS_ID = 'selectedClassId';
const getOperations = ({readOnly, classReadOnly}) => ({
const getOperations = ({readOnly, classReadOnly}) => {
const {me} = getMinimalMe({readOnly, classReadOnly, isTeacher: true});
return {
MeQuery: {
me: {
...me,
readOnly,
isTeacher: true,
selectedClass: {
id: SELECTED_CLASS_ID,
readOnly: classReadOnly,
@ -34,18 +36,19 @@ const getOperations = ({readOnly, classReadOnly}) => ({
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});

View File

@ -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');
});
});

View File

@ -30,7 +30,6 @@
<div class="room__content">
<add-room-entry-button
:parent="room"
data-cy="add-room-entry"
v-if="room.id && !isReadOnly">
<!--
the v-if is there for the case where the room hasn't loaded yet, but there is already an attempt to create