diff --git a/client/cypress/fixtures/mocks.js b/client/cypress/fixtures/mocks.js
index f66111a1..eac0e79d 100644
--- a/client/cypress/fixtures/mocks.js
+++ b/client/cypress/fixtures/mocks.js
@@ -108,5 +108,5 @@ export default {
RoomEntryNode: () => ({
title: 'A Room Entry',
contents: [],
- }),
+ })
};
diff --git a/client/cypress/integration/frontend/portfolio/project-page.spec.js b/client/cypress/integration/frontend/portfolio/project-page.spec.js
index fefaff9e..0105f9cf 100644
--- a/client/cypress/integration/frontend/portfolio/project-page.spec.js
+++ b/client/cypress/integration/frontend/portfolio/project-page.spec.js
@@ -3,6 +3,32 @@ import {PROJECT_ENTRY_TEMPLATE} from '../../../../src/consts/strings.consts';
describe('Project Page', () => {
const created = '2021-06-01T11:49:00+00:00';
const createdLater = '2021-06-01T12:49:00+00:00';
+ let final = false;
+
+ const project = {
+ id: 'UHJvamVjdE5vZGU6MzY=',
+ title: 'Groot',
+ appearance: 'yellow',
+ description: 'I am Groot',
+ slug: 'groot',
+ objectives: 'Be Groot\nBe awesome',
+ final: false,
+ student: {
+ firstName: 'Rachel',
+ lastName: 'Green',
+ id: 'VXNlck5vZGU6NQ==',
+ avatarUrl: '',
+ },
+ entriesCount: 1,
+ entries: [
+ {
+ id: 'UHJvamVjdEVudHJ5Tm9kZTo2NQ==',
+ description: 'Aktivität:\nKill Thanos\n\n\nReflexion:\nHe sucks\n\n\nNächste Schritte:\nGo for the head',
+ documentUrl: '',
+ created,
+ },
+ ],
+ };
const operations = {
MeQuery: {
@@ -32,30 +58,7 @@ describe('Project Page', () => {
],
},
ProjectQuery: {
- project: {
- id: 'UHJvamVjdE5vZGU6MzY=',
- title: 'Groot',
- appearance: 'yellow',
- description: 'I am Groot',
- slug: 'groot',
- objectives: 'Be Groot\nBe awesome',
- final: false,
- student: {
- firstName: 'Rachel',
- lastName: 'Green',
- id: 'VXNlck5vZGU6NQ==',
- avatarUrl: '',
- },
- entriesCount: 1,
- entries: [
- {
- id: 'UHJvamVjdEVudHJ5Tm9kZTo2NQ==',
- description: 'Aktivität:\nKill Thanos\n\n\nReflexion:\nHe sucks\n\n\nNächste Schritte:\nGo for the head',
- documentUrl: '',
- created,
- },
- ],
- },
+ project,
},
AddProjectEntry: variables => ({
addProjectEntry: {
@@ -77,6 +80,16 @@ describe('Project Page', () => {
success: true,
},
},
+ UpdateProjectShareState: variables => {
+ final = !final;
+ return {
+ updateProjectSharedState: {
+ errors: null,
+ success: true,
+ shared: final,
+ },
+ };
+ },
};
beforeEach(() => {
@@ -103,6 +116,34 @@ describe('Project Page', () => {
cy.getByDataCy('edit-project').should('exist');
});
+ it('shares and unshares the project', () => {
+ const getOperationsForSharing = () => {
+ let projectForSharing = {
+ ...project,
+ final,
+ };
+ return {
+ ...operations,
+ ProjectQuery: {
+ project: projectForSharing,
+ },
+ };
+ };
+
+ cy.mockGraphqlOps({
+ operations: getOperationsForSharing,
+ });
+
+ cy.visit('/portfolio/groot');
+ const unsharedText = 'Mit Lehrperson teilen';
+ const sharedText = 'Nicht mehr teilen';
+ cy.getByDataCy('project-share-link').should('contain', unsharedText);
+ cy.getByDataCy('project-share-link').click();
+ cy.getByDataCy('project-share-link').should('contain', sharedText);
+ cy.getByDataCy('project-share-link').click();
+ cy.getByDataCy('project-share-link').should('contain', unsharedText);
+ });
+
describe('Project Entry', () => {
it('should create a new project entry', () => {
cy.visit('/portfolio');
@@ -156,4 +197,5 @@ describe('Project Page', () => {
cy.getByDataCy('project-entry-textarea').should('have.value', PROJECT_ENTRY_TEMPLATE);
});
});
-});
+})
+;
diff --git a/client/src/components/portfolio/ShareLink.vue b/client/src/components/portfolio/ShareLink.vue
index 124f1c0b..b42b9701 100644
--- a/client/src/components/portfolio/ShareLink.vue
+++ b/client/src/components/portfolio/ShareLink.vue
@@ -2,7 +2,7 @@