From b992b1fb53fc678b6a537d31bd524ae939be9730 Mon Sep 17 00:00:00 2001 From: mahula Date: Tue, 7 Mar 2023 09:12:06 +0100 Subject: [PATCH 01/11] refactor login query in e2e test --- e2e-tests/cypress.config.ts | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/e2e-tests/cypress.config.ts b/e2e-tests/cypress.config.ts index 9dff98a9b..c3e5685d3 100644 --- a/e2e-tests/cypress.config.ts +++ b/e2e-tests/cypress.config.ts @@ -2,7 +2,7 @@ import { defineConfig } from 'cypress' import { addCucumberPreprocessorPlugin } from '@badeball/cypress-cucumber-preprocessor' import browserify from '@badeball/cypress-cucumber-preprocessor/browserify' -let emailLink: string +let resetPasswordLink: string async function setupNodeEvents( on: Cypress.PluginEvents, @@ -18,11 +18,11 @@ async function setupNodeEvents( ) on('task', { - setEmailLink: (link: string) => { - return (emailLink = link) + setResetPasswordLink: (val) => { + return (resetPasswordLink = val) }, - getEmailLink: () => { - return emailLink + getResetPasswordLink: () => { + return resetPasswordLink }, }) @@ -56,7 +56,7 @@ export default defineConfig({ env: { backendURL: 'http://localhost:4000', mailserverURL: 'http://localhost:1080', - loginQuery: `query ($email: String!, $password: String!, $publisherId: Int) { + loginQuery: `mutation ($email: String!, $password: String!, $publisherId: Int) { login(email: $email, password: $password, publisherId: $publisherId) { email firstName @@ -69,7 +69,8 @@ export default defineConfig({ hasElopage publisherId isAdmin - creation + hideAmountGDD + hideAmountGDT __typename } }`, From 80dd8d46f8e2c6e73793cd2a54dc943ce9521315 Mon Sep 17 00:00:00 2001 From: mahula Date: Tue, 7 Mar 2023 09:49:17 +0100 Subject: [PATCH 02/11] set correct url path in e2e test --- e2e-tests/cypress/e2e/UserProfile.ChangePassword.feature | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e-tests/cypress/e2e/UserProfile.ChangePassword.feature b/e2e-tests/cypress/e2e/UserProfile.ChangePassword.feature index aa853f6ff..90e4d7644 100644 --- a/e2e-tests/cypress/e2e/UserProfile.ChangePassword.feature +++ b/e2e-tests/cypress/e2e/UserProfile.ChangePassword.feature @@ -12,7 +12,7 @@ Feature: User profile - change password Given the user is logged in as "bibi@bloxberg.de" "Aa12345_" Scenario: Change password successfully - Given the user navigates to page "/profile" + Given the user navigates to page "/settings" And the user opens the change password menu When the user fills the password form with: | Old password | Aa12345_ | From 5f1b6377445f1273a29eb36bb973b5cd06195d11 Mon Sep 17 00:00:00 2001 From: mahula Date: Tue, 7 Mar 2023 11:32:56 +0100 Subject: [PATCH 03/11] add data-test attribute to logout menu in frontend --- frontend/src/components/Menu/Sidebar.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/components/Menu/Sidebar.vue b/frontend/src/components/Menu/Sidebar.vue index c6cc4c4e0..f538f0451 100644 --- a/frontend/src/components/Menu/Sidebar.vue +++ b/frontend/src/components/Menu/Sidebar.vue @@ -48,7 +48,7 @@ {{ $t('navigation.admin_area') }} - + {{ $t('navigation.logout') }} From f7fd084db850a97bab53b9e4be00a194ffcf4b32 Mon Sep 17 00:00:00 2001 From: mahula Date: Tue, 7 Mar 2023 13:55:49 +0100 Subject: [PATCH 04/11] fix naming in unit test for frontend sidebar menu --- frontend/src/components/Menu/Sidebar.spec.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/frontend/src/components/Menu/Sidebar.spec.js b/frontend/src/components/Menu/Sidebar.spec.js index 321d73a3a..e6e4cfe2a 100644 --- a/frontend/src/components/Menu/Sidebar.spec.js +++ b/frontend/src/components/Menu/Sidebar.spec.js @@ -49,15 +49,15 @@ describe('Sidebar', () => { expect(wrapper.findAll('.nav-item').at(2).text()).toEqual('navigation.transactions') }) - it('has nav-item "gdt.gdt" in navbar', () => { + it('has nav-item "creation" in navbar', () => { expect(wrapper.findAll('.nav-item').at(3).text()).toEqual('creation') }) - it('has nav-item "creation" in navbar', () => { + it('has nav-item "GDT" in navbar', () => { expect(wrapper.findAll('.nav-item').at(4).text()).toContain('GDT') }) - it('has nav-item "Information" in navbar', () => { + it('has nav-item "navigation.info" in navbar', () => { expect(wrapper.findAll('.nav-item').at(5).text()).toContain('navigation.info') }) }) @@ -68,13 +68,13 @@ describe('Sidebar', () => { expect(wrapper.findAll('ul').at(1).findAll('.nav-item')).toHaveLength(2) }) - it('has nav-item "navigation.info" in navbar', () => { + it('has nav-item "navigation.settings" in navbar', () => { expect(wrapper.findAll('ul').at(1).findAll('.nav-item').at(0).text()).toEqual( 'navigation.settings', ) }) - it('has nav-item "navigation.settings" in navbar', () => { + it('has nav-item "navigation.logout" in navbar', () => { expect(wrapper.findAll('ul').at(1).findAll('.nav-item').at(1).text()).toEqual( 'navigation.logout', ) From bb7828db19d962bc56e6d56368c77209f0ff7334 Mon Sep 17 00:00:00 2001 From: mahula Date: Wed, 8 Mar 2023 13:34:25 +0100 Subject: [PATCH 05/11] fix elemet selection for logout e2e test --- e2e-tests/cypress/e2e/models/SideNavMenu.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e-tests/cypress/e2e/models/SideNavMenu.ts b/e2e-tests/cypress/e2e/models/SideNavMenu.ts index ccd177b66..b52f35ed4 100644 --- a/e2e-tests/cypress/e2e/models/SideNavMenu.ts +++ b/e2e-tests/cypress/e2e/models/SideNavMenu.ts @@ -11,7 +11,7 @@ export class SideNavMenu { } logout() { - cy.get(this.logoutMenu).click() + cy.get('.main-sidebar').find(this.logoutMenu).click() return this } } From 874fbe9540222ebb4917538d53b28a076ebb6c49 Mon Sep 17 00:00:00 2001 From: mahula Date: Wed, 8 Mar 2023 13:38:32 +0100 Subject: [PATCH 06/11] set cypress to runn all available e2e tests --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5eadf1e94..d239e4114 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -550,7 +550,7 @@ jobs: run: | cd e2e-tests/ yarn - yarn run cypress run --spec cypress/e2e/User.Authentication.feature,cypress/e2e/User.Authentication.ResetPassword.feature,cypress/e2e/User.Registration.feature + yarn run cypress run - name: End-to-end tests | if tests failed, upload screenshots if: ${{ failure() && steps.e2e-tests.conclusion == 'failure' }} uses: actions/upload-artifact@v3 From 0d822d4240ff8c04202baa4572a27854631abcc6 Mon Sep 17 00:00:00 2001 From: mahula Date: Wed, 8 Mar 2023 13:46:53 +0100 Subject: [PATCH 07/11] fix mistake in cypress config --- e2e-tests/cypress.config.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/e2e-tests/cypress.config.ts b/e2e-tests/cypress.config.ts index c3e5685d3..91518cae3 100644 --- a/e2e-tests/cypress.config.ts +++ b/e2e-tests/cypress.config.ts @@ -2,7 +2,7 @@ import { defineConfig } from 'cypress' import { addCucumberPreprocessorPlugin } from '@badeball/cypress-cucumber-preprocessor' import browserify from '@badeball/cypress-cucumber-preprocessor/browserify' -let resetPasswordLink: string +let emailLink: string async function setupNodeEvents( on: Cypress.PluginEvents, @@ -18,11 +18,8 @@ async function setupNodeEvents( ) on('task', { - setResetPasswordLink: (val) => { - return (resetPasswordLink = val) - }, - getResetPasswordLink: () => { - return resetPasswordLink + setEmailLink: (link: string) => { + return (emailLink = link) }, }) From d9cf0591fd3798b8d60cd28d0373cea9b0dec2db Mon Sep 17 00:00:00 2001 From: mahula Date: Wed, 8 Mar 2023 13:53:03 +0100 Subject: [PATCH 08/11] linting --- frontend/src/components/Menu/Sidebar.vue | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/Menu/Sidebar.vue b/frontend/src/components/Menu/Sidebar.vue index f538f0451..e1ccb18e8 100644 --- a/frontend/src/components/Menu/Sidebar.vue +++ b/frontend/src/components/Menu/Sidebar.vue @@ -48,7 +48,12 @@ {{ $t('navigation.admin_area') }} - + {{ $t('navigation.logout') }} From c4083bef86f69c65960fd915c5633562e6c99056 Mon Sep 17 00:00:00 2001 From: mahula Date: Wed, 8 Mar 2023 14:15:46 +0100 Subject: [PATCH 09/11] fix mistake in cypress config --- e2e-tests/cypress.config.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/e2e-tests/cypress.config.ts b/e2e-tests/cypress.config.ts index 91518cae3..7205ef9cb 100644 --- a/e2e-tests/cypress.config.ts +++ b/e2e-tests/cypress.config.ts @@ -21,6 +21,9 @@ async function setupNodeEvents( setEmailLink: (link: string) => { return (emailLink = link) }, + getEmailLink: () => { + return emailLink + }, }) on('after:run', (results) => { From 9a843f3e673d7982889deb4a0ceac7b39c27205b Mon Sep 17 00:00:00 2001 From: mahula Date: Wed, 8 Mar 2023 14:43:44 +0100 Subject: [PATCH 10/11] use different users for e2e tests --- .../e2e/User.Authentication.ResetPassword.feature | 12 ++++++------ .../cypress/e2e/UserProfile.ChangePassword.feature | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/e2e-tests/cypress/e2e/User.Authentication.ResetPassword.feature b/e2e-tests/cypress/e2e/User.Authentication.ResetPassword.feature index b0f660709..50a29d320 100644 --- a/e2e-tests/cypress/e2e/User.Authentication.ResetPassword.feature +++ b/e2e-tests/cypress/e2e/User.Authentication.ResetPassword.feature @@ -5,13 +5,13 @@ Feature: User Authentication - reset password # TODO for these pre-conditions utilize seeding or API check, if user exists in test system # Background: # Given the following "users" are in the database: - # | email | password | name | - # | bibi@bloxberg.de | Aa12345_ | Bibi Bloxberg | + # | email | password | name | + # | raeuber@hotzenplotz.de | Aa12345_ | Räuber Hotzenplotz | Scenario: Reset password from signin page successfully Given the user navigates to page "/login" And the user navigates to the forgot password page - When the user enters the e-mail address "bibi@bloxberg.de" + When the user enters the e-mail address "raeuber@hotzenplotz.de" And the user submits the e-mail form Then the user receives an e-mail containing the "password reset" link When the user opens the "password reset" link in the browser @@ -19,7 +19,7 @@ Feature: User Authentication - reset password And the user repeats the password "12345Aa_" And the user submits the password form And the user clicks the sign in button - Then the user submits the credentials "bibi@bloxberg.de" "Aa12345_" + Then the user submits the credentials "raeuber@hotzenplotz.de" "Aa12345_" And the user cannot login - But the user submits the credentials "bibi@bloxberg.de" "12345Aa_" - And the user is logged in with username "Bibi Bloxberg" + But the user submits the credentials "raeuber@hotzenplotz.de" "12345Aa_" + And the user is logged in with username "Räuber Hotzenplotz" diff --git a/e2e-tests/cypress/e2e/UserProfile.ChangePassword.feature b/e2e-tests/cypress/e2e/UserProfile.ChangePassword.feature index 90e4d7644..b7aa6960c 100644 --- a/e2e-tests/cypress/e2e/UserProfile.ChangePassword.feature +++ b/e2e-tests/cypress/e2e/UserProfile.ChangePassword.feature @@ -5,11 +5,11 @@ Feature: User profile - change password Background: # TODO for these pre-conditions utilize seeding or API check, if user exists in test system # Given the following "users" are in the database: - # | email | password | name | - # | bibi@bloxberg.de | Aa12345_ | Bibi Bloxberg | | + # | email | password | name | + # | bob@baumeister.de | Aa12345_ | Bob der Baumeister | # TODO instead of credentials use the name of an user object (see seeds in backend) - Given the user is logged in as "bibi@bloxberg.de" "Aa12345_" + Given the user is logged in as "bob@baumeister.de" "Aa12345_" Scenario: Change password successfully Given the user navigates to page "/settings" @@ -21,7 +21,7 @@ Feature: User profile - change password And the user submits the password form And the user is presented a "success" message And the user logs out - Then the user submits the credentials "bibi@bloxberg.de" "Aa12345_" + Then the user submits the credentials "bob@baumeister.de" "Aa12345_" And the user cannot login - But the user submits the credentials "bibi@bloxberg.de" "12345Aa_" - And the user is logged in with username "Bibi Bloxberg" + But the user submits the credentials "bob@baumeister.de" "12345Aa_" + And the user is logged in with username "Bob der Baumeister" From 156955df14241878d697954727e839306dc6b5be Mon Sep 17 00:00:00 2001 From: mahula Date: Wed, 8 Mar 2023 20:36:23 +0100 Subject: [PATCH 11/11] set jwt expiration in e2e backend .env to two minutes --- backend/.env.test_e2e | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/.env.test_e2e b/backend/.env.test_e2e index a5cdc4bfd..99d6c14d5 100644 --- a/backend/.env.test_e2e +++ b/backend/.env.test_e2e @@ -1,5 +1,5 @@ # Server -JWT_EXPIRES_IN=1m +JWT_EXPIRES_IN=2m # Email EMAIL=true