From 31de68e3d0ebcaa9f81fa9a3792868626abb41f1 Mon Sep 17 00:00:00 2001 From: Christian Cueni Date: Tue, 8 Oct 2019 09:12:32 +0200 Subject: [PATCH] Use app logout --- client/cypress/integration/change-password-spec.js | 2 +- client/cypress/integration/solutions.spec.js | 2 +- client/cypress/integration/survey.spec.js | 3 ++- client/cypress/support/commands.js | 7 ++++++- client/src/components/icons/UserIcon.vue | 2 +- 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/client/cypress/integration/change-password-spec.js b/client/cypress/integration/change-password-spec.js index 0256583b..726267f4 100644 --- a/client/cypress/integration/change-password-spec.js +++ b/client/cypress/integration/change-password-spec.js @@ -7,7 +7,7 @@ describe('Change Password Page', () => { const validationOldWrongMsg = 'Die Eingabe ist falsch'; beforeEach(function () { - cy.logout(); + // cy.clearCookies(); cy.visit('/me/profile'); cy.login('rahel.cueni', 'test'); }); diff --git a/client/cypress/integration/solutions.spec.js b/client/cypress/integration/solutions.spec.js index 6e5b2b0a..273b6425 100644 --- a/client/cypress/integration/solutions.spec.js +++ b/client/cypress/integration/solutions.spec.js @@ -40,8 +40,8 @@ describe('Solutions', () => { cy.logout(); - cy.login('rahel.cueni', 'test'); cy.visit('/module/lohn-und-budget'); + cy.login('rahel.cueni', 'test'); // cy.get('[data-cy=solution]').should('exist'); cy.get('[data-cy=solution]').first() .should('contain', 'anzeigen') diff --git a/client/cypress/integration/survey.spec.js b/client/cypress/integration/survey.spec.js index 58a36529..c1bd181a 100644 --- a/client/cypress/integration/survey.spec.js +++ b/client/cypress/integration/survey.spec.js @@ -4,7 +4,8 @@ describe('Survey', () => { cy.viewport('macbook-15'); cy.startGraphQLCapture(); - cy.login('rahel.cueni', 'test'); + cy.login('rahel.cueni', 'test', true); + cy.get('body').contains('Neues Wissen erwerben'); }); it('should display and fill out the survey', () => { diff --git a/client/cypress/support/commands.js b/client/cypress/support/commands.js index 9ffdeae4..6b6335a7 100644 --- a/client/cypress/support/commands.js +++ b/client/cypress/support/commands.js @@ -39,10 +39,15 @@ Cypress.Commands.add("login", (username, password, visitLogin=false) => { cy.get('[data-cy=login-button]').click(); }); -Cypress.Commands.add("logout", () => { +Cypress.Commands.add("clearCookies", () => { cy.clearCookies(); }); +Cypress.Commands.add("logout", () => { + cy.get('[data-cy=user-icon]').click(); + cy.get('[data-cy=logout]').click(); +}); + Cypress.Commands.add('loginByCsrf', (username, password, csrftoken) => { cy.request({ method: 'POST', diff --git a/client/src/components/icons/UserIcon.vue b/client/src/components/icons/UserIcon.vue index 77f3d933..7209e65c 100644 --- a/client/src/components/icons/UserIcon.vue +++ b/client/src/components/icons/UserIcon.vue @@ -1,5 +1,5 @@