From f4d7f5f336e830ab00dcd908cb892880b4eaa8b3 Mon Sep 17 00:00:00 2001 From: Ramon Wenger Date: Wed, 25 Mar 2020 19:38:16 +0100 Subject: [PATCH] Fix cypress test --- .../cypress/integration/school-class.spec.js | 42 ++++++++++++++++--- 1 file changed, 37 insertions(+), 5 deletions(-) diff --git a/client/cypress/integration/school-class.spec.js b/client/cypress/integration/school-class.spec.js index cbeeeee5..2577845c 100644 --- a/client/cypress/integration/school-class.spec.js +++ b/client/cypress/integration/school-class.spec.js @@ -181,14 +181,41 @@ describe('Class Management', () => { cy.get('[data-cy=old-class-item]').should('have.length', 1); }); +}); + +describe('Teacher Class Management', () => { + + beforeEach(() => { + cy.server(); + + cy.mockGraphql({ + schema: schema, + }); + + cy.viewport('macbook-15'); + cy.apolloLogin('nico.zickgraf', 'test'); + + }); it('changes class name', () => { let className = 'Gotta have class'; + let localMe = { + me: { + ...me.me, + isTeacher: true + } + }; + cy.mockGraphqlOps({ operations: { - MeQuery: me, - MySchoolClassQuery: selectedClass, + MeQuery: localMe, + MySchoolClassQuery: { + me: { + ...selectedClass.me, + isTeacher: true + } + }, UpdateSchoolClass: { updateSchoolClass: { success: true, @@ -210,13 +237,18 @@ describe('Class Management', () => { cy.get('[data-cy=school-class-name]').should('contain', className); }); - // fixme: cache misbehaves with mequery, but only for test - + // // fixme: cache misbehaves with mequery, but only for test + // // it.only('creates a new class', () => { // const name = 'Moordale'; // const id = 'U2Nob29sQ2xhc3NOb2RlOjI='; // const __typename = "SchoolClassNode"; - // let localMe = {...me}; + // let localMe = { + // me: { + // ...me.me, + // isTeacher: true + // } + // }; // // cy.mockGraphqlOps({ // operations: {