Fix cypress test

This commit is contained in:
Ramon Wenger 2020-03-25 19:38:16 +01:00
parent 99856af550
commit f4d7f5f336
1 changed files with 37 additions and 5 deletions

View File

@ -181,14 +181,41 @@ describe('Class Management', () => {
cy.get('[data-cy=old-class-item]').should('have.length', 1); 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', () => { it('changes class name', () => {
let className = 'Gotta have class'; let className = 'Gotta have class';
let localMe = {
me: {
...me.me,
isTeacher: true
}
};
cy.mockGraphqlOps({ cy.mockGraphqlOps({
operations: { operations: {
MeQuery: me, MeQuery: localMe,
MySchoolClassQuery: selectedClass, MySchoolClassQuery: {
me: {
...selectedClass.me,
isTeacher: true
}
},
UpdateSchoolClass: { UpdateSchoolClass: {
updateSchoolClass: { updateSchoolClass: {
success: true, success: true,
@ -210,13 +237,18 @@ describe('Class Management', () => {
cy.get('[data-cy=school-class-name]').should('contain', className); 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', () => { // it.only('creates a new class', () => {
// const name = 'Moordale'; // const name = 'Moordale';
// const id = 'U2Nob29sQ2xhc3NOb2RlOjI='; // const id = 'U2Nob29sQ2xhc3NOb2RlOjI=';
// const __typename = "SchoolClassNode"; // const __typename = "SchoolClassNode";
// let localMe = {...me}; // let localMe = {
// me: {
// ...me.me,
// isTeacher: true
// }
// };
// //
// cy.mockGraphqlOps({ // cy.mockGraphqlOps({
// operations: { // operations: {