Add new frontend test
This commit is contained in:
parent
6dc10292a5
commit
fb9ba7d2bb
|
|
@ -15,6 +15,32 @@ const operations = isTeacher => ({
|
|||
ModuleDetailsQuery: {
|
||||
module,
|
||||
},
|
||||
CreateSnapshot: {
|
||||
createSnapshot: {
|
||||
snapshot: {
|
||||
id: '',
|
||||
title: '',
|
||||
created: '',
|
||||
creator: '',
|
||||
},
|
||||
success: true,
|
||||
},
|
||||
},
|
||||
ModuleSnapshotsQuery: {
|
||||
module: {
|
||||
...module,
|
||||
snapshots: [
|
||||
{
|
||||
id: 'snapshot-id',
|
||||
title: 'title',
|
||||
created: '2020-01-01',
|
||||
mine: true,
|
||||
shared: false,
|
||||
creator: 'me',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
|
|
@ -49,6 +75,19 @@ describe('Snapshot', () => {
|
|||
cy.getByDataCy('snapshot-menu').should('not.exist');
|
||||
});
|
||||
|
||||
it.only('Creates Snapshot', () => {
|
||||
cy.fakeLogin('nico.zickgraf', 'test');
|
||||
|
||||
cy.mockGraphqlOps(operations(true));
|
||||
cy.visit('module/miteinander-reden/');
|
||||
cy.getByDataCy('module-snapshots-button').click();
|
||||
cy.getByDataCy('create-snapshot-button').click();
|
||||
cy.getByDataCy('show-all-snapshots-button').click();
|
||||
cy.getByDataCy('snapshot-list').should('exist').within(() => {
|
||||
cy.get('.snapshots__snapshot').should('have.length', 1);
|
||||
});
|
||||
});
|
||||
|
||||
it('Applies Snapshot', () => {
|
||||
cy.fakeLogin('nico.zickgraf', 'test');
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,8 @@ declare namespace Cypress {
|
|||
|
||||
selectClass(schoolClass: string): void
|
||||
|
||||
login(username:string, password:string, visitLogin?: boolean): void
|
||||
fakeLogin(username:string, password:string): void
|
||||
login(username: string, password: string, visitLogin?: boolean): void
|
||||
|
||||
fakeLogin(username: string, password: string): void
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@
|
|||
"allowJs": true,
|
||||
"checkJs": true,
|
||||
"resolveJsonModule": true,
|
||||
"lib": ["es2015", "dom"],
|
||||
"target": "ES5",
|
||||
"types": [
|
||||
"cypress"
|
||||
]
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@
|
|||
<div slot="footer">
|
||||
<a
|
||||
class="button button--primary"
|
||||
data-cy="show-all-snapshots-button"
|
||||
@click="toList">Alle Snapshots anzeigen</a>
|
||||
<a
|
||||
class="button"
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
@hide-me="showPopover = false">
|
||||
<a
|
||||
class="popover-links__link snapshot-menu__link snapshot-menu__button snapshot-menu__button--primary"
|
||||
data-cy="create-snapshot-button"
|
||||
@click="createSnapshot">Neuen
|
||||
Snapshot erstellen</a>
|
||||
<router-link
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
@select="selectedLink=$event"
|
||||
/>
|
||||
<div
|
||||
data-cy="snapshot-list"
|
||||
class="snapshots__list">
|
||||
<snapshot-list-item
|
||||
:key="snapshot.id"
|
||||
|
|
|
|||
Loading…
Reference in New Issue