Add new frontend test
This commit is contained in:
parent
6dc10292a5
commit
fb9ba7d2bb
|
|
@ -15,6 +15,32 @@ const operations = isTeacher => ({
|
||||||
ModuleDetailsQuery: {
|
ModuleDetailsQuery: {
|
||||||
module,
|
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');
|
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', () => {
|
it('Applies Snapshot', () => {
|
||||||
cy.fakeLogin('nico.zickgraf', 'test');
|
cy.fakeLogin('nico.zickgraf', 'test');
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,8 @@ declare namespace Cypress {
|
||||||
|
|
||||||
selectClass(schoolClass: string): void
|
selectClass(schoolClass: string): void
|
||||||
|
|
||||||
login(username:string, password:string, visitLogin?: boolean): void
|
login(username: string, password: string, visitLogin?: boolean): void
|
||||||
fakeLogin(username:string, password:string): void
|
|
||||||
|
fakeLogin(username: string, password: string): void
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,8 @@
|
||||||
"allowJs": true,
|
"allowJs": true,
|
||||||
"checkJs": true,
|
"checkJs": true,
|
||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
|
"lib": ["es2015", "dom"],
|
||||||
|
"target": "ES5",
|
||||||
"types": [
|
"types": [
|
||||||
"cypress"
|
"cypress"
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@
|
||||||
<div slot="footer">
|
<div slot="footer">
|
||||||
<a
|
<a
|
||||||
class="button button--primary"
|
class="button button--primary"
|
||||||
|
data-cy="show-all-snapshots-button"
|
||||||
@click="toList">Alle Snapshots anzeigen</a>
|
@click="toList">Alle Snapshots anzeigen</a>
|
||||||
<a
|
<a
|
||||||
class="button"
|
class="button"
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@
|
||||||
@hide-me="showPopover = false">
|
@hide-me="showPopover = false">
|
||||||
<a
|
<a
|
||||||
class="popover-links__link snapshot-menu__link snapshot-menu__button snapshot-menu__button--primary"
|
class="popover-links__link snapshot-menu__link snapshot-menu__button snapshot-menu__button--primary"
|
||||||
|
data-cy="create-snapshot-button"
|
||||||
@click="createSnapshot">Neuen
|
@click="createSnapshot">Neuen
|
||||||
Snapshot erstellen</a>
|
Snapshot erstellen</a>
|
||||||
<router-link
|
<router-link
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
@select="selectedLink=$event"
|
@select="selectedLink=$event"
|
||||||
/>
|
/>
|
||||||
<div
|
<div
|
||||||
|
data-cy="snapshot-list"
|
||||||
class="snapshots__list">
|
class="snapshots__list">
|
||||||
<snapshot-list-item
|
<snapshot-list-item
|
||||||
:key="snapshot.id"
|
:key="snapshot.id"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue