diff --git a/client/cypress/integration/frontend/rooms/rooms-page.spec.js b/client/cypress/integration/frontend/rooms/rooms-page.spec.js index 7ff639be..8384f79d 100644 --- a/client/cypress/integration/frontend/rooms/rooms-page.spec.js +++ b/client/cypress/integration/frontend/rooms/rooms-page.spec.js @@ -19,21 +19,25 @@ describe('The Rooms Page', () => { }, }); + const getOnboardingOperations = (isTeacher) => { + const operations = getOperations(isTeacher); + return { + ...operations, + RoomsQuery: { + rooms: { + edges: [], + }, + }, + }; + }; + beforeEach(() => { cy.setup(); }); it('shows the onboarding page', () => { - const operations = getOperations(true); cy.mockGraphqlOps({ - operations: { - ...operations, - RoomsQuery: { - rooms: { - edges: [] - } - } - }, + operations: getOnboardingOperations(true), }); cy.visit('/rooms'); @@ -44,6 +48,18 @@ describe('The Rooms Page', () => { cy.url().should('include', 'new-room'); }); + it('shows the onboarding page without button for student', () => { + cy.mockGraphqlOps({ + operations: getOnboardingOperations(false), + }); + + cy.visit('/rooms'); + cy.getByDataCy('page-title').should('contain', 'Räume'); + cy.getByDataCy('rooms-onboarding-text').should('contain', 'Hier können Sie Räume erstellen'); + cy.getByDataCy('page-footer').should('not.exist'); + cy.getByDataCy('create-room-button').should('not.exist'); + }); + it('goes to the rooms page', () => { const operations = getOperations(true); cy.mockGraphqlOps({ diff --git a/client/src/components/rooms/RoomsOnboarding.vue b/client/src/components/rooms/RoomsOnboarding.vue index 24559b72..e99603a2 100644 --- a/client/src/components/rooms/RoomsOnboarding.vue +++ b/client/src/components/rooms/RoomsOnboarding.vue @@ -10,7 +10,9 @@ Raum erstellen + data-cy="create-room-button" + v-if="isTeacher">Raum erstellen + @@ -21,11 +23,18 @@ import {NEW_ROOM_PAGE} from '@/router/room.names'; export default { + props: { + isTeacher: { + type: Boolean, + default: false, + }, + }, + data() { return { - newRoomRoute: NEW_ROOM_PAGE + newRoomRoute: NEW_ROOM_PAGE, }; - } + }, }; diff --git a/client/src/pages/rooms.vue b/client/src/pages/rooms.vue index 8654a976..acee8d7e 100644 --- a/client/src/pages/rooms.vue +++ b/client/src/pages/rooms.vue @@ -12,7 +12,9 @@ v-if="canAddRoom"/> - +