diff --git a/client/cypress/fixtures/mocks.js b/client/cypress/fixtures/mocks.js index ceaf95a5..d54c15ce 100644 --- a/client/cypress/fixtures/mocks.js +++ b/client/cypress/fixtures/mocks.js @@ -1,4 +1,25 @@ export default { UUID: () => '123-456-789', GenericStreamFieldType: () => 'GenericStreamFieldType', + DateTime: () => '2021-01-01Z10:01:23', + SnapshotNode: () => ({ + // id: ID! + // module: ModuleNode! + chapters: [], + // chapters: [SnapshotChapterNode] + // hiddenContentBlocks(offset: Int, before: String, after: String, first: Int, last: Int, slug: String, title: String): ContentBlockNodeConnection! + // created: DateTime! + // creator: String! + // shared: Boolean! + // objectiveGroups: [SnapshotObjectiveGroupNode] + // hiddenObjectives(offset: Int, before: String, after: String, first: Int, last: Int, text: String): ObjectiveNodeConnection! + title: 'MockSnapshotTitle', + metaTitle: 'MockSnapshotMetaTitle' + // heroImage: String + // changes: SnapshotChangesNode + // mine: Boolean + }), + ContentBlockNode: () => ({ + contents: [], + }), }; diff --git a/client/cypress/integration/frontend/snapshots.spec.js b/client/cypress/integration/frontend/snapshots.spec.js index ebacda10..cb0edd62 100644 --- a/client/cypress/integration/frontend/snapshots.spec.js +++ b/client/cypress/integration/frontend/snapshots.spec.js @@ -41,6 +41,17 @@ const operations = isTeacher => ({ ], }, }, + SnapshotDetail: { + snapshot: { + chapters: [], + module: {} + } + }, + ApplySnapshot: { + applySnapshot: { + success: true + } + } }, }); @@ -93,6 +104,11 @@ describe('Snapshot', () => { cy.mockGraphqlOps(operations(true)); cy.visit('module/miteinander-reden/snapshots'); - cy.get('Not Implemented'); + cy.getByDataCy('snapshot-link').click(); + cy.getByDataCy('apply-checkbox').click(); + cy.getByDataCy('apply-button').click(); + + cy.getByDataCy('module-title').should('exist'); + cy.getByDataCy('snapshot-header').should('not.exist'); }); }); diff --git a/client/src/components/modules/SnapshotHeader.vue b/client/src/components/modules/SnapshotHeader.vue index 6f108b5b..b5f2817c 100644 --- a/client/src/components/modules/SnapshotHeader.vue +++ b/client/src/components/modules/SnapshotHeader.vue @@ -1,5 +1,7 @@