Add to cypress tests, fix one error
This commit is contained in:
parent
dbe13a964c
commit
8a4f87b662
|
|
@ -84,7 +84,7 @@ const mockUpdateSnapshot = (title) => {
|
|||
};
|
||||
|
||||
// wait for the specified amount of requests in the test, so they don't spill over to the next test
|
||||
const waitNTimes = (n) => {
|
||||
const waitForNRequests = (n) => {
|
||||
for (let i = 0; i < n; i++) {
|
||||
cy.wait('@graphqlRequest');
|
||||
}
|
||||
|
|
@ -180,6 +180,7 @@ describe('Snapshot', () => {
|
|||
},
|
||||
SnapshotDetail: {
|
||||
snapshot: {
|
||||
title: 'Shared snapshot',
|
||||
chapters: [],
|
||||
module: {},
|
||||
},
|
||||
|
|
@ -203,7 +204,7 @@ describe('Snapshot', () => {
|
|||
cy.mockGraphqlOps(operations(true));
|
||||
cy.visit('module/miteinander-reden/');
|
||||
cy.getByDataCy('snapshot-menu').should('be.visible');
|
||||
waitNTimes(4);
|
||||
waitForNRequests(4);
|
||||
});
|
||||
|
||||
it('Menu is not visible for student', () => {
|
||||
|
|
@ -212,19 +213,23 @@ describe('Snapshot', () => {
|
|||
|
||||
cy.getByDataCy('module-title').should('be.visible');
|
||||
cy.getByDataCy('snapshot-menu').should('not.exist');
|
||||
waitNTimes(3);
|
||||
waitForNRequests(3);
|
||||
});
|
||||
|
||||
it('Creates Snapshot', () => {
|
||||
cy.mockGraphqlOps(operations(true));
|
||||
cy.visit('module/miteinander-reden/');
|
||||
cy.visit('module/miteinander-reden/snapshots');
|
||||
cy.getByDataCy('snapshot-list').should('exist').within(() => {
|
||||
cy.get('.snapshots__snapshot').should('have.length', 1);
|
||||
});
|
||||
cy.getByDataCy('back-link').click();
|
||||
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);
|
||||
cy.get('.snapshots__snapshot').should('have.length', 2);
|
||||
});
|
||||
waitNTimes(7);
|
||||
waitForNRequests(7);
|
||||
});
|
||||
|
||||
it('Applies Snapshot', () => {
|
||||
|
|
@ -236,7 +241,7 @@ describe('Snapshot', () => {
|
|||
|
||||
cy.getByDataCy('module-title').should('exist');
|
||||
cy.getByDataCy('snapshot-header').should('not.exist');
|
||||
waitNTimes(8);
|
||||
waitForNRequests(8);
|
||||
});
|
||||
|
||||
it('Renames Snapshot', () => {
|
||||
|
|
@ -250,7 +255,7 @@ describe('Snapshot', () => {
|
|||
cy.getByDataCy('edit-name-input').clear().type(newTitle);
|
||||
cy.getByDataCy('modal-save-button').click();
|
||||
cy.getByDataCy('snapshot-link').should('contain.text', 'New Title');
|
||||
waitNTimes(5);
|
||||
waitForNRequests(5);
|
||||
});
|
||||
|
||||
it('Deletes Snapshot', () => {
|
||||
|
|
@ -262,7 +267,7 @@ describe('Snapshot', () => {
|
|||
cy.getByDataCy('delete-snapshot-button').click();
|
||||
cy.getByDataCy('modal-save-button').click();
|
||||
cy.getByDataCy('snapshot-entry').should('have.length', 0);
|
||||
waitNTimes(6);
|
||||
waitForNRequests(6);
|
||||
});
|
||||
|
||||
it('Displays the Snapshot list correcly', () => {
|
||||
|
|
@ -277,7 +282,9 @@ describe('Snapshot', () => {
|
|||
cy.getByDataCy('snapshot-link').should('contain.text', 'Shared snapshot');
|
||||
cy.getByDataCy('delete-snapshot-button').should('not.exist');
|
||||
cy.getByDataCy('rename-snapshot-button').should('not.exist');
|
||||
waitNTimes(4);
|
||||
cy.getByDataCy('snapshot-link').click();
|
||||
cy.getByDataCy('module-title').should('contain.text', 'Shared snapshot');
|
||||
waitForNRequests(5);
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
<template>
|
||||
<router-link
|
||||
:to="to"
|
||||
data-cy="back-link"
|
||||
class="sub-navigation-item back-link"
|
||||
>
|
||||
<chevron-left class="back-link__icon sub-navigation-item__icon" />
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
<module
|
||||
:module="snapshot"
|
||||
class="snapshot__module"
|
||||
v-if="module"
|
||||
v-if="snapshot"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
|||
Loading…
Reference in New Issue