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 SELECTED_CLASS_ID = 'selectedClassId';
const getOperations = ({readOnly, classReadOnly}) => ({ const getOperations = ({readOnly, classReadOnly}) => {
const {me} = getMinimalMe({readOnly, classReadOnly, isTeacher: true});
return {
MeQuery: { MeQuery: {
me: { me: {
...me,
readOnly, readOnly,
isTeacher: true,
selectedClass: { selectedClass: {
id: SELECTED_CLASS_ID, id: SELECTED_CLASS_ID,
readOnly: classReadOnly, readOnly: classReadOnly,
@ -34,18 +36,19 @@ const getOperations = ({readOnly, classReadOnly}) => ({
title: 'entry title', title: 'entry title',
contents: [], contents: [],
author: { author: {
id: 'authorId', id: btoa('PublicUserNode:authorId'),
firstName: 'first', firstName: 'first',
lastName: 'last', lastName: 'last',
avatarUrl: '' avatarUrl: '',
} },
}, },
}, },
], ],
}, },
}, },
}, },
}); };
};
const checkRoomReadOnly = ({editable, readOnly, classReadOnly = false}) => { const checkRoomReadOnly = ({editable, readOnly, classReadOnly = false}) => {
const operations = getOperations({readOnly, classReadOnly}); const operations = getOperations({readOnly, classReadOnly});

View File

@ -232,7 +232,7 @@ describe('The Room Page', () => {
}); });
cy.visit(`/room/${slug}`); 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'); cy.getByDataCy('add-room-entry-modal').should('exist');
}); });
}); });

View File

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