Update solution e2e test and reactivate it

This commit is contained in:
Ramon Wenger 2019-02-14 18:54:57 +01:00
parent 29c9ceb542
commit 821473cf7a
1 changed files with 53 additions and 49 deletions

View File

@ -1,5 +1,5 @@
// todo: reenable with a script that does the mutations, or with a workaround for fetch request checking in cypress // todo: reenable with a script that does the mutations, or with a workaround for fetch request checking in cypress
// describe('Solutions', () => { describe('Solutions', () => {
// // it('does not display the solution at first, then displays them after clicking', () => { // // it('does not display the solution at first, then displays them after clicking', () => {
// // cy.viewport('macbook-15'); // // cy.viewport('macbook-15');
// // cy.login('nico.zickgraf', 'test'); // // cy.login('nico.zickgraf', 'test');
@ -7,51 +7,55 @@
// // cy.visit('/module/lohn-und-budget'); // // cy.visit('/module/lohn-und-budget');
// // }); // // });
// //
// it('toggles the solution as teacher, then the student can display it', () => { it('toggles the solution as teacher, then the student can display it', () => {
// // cy.server(); cy.server();
// cy.login('nico.zickgraf', 'test'); cy.exec("python ../server/manage.py hidesolutions");
// cy.visit('/module/lohn-und-budget'); // cy.login('nico.zickgraf', 'test');
// // cy.route('POST', '/api/graphql/').as('graphQL'); // cy.visit('/module/lohn-und-budget');
// // does not work with cypress yet, because of the fetch api cy.route('POST', '/api/graphql/').as('graphQL');
// // https://github.com/cypress-io/cypress/issues/95 // does not work with cypress yet, because of the fetch api
// cy.get('[data-cy=toggle-enable-solutions]').within(() => { // https://github.com/cypress-io/cypress/issues/95
// cy.get('input[type=checkbox]').uncheck({force: true}); // cy.get('[data-cy=toggle-enable-solutions]').within(() => {
// cy.wait(2000); // cy.get('input[type=checkbox]').uncheck({force: true});
// }); // // cy.wait(2000);
// cy.logout(); // cy.wait('@graphQL');
// // });
// cy.login('rahel.cueni', 'test'); // cy.logout();
// cy.visit('/module/lohn-und-budget');
// cy.get('[data-cy=toggle-enable-solutions]') cy.login('rahel.cueni', 'test');
// .should('not.exist'); cy.visit('/module/lohn-und-budget');
// cy.get('[data-cy=solution]').should('not.exist'); cy.get('[data-cy=toggle-enable-solutions]')
// cy.logout(); .should('not.exist');
// cy.get('[data-cy=solution]').should('not.exist');
// cy.login('nico.zickgraf', 'test'); cy.logout();
// cy.visit('/module/lohn-und-budget');
// cy.get('[data-cy=toggle-enable-solutions]').within(() => { cy.login('nico.zickgraf', 'test');
// cy.get('input[type=checkbox]').check({force: true}); cy.visit('/module/lohn-und-budget');
// cy.wait(2000); cy.get('[data-cy=toggle-enable-solutions]').click();
// // cy.wait('@graphQL'); cy.waitFor('UpdateSolutionVisibility');
// }); // cy.get('[data-cy=toggle-enable-solutions]').within(() => {
// // cy.get('input[type=checkbox]').check({force: true});
// cy.logout(); // cy.wait(2000);
//
// cy.login('rahel.cueni', 'test'); // });
// cy.visit('/module/lohn-und-budget');
// // cy.get('[data-cy=solution]').should('exist'); cy.logout();
// cy.get('[data-cy=solution]').first()
// .should('contain', 'anzeigen') cy.login('rahel.cueni', 'test');
// .should('not.contain', 'Lösungssatz') cy.visit('/module/lohn-und-budget');
// .then($solution => { // cy.get('[data-cy=solution]').should('exist');
// cy.wrap($solution).within(() => { cy.get('[data-cy=solution]').first()
// cy.get('[data-cy=show-solution]').click(); .should('contain', 'anzeigen')
// }); .should('not.contain', 'Lösungssatz')
// cy.wrap($solution) .then($solution => {
// .should('contain', 'Lösungssatz') cy.wrap($solution).within(() => {
// .should('contain', 'ausblenden'); cy.get('[data-cy=show-solution]').click();
// }); });
// cy.wrap($solution)
// .should('contain', 'Lösungssatz')
// }); .should('contain', 'ausblenden');
// }); });
});
});