Fix failing frontend test

This commit is contained in:
Ramon Wenger 2021-06-06 18:53:56 +02:00
parent 25d08f2c09
commit 000fbeaa91
4 changed files with 44 additions and 2 deletions

View File

@ -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: [],
}),
};

View File

@ -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');
});
});

View File

@ -1,5 +1,7 @@
<template>
<div class="snapshot-header">
<div
class="snapshot-header"
data-cy="snapshot-header">
<h1>Snapshot {{ id }}</h1>
<div class="snapshot-header__meta">
{{ created }} {{ snapshot.creator }}
@ -27,6 +29,7 @@
<div>
<checkbox
:checked="agreement"
data-cy="apply-checkbox"
label="Ich will die Anpassungen aus diesem Snapshot in das Modul kopieren."
@input="agreement = $event"/>
</div>
@ -37,6 +40,7 @@
:disabled="!agreement"
:class="{'button--disabled-alt': !agreement}"
class="button button--primary"
data-cy="apply-button"
@click="apply">Snapshot anwenden
</button>
<button

View File

@ -3,6 +3,7 @@
<router-link
:to="snapshotRoute"
class="snapshot-list-item__title"
data-cy="snapshot-link"
v-html="snapshot.title"/>
<span
class="snapshot-list-item__date"