Update cypress test, fix it

This commit is contained in:
Ramon Wenger 2022-06-27 17:00:29 +02:00
parent a81bb0e1e8
commit a463f96167
3 changed files with 42 additions and 26 deletions

View File

@ -186,20 +186,36 @@ describe('The Room Page', () => {
const {me} = MeQuery; const {me} = MeQuery;
const id = atob(me.id).split(':')[1]; const id = atob(me.id).split(':')[1];
const authorId = btoa(`PublicUserNode:${id}`); 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 = { const room = {
id: 'some-room', id: 'some-room',
slug,
// schoolClass: me.selectedClass,
roomEntries: { roomEntries: {
edges: [ edges: [
{ {
node: { node: roomEntry,
id: '',
slug: '',
contents: [],
author: {
...me,
id: authorId,
},
},
}, },
], ],
}, },
@ -209,7 +225,9 @@ describe('The Room Page', () => {
RoomEntriesQuery: { RoomEntriesQuery: {
room, room,
}, },
RoomEntryQuery: {}, RoomEntryQuery: {
roomEntry
},
}; };
cy.mockGraphqlOps({ cy.mockGraphqlOps({
operations, operations,
@ -217,6 +235,7 @@ describe('The Room Page', () => {
cy.visit(`/room/${slug}`); cy.visit(`/room/${slug}`);
cy.getByDataCy('room-entry-actions').click(); cy.getByDataCy('room-entry-actions').click();
cy.getByDataCy('edit-room-entry').click(); cy.getByDataCy('edit-room-entry').click();
cy.location('pathname').should('include', entrySlug);
}); });
it('creates a room entry', () => { it('creates a room entry', () => {
@ -249,39 +268,39 @@ describe('The Room Page', () => {
const otherClass = { const otherClass = {
id: btoa('SchoolClassNode:34'), id: btoa('SchoolClassNode:34'),
name: 'Other Class', name: 'Other Class',
readOnly: false readOnly: false,
}; };
let selectedClass = me.selectedClass; let selectedClass = me.selectedClass;
const operations = { const operations = {
MeQuery: () => { MeQuery: () => {
return { return {
me: { me: {
...me, ...me,
schoolClasses: [...me.schoolClasses, otherClass], schoolClasses: [...me.schoolClasses, otherClass],
selectedClass selectedClass,
}, },
}; };
}, },
RoomEntriesQuery, RoomEntriesQuery,
UpdateSettings() { UpdateSettings() {
selectedClass = otherClass; selectedClass = otherClass;
return { return {
updateSettings: { updateSettings: {
success: true success: true,
} },
}; };
}, },
ModuleDetailsQuery: {}, ModuleDetailsQuery: {},
MySchoolClassQuery: () => { MySchoolClassQuery: () => {
return { return {
me: { me: {
selectedClass selectedClass,
} },
}; };
}, },
RoomsQuery: { RoomsQuery: {
rooms: [] rooms: [],
} },
}; };
cy.mockGraphqlOps({ cy.mockGraphqlOps({

View File

@ -21,7 +21,6 @@
</template> </template>
<script> <script>
import DELETE_ROOM_MUTATION from 'gql/mutations/rooms/deleteRoom.gql'; import DELETE_ROOM_MUTATION from 'gql/mutations/rooms/deleteRoom.gql';
import UPDATE_ROOM_VISIBILITY_MUTATION from 'gql/mutations/rooms/updateRoomVisibility.gql'; import UPDATE_ROOM_VISIBILITY_MUTATION from 'gql/mutations/rooms/updateRoomVisibility.gql';
@ -45,7 +44,6 @@
components: { components: {
MoreActions, MoreActions,
PopoverLink, PopoverLink,
}, },
methods: { methods: {

View File

@ -1,7 +1,6 @@
<template> <template>
<li <li
class="popover-links__link" class="popover-links__link"
@click="$emit('link-action')"
> >
<a <a
class="popover-link" class="popover-link"