Update frontend tests
This commit is contained in:
parent
c1ef6a2aee
commit
84d9836c41
|
|
@ -15,7 +15,7 @@ describe('The Room Page', () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const RoomEntriesQuery = {
|
const RoomEntriesQuery = {
|
||||||
room
|
room,
|
||||||
};
|
};
|
||||||
|
|
||||||
const operations = {
|
const operations = {
|
||||||
|
|
@ -29,9 +29,9 @@ describe('The Room Page', () => {
|
||||||
{
|
{
|
||||||
type: 'text_block',
|
type: 'text_block',
|
||||||
value: {
|
value: {
|
||||||
text: entryText
|
text: entryText,
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
author: {
|
author: {
|
||||||
firstName: 'Rachel',
|
firstName: 'Rachel',
|
||||||
|
|
@ -65,9 +65,24 @@ describe('The Room Page', () => {
|
||||||
cy.get('.room-entry__content:first').should('contain', entryText).should('contain', 'Rachel Green');
|
cy.get('.room-entry__content:first').should('contain', entryText).should('contain', 'Rachel Green');
|
||||||
});
|
});
|
||||||
|
|
||||||
it.only('changes visibility of a room', () => {
|
it('room actions should not exist for student', () => {
|
||||||
|
const operations = {
|
||||||
|
MeQuery: getMinimalMe({isTeacher: false}),
|
||||||
|
RoomEntriesQuery,
|
||||||
|
};
|
||||||
|
|
||||||
|
cy.mockGraphqlOps({
|
||||||
|
operations,
|
||||||
|
});
|
||||||
|
cy.visit(`/room/${slug}`);
|
||||||
|
|
||||||
|
cy.getByDataCy('room-title').should('exist');
|
||||||
|
cy.getByDataCy('room-actions').should('not.exist');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('changes visibility of a room', () => {
|
||||||
const MeQuery = getMinimalMe({
|
const MeQuery = getMinimalMe({
|
||||||
isTeacher: true
|
isTeacher: true,
|
||||||
});
|
});
|
||||||
const operations = {
|
const operations = {
|
||||||
MeQuery,
|
MeQuery,
|
||||||
|
|
@ -77,10 +92,10 @@ describe('The Room Page', () => {
|
||||||
success: true,
|
success: true,
|
||||||
room: {
|
room: {
|
||||||
...room,
|
...room,
|
||||||
restricted: true
|
restricted: true,
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
cy.mockGraphqlOps({
|
cy.mockGraphqlOps({
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@ describe('The Rooms Page', () => {
|
||||||
cy.get('[data-cy=add-room]').should('exist');
|
cy.get('[data-cy=add-room]').should('exist');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('add room should not exist for student', () => {
|
it('actions should not exist for student', () => {
|
||||||
const operations = getOperations(false);
|
const operations = getOperations(false);
|
||||||
cy.mockGraphqlOps({
|
cy.mockGraphqlOps({
|
||||||
operations,
|
operations,
|
||||||
|
|
@ -81,7 +81,7 @@ describe('The Rooms Page', () => {
|
||||||
cy.visit('/rooms');
|
cy.visit('/rooms');
|
||||||
|
|
||||||
cy.getByDataCy('room-widget').should('have.length', 1);
|
cy.getByDataCy('room-widget').should('have.length', 1);
|
||||||
cy.get('[data-cy=add-room]').should('not.exist');
|
cy.getByDataCy('toggle-room-actions-menu').should('not.exist');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('adds a room as teacher', () => {
|
it('adds a room as teacher', () => {
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,9 @@
|
||||||
v-if="canEdit"/>
|
v-if="canEdit"/>
|
||||||
</div>
|
</div>
|
||||||
<div class="room__header">
|
<div class="room__header">
|
||||||
<h1 class="room__title">{{ room.title }}</h1>
|
<h1
|
||||||
|
class="room__title"
|
||||||
|
data-cy="room-title">{{ room.title }}</h1>
|
||||||
<p class="room__intro">
|
<p class="room__intro">
|
||||||
{{ room.description }}
|
{{ room.description }}
|
||||||
</p>
|
</p>
|
||||||
|
|
@ -55,8 +57,8 @@
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
canEdit() {
|
canEdit() {
|
||||||
return !this.me.readOnly && !this.me.selectedClass.readOnly;
|
return this.me.isTeacher && !this.me.readOnly && !this.me.selectedClass.readOnly;
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
apollo: {
|
apollo: {
|
||||||
|
|
@ -64,7 +66,7 @@
|
||||||
query: ROOM_ENTRIES_QUERY,
|
query: ROOM_ENTRIES_QUERY,
|
||||||
variables() {
|
variables() {
|
||||||
return {
|
return {
|
||||||
slug: this.slug
|
slug: this.slug,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
update({room}) {
|
update({room}) {
|
||||||
|
|
@ -72,8 +74,8 @@
|
||||||
return this.$getRidOfEdges(room);
|
return this.$getRidOfEdges(room);
|
||||||
},
|
},
|
||||||
pollInterval: 5000,
|
pollInterval: 5000,
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue