Fix cypress test
This commit is contained in:
parent
94a13f4a15
commit
1a3d9afd31
|
|
@ -1,51 +1,54 @@
|
||||||
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}) => {
|
||||||
MeQuery: {
|
const {me} = getMinimalMe({readOnly, classReadOnly, isTeacher: true});
|
||||||
me: {
|
return {
|
||||||
readOnly,
|
MeQuery: {
|
||||||
isTeacher: true,
|
me: {
|
||||||
selectedClass: {
|
...me,
|
||||||
id: SELECTED_CLASS_ID,
|
readOnly,
|
||||||
readOnly: classReadOnly,
|
selectedClass: {
|
||||||
|
id: SELECTED_CLASS_ID,
|
||||||
|
readOnly: classReadOnly,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
RoomEntriesQuery: {
|
||||||
RoomEntriesQuery: {
|
room: {
|
||||||
room: {
|
id: 'roomId',
|
||||||
id: 'roomId',
|
slug: '',
|
||||||
slug: '',
|
title: 'room title',
|
||||||
title: 'room title',
|
entryCount: 3,
|
||||||
entryCount: 3,
|
appearance: 'blue',
|
||||||
appearance: 'blue',
|
description: 'room description',
|
||||||
description: 'room description',
|
schoolClass: {
|
||||||
schoolClass: {
|
id: SELECTED_CLASS_ID,
|
||||||
id: SELECTED_CLASS_ID,
|
name: 'selected class',
|
||||||
name: 'selected class',
|
},
|
||||||
},
|
roomEntries: {
|
||||||
roomEntries: {
|
edges: [
|
||||||
edges: [
|
{
|
||||||
{
|
node: {
|
||||||
node: {
|
id: 'entryId',
|
||||||
id: 'entryId',
|
|
||||||
slug: '',
|
slug: '',
|
||||||
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});
|
||||||
|
|
|
||||||
|
|
@ -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');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue