From 926ca9c209480cc4ea4b4f4f76c62471fdf7f415 Mon Sep 17 00:00:00 2001 From: mahula Date: Thu, 26 Jan 2023 15:23:27 +0100 Subject: [PATCH 01/62] fix cypress config --- e2e-tests/cypress/tests/cypress.config.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/e2e-tests/cypress/tests/cypress.config.ts b/e2e-tests/cypress/tests/cypress.config.ts index 9621b7a00..a9627c5ae 100644 --- a/e2e-tests/cypress/tests/cypress.config.ts +++ b/e2e-tests/cypress/tests/cypress.config.ts @@ -2,6 +2,8 @@ import { defineConfig } from "cypress"; import { addCucumberPreprocessorPlugin } from "@badeball/cypress-cucumber-preprocessor"; import browserify from "@badeball/cypress-cucumber-preprocessor/browserify"; +let resetPasswordLink: string; + async function setupNodeEvents( on: Cypress.PluginEvents, config: Cypress.PluginConfigOptions @@ -15,6 +17,15 @@ async function setupNodeEvents( }) ); + on("task", { + setResetPasswordLink: (val) => { + return (resetPasswordLink = val); + }, + getResetPasswordLink: () => { + return resetPasswordLink; + }, + }); + on("after:run", (results) => { if (results) { // results will be undefined in interactive mode @@ -30,6 +41,7 @@ export default defineConfig({ e2e: { specPattern: "**/*.feature", excludeSpecPattern: "*.js", + experimentalSessionAndOrigin: true, baseUrl: "http://localhost:3000", chromeWebSecurity: false, defaultCommandTimeout: 10000, @@ -43,6 +55,7 @@ export default defineConfig({ }, env: { backendURL: "http://localhost:4000", + mailserverURL: "http://localhost:1080", loginQuery: `query ($email: String!, $password: String!, $publisherId: Int) { login(email: $email, password: $password, publisherId: $publisherId) { email From 58513fa29905020ca71782ca5a655ce71227af14 Mon Sep 17 00:00:00 2001 From: mahula Date: Thu, 26 Jan 2023 15:27:09 +0100 Subject: [PATCH 02/62] adapt step definitions for new user story --- .../support/step_definitions/common_steps.ts | 15 +----- .../support/step_definitions/email_steps.ts | 45 ++++++++++++++++ .../user_authentication_steps.ts | 54 ++++++++++++++++++- 3 files changed, 98 insertions(+), 16 deletions(-) create mode 100644 e2e-tests/cypress/tests/cypress/support/step_definitions/email_steps.ts diff --git a/e2e-tests/cypress/tests/cypress/support/step_definitions/common_steps.ts b/e2e-tests/cypress/tests/cypress/support/step_definitions/common_steps.ts index f45358f3c..42142380b 100644 --- a/e2e-tests/cypress/tests/cypress/support/step_definitions/common_steps.ts +++ b/e2e-tests/cypress/tests/cypress/support/step_definitions/common_steps.ts @@ -1,5 +1,4 @@ import { Given, Then, When } from "@badeball/cypress-cucumber-preprocessor"; -import { LoginPage } from "../../e2e/models/LoginPage"; import { OverviewPage } from "../../e2e/models/OverviewPage"; import { SideNavMenu } from "../../e2e/models/SideNavMenu"; import { Toasts } from "../../e2e/models/Toasts"; @@ -8,7 +7,7 @@ Given("the browser navigates to page {string}", (page: string) => { cy.visit(page); }); -// login-related +// login related Given( "the user is logged in as {string} {string}", @@ -32,18 +31,6 @@ Then("the user cannot login", () => { }); }); -// - -When( - "the user submits the credentials {string} {string}", - (email: string, password: string) => { - const loginPage = new LoginPage(); - loginPage.enterEmail(email); - loginPage.enterPassword(password); - loginPage.submitLogin(); - } -); - // logout Then("the user logs out", () => { diff --git a/e2e-tests/cypress/tests/cypress/support/step_definitions/email_steps.ts b/e2e-tests/cypress/tests/cypress/support/step_definitions/email_steps.ts new file mode 100644 index 000000000..4044c3717 --- /dev/null +++ b/e2e-tests/cypress/tests/cypress/support/step_definitions/email_steps.ts @@ -0,0 +1,45 @@ +import { Then, When } from "@badeball/cypress-cucumber-preprocessor"; +import { ResetPasswordPage } from "../../e2e/models/ResetPasswordPage"; +import { UserEMailSite } from "../../e2e/models/UserEMailSite"; + +const userEMailSite = new UserEMailSite(); +const resetPasswordPage = new ResetPasswordPage(); + +Then("the user receives an e-mail containing the password reset link", () => { + cy.origin( + Cypress.env("mailserverURL"), + { args: userEMailSite }, + (userEMailSite) => { + const linkPattern = /\/reset-password\/[0-9]+\d/; + + cy.visit("/"); // navigate to user's e-maile site (on fake mail server) + cy.get(userEMailSite.emailInbox).should("be.visible"); + + cy.get(userEMailSite.emailList) + .find(".email-item") + .filter(":contains(asswor)") + .first() + .click(); + + cy.get(userEMailSite.emailMeta) + .find(userEMailSite.emailSubject) + .contains("asswor"); + + cy.get(".email-content") + .find(".plain-text") + .contains(linkPattern) + .invoke("text") + .then((text) => { + const resetPasswordLink = text.match(linkPattern)[0]; + cy.task("setResetPasswordLink", resetPasswordLink); + }); + } + ); +}); + +When("the user opens the password reset link in the browser", () => { + cy.task("getResetPasswordLink").then((passwordResetLink) => { + cy.visit(passwordResetLink); + }); + cy.get(resetPasswordPage.newPasswordRepeatBlock).should("be.visible"); +}); diff --git a/e2e-tests/cypress/tests/cypress/support/step_definitions/user_authentication_steps.ts b/e2e-tests/cypress/tests/cypress/support/step_definitions/user_authentication_steps.ts index 1e5cfe88c..67a64eba0 100644 --- a/e2e-tests/cypress/tests/cypress/support/step_definitions/user_authentication_steps.ts +++ b/e2e-tests/cypress/tests/cypress/support/step_definitions/user_authentication_steps.ts @@ -1,7 +1,57 @@ -import { When } from "@badeball/cypress-cucumber-preprocessor"; +import { When, And } from "@badeball/cypress-cucumber-preprocessor"; +import { ForgotPasswordPage } from "../../e2e/models/ForgotPasswordPage"; import { LoginPage } from "../../e2e/models/LoginPage"; +import { ResetPasswordPage } from "../../e2e/models/ResetPasswordPage"; + +const loginPage = new LoginPage(); +const forgotPasswordPage = new ForgotPasswordPage(); +const resetPasswordPage = new ResetPasswordPage(); + +// login related When("the user submits no credentials", () => { - const loginPage = new LoginPage(); loginPage.submitLogin(); }); + +When( + "the user submits the credentials {string} {string}", + (email: string, password: string) => { + loginPage.enterEmail(email); + loginPage.enterPassword(password); + loginPage.submitLogin(); + } +); + +// password reset related + +And("the user navigates to the forgot password page", () => { + loginPage.openForgotPasswordPage(); + cy.url().should("include", "/forgot-password"); +}); + +When("the user enters the e-mail address {string}", (email: string) => { + forgotPasswordPage.enterEmail(email); +}); + +And("the user submits the e-mail form", () => { + forgotPasswordPage.submitEmail(); + cy.get(forgotPasswordPage.successComponent).should("be.visible"); +}); + +And("the user enters the password {string}", (password: string) => { + resetPasswordPage.enterNewPassword(password); +}); + +And("the user repeats the password {string}", (password: string) => { + resetPasswordPage.repeatNewPassword(password); +}); + +And("the user submits the new password", () => { + resetPasswordPage.submitNewPassword(); + cy.get(resetPasswordPage.resetPasswordMessageBlock).should("be.visible"); +}); + +And("the user clicks the sign in button", () => { + resetPasswordPage.openSigninPage(); + cy.url().should("contain", "/login"); +}); From 0812beb0502171905694f2904d2ea51077cc4a93 Mon Sep 17 00:00:00 2001 From: mahula Date: Thu, 26 Jan 2023 16:59:39 +0100 Subject: [PATCH 03/62] set data-test attribute in login page for e2e testing --- e2e-tests/cypress/tests/cypress/e2e/models/LoginPage.ts | 5 +++++ frontend/src/pages/Login.vue | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/e2e-tests/cypress/tests/cypress/e2e/models/LoginPage.ts b/e2e-tests/cypress/tests/cypress/e2e/models/LoginPage.ts index 9a0df62ee..df91e8e14 100644 --- a/e2e-tests/cypress/tests/cypress/e2e/models/LoginPage.ts +++ b/e2e-tests/cypress/tests/cypress/e2e/models/LoginPage.ts @@ -4,6 +4,7 @@ export class LoginPage { // selectors emailInput = "input[type=email]"; passwordInput = "input[type=password]"; + forgotPasswordLink = '[data-test="forgot-password-link"]'; submitBtn = "[type=submit]"; emailHint = "#vee_Email"; passwordHint = "#vee_Password"; @@ -27,4 +28,8 @@ export class LoginPage { cy.get(this.submitBtn).click(); return this; } + + openForgotPasswordPage() { + cy.get(this.forgotPasswordLink).click(); + } } diff --git a/frontend/src/pages/Login.vue b/frontend/src/pages/Login.vue index bd07af3ef..f3f27f83e 100755 --- a/frontend/src/pages/Login.vue +++ b/frontend/src/pages/Login.vue @@ -24,7 +24,7 @@ - + {{ $t('settings.password.forgot_pwd') }} From 3ae58ca6a94477567a940503b0dc22a3b55a02e5 Mon Sep 17 00:00:00 2001 From: mahula Date: Mon, 30 Jan 2023 18:13:29 +0100 Subject: [PATCH 04/62] add data-test attributes to vue pages for e2e testing --- frontend/src/pages/ForgotPassword.vue | 14 ++++++++++++-- frontend/src/pages/Login.vue | 2 +- frontend/src/pages/ResetPassword.vue | 2 +- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/frontend/src/pages/ForgotPassword.vue b/frontend/src/pages/ForgotPassword.vue index 77c2ac926..70d578e10 100644 --- a/frontend/src/pages/ForgotPassword.vue +++ b/frontend/src/pages/ForgotPassword.vue @@ -24,10 +24,20 @@ + diff --git a/frontend/src/pages/Login.vue b/frontend/src/pages/Login.vue index f3f27f83e..6abb6d6b6 100755 --- a/frontend/src/pages/Login.vue +++ b/frontend/src/pages/Login.vue @@ -24,7 +24,7 @@ - + {{ $t('settings.password.forgot_pwd') }} diff --git a/frontend/src/pages/ResetPassword.vue b/frontend/src/pages/ResetPassword.vue index ec7ae6811..0d79fcf0d 100644 --- a/frontend/src/pages/ResetPassword.vue +++ b/frontend/src/pages/ResetPassword.vue @@ -5,7 +5,7 @@
- + {{ $t(displaySetup.button) }} From c23327013f14950a38df05520c451e35b1e36d1f Mon Sep 17 00:00:00 2001 From: mahula Date: Mon, 30 Jan 2023 18:17:22 +0100 Subject: [PATCH 05/62] add page object files for e2e testing "forgot password" --- .../cypress/e2e/models/ForgotPasswordPage.ts | 18 +++++++++++ .../cypress/e2e/models/ResetPasswordPage.ts | 32 +++++++++++++++++++ .../tests/cypress/e2e/models/UserEMailSite.ts | 17 ++++++++++ 3 files changed, 67 insertions(+) create mode 100644 e2e-tests/cypress/tests/cypress/e2e/models/ForgotPasswordPage.ts create mode 100644 e2e-tests/cypress/tests/cypress/e2e/models/ResetPasswordPage.ts create mode 100644 e2e-tests/cypress/tests/cypress/e2e/models/UserEMailSite.ts diff --git a/e2e-tests/cypress/tests/cypress/e2e/models/ForgotPasswordPage.ts b/e2e-tests/cypress/tests/cypress/e2e/models/ForgotPasswordPage.ts new file mode 100644 index 000000000..295bb1fda --- /dev/null +++ b/e2e-tests/cypress/tests/cypress/e2e/models/ForgotPasswordPage.ts @@ -0,0 +1,18 @@ +/// + +export class ForgotPasswordPage { + // selectors + emailInput = "input[type=email]"; + submitBtn = "button[type=submit]"; + successComponent = "[data-test='forgot-password-success']"; + + enterEmail(email: string) { + cy.get(this.emailInput).clear().type(email); + return this; + } + + submitEmail() { + cy.get(this.submitBtn).click(); + return this; + } +} diff --git a/e2e-tests/cypress/tests/cypress/e2e/models/ResetPasswordPage.ts b/e2e-tests/cypress/tests/cypress/e2e/models/ResetPasswordPage.ts new file mode 100644 index 000000000..4f01d73b0 --- /dev/null +++ b/e2e-tests/cypress/tests/cypress/e2e/models/ResetPasswordPage.ts @@ -0,0 +1,32 @@ +/// + +export class ResetPasswordPage { + // selectors + newPasswordBlock = "#new-password-input-field"; + newPasswordRepeatBlock = "#repeat-new-password-input-field"; + resetPasswordBtn = "button[type=submit]"; + resetPasswordMessageBlock = '[data-test="reset-password-message"]'; + signinBtn = ".btn.test-message-button"; + + enterNewPassword(password: string) { + cy.get(this.newPasswordBlock).find("input[type=password]").type(password); + return this; + } + + repeatNewPassword(password: string) { + cy.get(this.newPasswordRepeatBlock) + .find("input[type=password]") + .type(password); + return this; + } + + submitNewPassword() { + cy.get(this.resetPasswordBtn).click(); + return this; + } + + openSigninPage() { + cy.get(this.signinBtn).click(); + return this; + } +} diff --git a/e2e-tests/cypress/tests/cypress/e2e/models/UserEMailSite.ts b/e2e-tests/cypress/tests/cypress/e2e/models/UserEMailSite.ts new file mode 100644 index 000000000..02207827d --- /dev/null +++ b/e2e-tests/cypress/tests/cypress/e2e/models/UserEMailSite.ts @@ -0,0 +1,17 @@ +/// + +export class UserEMailSite { + // selectors + emailInbox = ".sidebar-emails-container"; + emailList = ".email-list"; + emailMeta = ".email-meta"; + emailSubject = ".subject"; + + openRecentPasswordResetEMail() { + cy.get(this.emailList) + .find("email-item") + .filter(":contains(asswor)") + .click(); + expect(cy.get(this.emailSubject)).to("contain", "asswor"); + } +} From 2cf1dcbe83cb6efdfe3344dc6bd7660fea04f363 Mon Sep 17 00:00:00 2001 From: mahula Date: Mon, 30 Jan 2023 18:18:36 +0100 Subject: [PATCH 06/62] add feature file for e2e testing "forgot password" --- .../User.Authentication.ResetPassword.feature | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 e2e-tests/cypress/tests/cypress/e2e/User.Authentication.ResetPassword.feature diff --git a/e2e-tests/cypress/tests/cypress/e2e/User.Authentication.ResetPassword.feature b/e2e-tests/cypress/tests/cypress/e2e/User.Authentication.ResetPassword.feature new file mode 100644 index 000000000..7722e636e --- /dev/null +++ b/e2e-tests/cypress/tests/cypress/e2e/User.Authentication.ResetPassword.feature @@ -0,0 +1,25 @@ +Feature: User Authentication - reset password + As a user + I want the option to reset my password from the sign in page + + # 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 | + + Scenario: Reset password from signin page successfully + Given the browser navigates to page "/login" + And the user navigates to the forgot password page + When the user enters the e-mail address "bibi@bloxberg.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 + And the user enters the password "12345Aa_" + 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_" + 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" From 2d82043ffd14c3563ddd81d253adac843b0f1010 Mon Sep 17 00:00:00 2001 From: mahula Date: Mon, 30 Jan 2023 22:20:45 +0100 Subject: [PATCH 07/62] add env variables for backend to e2e workflow job --- .github/workflows/test.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index da8521a76..ce523a26c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,6 +1,9 @@ name: gradido test CI -on: push +on: + push: + branches: + - 2352-feat-user-story-user-authentication-reset-password jobs: ############################################################################## @@ -621,7 +624,7 @@ jobs: run: docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps database - name: Boot up test system | docker-compose backend - run: docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps backend + run: docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps -e EMAIL='true' -e -e EMAIL_TEST_MODUS='false' -e EMAIL_TLS='false' -e EMAIL_CODE_REQUEST_TIME=1 backend - name: Sleep for 10 seconds run: sleep 10s From 7604522810f29ffb384613886ab6123bb138f978 Mon Sep 17 00:00:00 2001 From: mahula Date: Mon, 30 Jan 2023 23:00:25 +0100 Subject: [PATCH 08/62] add env variables for backend to e2e workflow job --- .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 ce523a26c..785fdbcc7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -624,7 +624,7 @@ jobs: run: docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps database - name: Boot up test system | docker-compose backend - run: docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps -e EMAIL='true' -e -e EMAIL_TEST_MODUS='false' -e EMAIL_TLS='false' -e EMAIL_CODE_REQUEST_TIME=1 backend + run: EMAIL=true EMAIL_TEST_MODUS=false EMAIL_TLS=false EMAIL_CODE_REQUEST_TIME=1 docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps backend - name: Sleep for 10 seconds run: sleep 10s From b862de07245de39650f6a26db53106429723b2a0 Mon Sep 17 00:00:00 2001 From: mahula Date: Tue, 31 Jan 2023 11:09:23 +0100 Subject: [PATCH 09/62] Revert "add env variables for backend to e2e workflow job" This reverts commit 7604522810f29ffb384613886ab6123bb138f978. --- .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 785fdbcc7..ce523a26c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -624,7 +624,7 @@ jobs: run: docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps database - name: Boot up test system | docker-compose backend - run: EMAIL=true EMAIL_TEST_MODUS=false EMAIL_TLS=false EMAIL_CODE_REQUEST_TIME=1 docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps backend + run: docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps -e EMAIL='true' -e -e EMAIL_TEST_MODUS='false' -e EMAIL_TLS='false' -e EMAIL_CODE_REQUEST_TIME=1 backend - name: Sleep for 10 seconds run: sleep 10s From 31ae98bcbad193debcfccf0b1d4bc7d3444031b1 Mon Sep 17 00:00:00 2001 From: mahula Date: Tue, 31 Jan 2023 11:11:02 +0100 Subject: [PATCH 10/62] linting --- frontend/src/pages/ResetPassword.vue | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/frontend/src/pages/ResetPassword.vue b/frontend/src/pages/ResetPassword.vue index 0d79fcf0d..5c791ac61 100644 --- a/frontend/src/pages/ResetPassword.vue +++ b/frontend/src/pages/ResetPassword.vue @@ -5,7 +5,12 @@
- + {{ $t(displaySetup.button) }} From 4747c832090019b2a6db95ee85d44aa70851ad34 Mon Sep 17 00:00:00 2001 From: mahula Date: Tue, 31 Jan 2023 13:35:59 +0100 Subject: [PATCH 11/62] add dot-env file for testing with emails to backend --- backend/.env.test_email | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 backend/.env.test_email diff --git a/backend/.env.test_email b/backend/.env.test_email new file mode 100644 index 000000000..fba34833a --- /dev/null +++ b/backend/.env.test_email @@ -0,0 +1,5 @@ +EMAIL=true +EMAIL_TEST_MODUS=false +EMAIL_TLS=false +# for testing password reset +EMAIL_CODE_REQUEST_TIME=1 From ac2d44e2e6201947a66a3b229838096c544d8e4b Mon Sep 17 00:00:00 2001 From: mahula Date: Tue, 31 Jan 2023 14:08:40 +0100 Subject: [PATCH 12/62] add to github workflow: - using .env file to set email related values when starting backend container - add fake email server to end-to-end testing job --- .github/workflows/test.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ce523a26c..700949322 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -624,10 +624,13 @@ jobs: run: docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps database - name: Boot up test system | docker-compose backend - run: docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps -e EMAIL='true' -e -e EMAIL_TEST_MODUS='false' -e EMAIL_TLS='false' -e EMAIL_CODE_REQUEST_TIME=1 backend + run: | + docker run -it --rm gradido/backend:test /bin/sh + cp .env.test_email .env && exit + docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps backend - - name: Sleep for 10 seconds - run: sleep 10s + - name: Boot up test system | docker-compose mailserver + run: docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps mailserver - name: Boot up test system | seed backend run: | From 67717811cbbbe94cb803428a6040a9bb799b3470 Mon Sep 17 00:00:00 2001 From: mahula Date: Tue, 31 Jan 2023 14:08:40 +0100 Subject: [PATCH 13/62] add to github workflow: - using .env file to set email related values when starting backend container - add fake email server to end-to-end testing job --- .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 700949322..2c30864d4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -625,7 +625,7 @@ jobs: - name: Boot up test system | docker-compose backend run: | - docker run -it --rm gradido/backend:test /bin/sh + docker run -i --rm gradido/backend:test /bin/sh cp .env.test_email .env && exit docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps backend From 15b5e83edbd8d3fe8b1d771472d5fb61f27912a4 Mon Sep 17 00:00:00 2001 From: mahula Date: Tue, 31 Jan 2023 14:08:40 +0100 Subject: [PATCH 14/62] add to github workflow: - using .env file to set email related values when starting backend container - add fake email server to end-to-end testing job --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2c30864d4..5a1f64187 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -626,6 +626,7 @@ jobs: - name: Boot up test system | docker-compose backend run: | docker run -i --rm gradido/backend:test /bin/sh + ls -la cp .env.test_email .env && exit docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps backend From be70f9127fbc491304b34a39e44c33fee7a43119 Mon Sep 17 00:00:00 2001 From: mahula Date: Tue, 31 Jan 2023 14:08:40 +0100 Subject: [PATCH 15/62] add to github workflow: - using .env file to set email related values when starting backend container - add fake email server to end-to-end testing job --- .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 5a1f64187..85da091e1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -626,7 +626,7 @@ jobs: - name: Boot up test system | docker-compose backend run: | docker run -i --rm gradido/backend:test /bin/sh - ls -la + cd backend cp .env.test_email .env && exit docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps backend From 34cf9548f7a3ce46ce2421fc2d224a5b12f29637 Mon Sep 17 00:00:00 2001 From: mahula Date: Tue, 31 Jan 2023 15:56:58 +0100 Subject: [PATCH 16/62] let e2e tests run in parallel jobs --- .github/workflows/test.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 85da091e1..7957601c1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -562,6 +562,12 @@ jobs: name: End-to-End Tests runs-on: ubuntu-latest needs: [build_test_mariadb, build_test_database_up, build_test_backend, build_test_admin, build_test_frontend, build_test_nginx] + env: + jobs: 2 + strategy: + matrix: + # run copies of the current job in parallel + job: [1, 2] steps: ########################################################################## # CHECKOUT CODE ########################################################## @@ -656,7 +662,7 @@ jobs: run: | cd e2e-tests/cypress/tests/ yarn - yarn run cypress run --spec cypress/e2e/User.Authentication.feature + yarn run cypress run --spec cypress/e2e/User.Authentication.feature,User.Authentication.ResetPassword.feature - name: End-to-end tests | if tests failed, upload screenshots if: steps.e2e-tests.outcome == 'failure' uses: actions/upload-artifact@v3 From e87401ef4561d57cd898ce788c5aacf17b5ae225 Mon Sep 17 00:00:00 2001 From: mahula Date: Tue, 31 Jan 2023 16:21:16 +0100 Subject: [PATCH 17/62] fix screenshot upload after failing 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 7957601c1..78271a6f3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -664,7 +664,7 @@ jobs: yarn yarn run cypress run --spec cypress/e2e/User.Authentication.feature,User.Authentication.ResetPassword.feature - name: End-to-end tests | if tests failed, upload screenshots - if: steps.e2e-tests.outcome == 'failure' + if: ${{ failure() && steps.e2e-tests.conclusion == 'failure' }} uses: actions/upload-artifact@v3 with: name: cypress-screenshots From b6646d1980f26fb4fbc8414d6b92b902eda1b9fc Mon Sep 17 00:00:00 2001 From: mahula Date: Tue, 31 Jan 2023 17:01:58 +0100 Subject: [PATCH 18/62] run e2e tests serial for now --- .github/workflows/test.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 78271a6f3..021aacc9b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -562,12 +562,6 @@ jobs: name: End-to-End Tests runs-on: ubuntu-latest needs: [build_test_mariadb, build_test_database_up, build_test_backend, build_test_admin, build_test_frontend, build_test_nginx] - env: - jobs: 2 - strategy: - matrix: - # run copies of the current job in parallel - job: [1, 2] steps: ########################################################################## # CHECKOUT CODE ########################################################## From 89bff2efbf3bbce153d48099ed858f8b717bd290 Mon Sep 17 00:00:00 2001 From: mahula Date: Tue, 31 Jan 2023 17:16:13 +0100 Subject: [PATCH 19/62] fix typo --- .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 021aacc9b..e6e2e58af 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -656,7 +656,7 @@ jobs: run: | cd e2e-tests/cypress/tests/ yarn - yarn run cypress run --spec cypress/e2e/User.Authentication.feature,User.Authentication.ResetPassword.feature + yarn run cypress run --spec cypress/e2e/User.Authentication.feature,cypress/e2e/User.Authentication.ResetPassword.feature - name: End-to-end tests | if tests failed, upload screenshots if: ${{ failure() && steps.e2e-tests.conclusion == 'failure' }} uses: actions/upload-artifact@v3 From 49ccdb52c0eabb56890b3c1aa7ed12255bf8a21c Mon Sep 17 00:00:00 2001 From: mahula Date: Tue, 31 Jan 2023 17:20:25 +0100 Subject: [PATCH 20/62] reintroduce a sleep before seeding the backend in e2e testing --- .github/workflows/test.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e6e2e58af..60b2b9ac7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -633,6 +633,9 @@ jobs: - name: Boot up test system | docker-compose mailserver run: docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps mailserver + - name: Sleep for 5 seconds + run: sleep 5s + - name: Boot up test system | seed backend run: | sudo chown runner:docker -R * From 91933f6f0dfb4c6b0f7a26a9f0216273d4699b7d Mon Sep 17 00:00:00 2001 From: mahula Date: Thu, 2 Feb 2023 12:19:32 +0100 Subject: [PATCH 21/62] add video recodring and upload for testing purposes --- .github/workflows/test.yml | 2 ++ e2e-tests/cypress/tests/cypress.config.ts | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 60b2b9ac7..ef0091c43 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -666,3 +666,5 @@ jobs: with: name: cypress-screenshots path: /home/runner/work/gradido/gradido/e2e-tests/cypress/tests/cypress/screenshots/ + name: cypress-videos + path: /home/runner/work/gradido/gradido/e2e-tests/cypress/tests/cypress/videos/ diff --git a/e2e-tests/cypress/tests/cypress.config.ts b/e2e-tests/cypress/tests/cypress.config.ts index a9627c5ae..6bff1a169 100644 --- a/e2e-tests/cypress/tests/cypress.config.ts +++ b/e2e-tests/cypress/tests/cypress.config.ts @@ -48,7 +48,7 @@ export default defineConfig({ supportFile: "cypress/support/index.ts", viewportHeight: 720, viewportWidth: 1280, - video: false, + video: true, retries: { runMode: 2, openMode: 0, From 4e988167527c3aa4b3ae5e8d43f8993d2741f9b2 Mon Sep 17 00:00:00 2001 From: mahula Date: Thu, 2 Feb 2023 12:19:32 +0100 Subject: [PATCH 22/62] add video recodring and upload for testing purposes --- .github/workflows/test.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ef0091c43..9bffd0cc2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -666,5 +666,9 @@ jobs: with: name: cypress-screenshots path: /home/runner/work/gradido/gradido/e2e-tests/cypress/tests/cypress/screenshots/ + - name: End-to-end tests | if tests failed, upload videos + if: ${{ failure() && steps.e2e-tests.conclusion == 'failure' }} + uses: actions/upload-artifact@v3 + with: name: cypress-videos path: /home/runner/work/gradido/gradido/e2e-tests/cypress/tests/cypress/videos/ From bc12958e3ed42adc6da38e6f8cf5a2f9bbc906fc Mon Sep 17 00:00:00 2001 From: mahula Date: Thu, 2 Feb 2023 14:24:06 +0100 Subject: [PATCH 23/62] Revert "add video recodring and upload for testing purposes" This reverts commit 4e988167527c3aa4b3ae5e8d43f8993d2741f9b2. --- .github/workflows/test.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9bffd0cc2..ef0091c43 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -666,9 +666,5 @@ jobs: with: name: cypress-screenshots path: /home/runner/work/gradido/gradido/e2e-tests/cypress/tests/cypress/screenshots/ - - name: End-to-end tests | if tests failed, upload videos - if: ${{ failure() && steps.e2e-tests.conclusion == 'failure' }} - uses: actions/upload-artifact@v3 - with: name: cypress-videos path: /home/runner/work/gradido/gradido/e2e-tests/cypress/tests/cypress/videos/ From 4dfad4086da72fbe5b397efdbfae29b0f7af4c41 Mon Sep 17 00:00:00 2001 From: mahula Date: Thu, 2 Feb 2023 14:25:08 +0100 Subject: [PATCH 24/62] add response check to submit login e2e test step --- .../step_definitions/user_authentication_steps.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/e2e-tests/cypress/tests/cypress/support/step_definitions/user_authentication_steps.ts b/e2e-tests/cypress/tests/cypress/support/step_definitions/user_authentication_steps.ts index 67a64eba0..bc637fdbb 100644 --- a/e2e-tests/cypress/tests/cypress/support/step_definitions/user_authentication_steps.ts +++ b/e2e-tests/cypress/tests/cypress/support/step_definitions/user_authentication_steps.ts @@ -16,9 +16,19 @@ When("the user submits no credentials", () => { When( "the user submits the credentials {string} {string}", (email: string, password: string) => { + cy.intercept("POST", "/graphql").as("login"); + // cy.intercept('POST', '/graphql', (req) => { + // if (req.body.hasOwnProperty('query') && req.body.query.includes('mutation')) { + // req.alias = 'login' + // } + // }); + loginPage.enterEmail(email); loginPage.enterPassword(password); loginPage.submitLogin(); + cy.wait("@login").then((interception) => { + expect(JSON.stringify(interception.response.body)).contains(email); + }); } ); From aeb2ce35d59f951652d5660c6310382e2d101073 Mon Sep 17 00:00:00 2001 From: mahula Date: Thu, 2 Feb 2023 14:25:08 +0100 Subject: [PATCH 25/62] add response check to submit login e2e test step --- .github/workflows/test.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ef0091c43..60b2b9ac7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -666,5 +666,3 @@ jobs: with: name: cypress-screenshots path: /home/runner/work/gradido/gradido/e2e-tests/cypress/tests/cypress/screenshots/ - name: cypress-videos - path: /home/runner/work/gradido/gradido/e2e-tests/cypress/tests/cypress/videos/ From b91bf38f1bdcf481a6c2422cbb771ba0cbcad3c3 Mon Sep 17 00:00:00 2001 From: mahula Date: Thu, 2 Feb 2023 14:25:08 +0100 Subject: [PATCH 26/62] add response check to submit login e2e test step --- .../step_definitions/user_authentication_steps.ts | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/e2e-tests/cypress/tests/cypress/support/step_definitions/user_authentication_steps.ts b/e2e-tests/cypress/tests/cypress/support/step_definitions/user_authentication_steps.ts index bc637fdbb..d469180b3 100644 --- a/e2e-tests/cypress/tests/cypress/support/step_definitions/user_authentication_steps.ts +++ b/e2e-tests/cypress/tests/cypress/support/step_definitions/user_authentication_steps.ts @@ -16,17 +16,20 @@ When("the user submits no credentials", () => { When( "the user submits the credentials {string} {string}", (email: string, password: string) => { - cy.intercept("POST", "/graphql").as("login"); - // cy.intercept('POST', '/graphql', (req) => { - // if (req.body.hasOwnProperty('query') && req.body.query.includes('mutation')) { - // req.alias = 'login' - // } - // }); + cy.intercept("POST", "/graphql", (req) => { + if ( + req.body.hasOwnProperty("query") && + req.body.query.includes("mutation") + ) { + req.alias = "login"; + } + }); loginPage.enterEmail(email); loginPage.enterPassword(password); loginPage.submitLogin(); cy.wait("@login").then((interception) => { + expect(interception.response.statusCode).equals(200); expect(JSON.stringify(interception.response.body)).contains(email); }); } From a28a46cf08eb421aa7709b1b6f9673fba9239ad0 Mon Sep 17 00:00:00 2001 From: mahula Date: Thu, 2 Feb 2023 15:43:26 +0100 Subject: [PATCH 27/62] disable video recording in e2e tests --- e2e-tests/cypress/tests/cypress.config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e-tests/cypress/tests/cypress.config.ts b/e2e-tests/cypress/tests/cypress.config.ts index 6bff1a169..a9627c5ae 100644 --- a/e2e-tests/cypress/tests/cypress.config.ts +++ b/e2e-tests/cypress/tests/cypress.config.ts @@ -48,7 +48,7 @@ export default defineConfig({ supportFile: "cypress/support/index.ts", viewportHeight: 720, viewportWidth: 1280, - video: true, + video: false, retries: { runMode: 2, openMode: 0, From 306c039b4ddd7ba22e2ab8eb13fd301ffba55d1a Mon Sep 17 00:00:00 2001 From: mahula Date: Thu, 2 Feb 2023 15:46:13 +0100 Subject: [PATCH 28/62] comment workflow jobs for e2e testing --- .github/workflows/test.yml | 619 ++++++++++++++++++------------------- 1 file changed, 306 insertions(+), 313 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 60b2b9ac7..f4b9dfda9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -192,345 +192,345 @@ jobs: ############################################################################## # JOB: LINT FRONTEND ######################################################### ############################################################################## - lint_frontend: - name: Lint - Frontend - runs-on: ubuntu-latest - needs: [build_test_frontend] - steps: - ########################################################################## - # CHECKOUT CODE ########################################################## - ########################################################################## - - name: Checkout code - uses: actions/checkout@v3 - ########################################################################## - # DOWNLOAD DOCKER IMAGE ################################################## - ########################################################################## - - name: Download Docker Image (Frontend) - uses: actions/download-artifact@v3 - with: - name: docker-frontend-test - path: /tmp - - name: Load Docker Image - run: docker load < /tmp/frontend.tar - ########################################################################## - # LINT FRONTEND ########################################################## - ########################################################################## - - name: Frontend | Lint - run: docker run --rm gradido/frontend:test yarn run lint + # lint_frontend: + # name: Lint - Frontend + # runs-on: ubuntu-latest + # needs: [build_test_frontend] + # steps: + # ########################################################################## + # # CHECKOUT CODE ########################################################## + # ########################################################################## + # - name: Checkout code + # uses: actions/checkout@v3 + # ########################################################################## + # # DOWNLOAD DOCKER IMAGE ################################################## + # ########################################################################## + # - name: Download Docker Image (Frontend) + # uses: actions/download-artifact@v3 + # with: + # name: docker-frontend-test + # path: /tmp + # - name: Load Docker Image + # run: docker load < /tmp/frontend.tar + # ########################################################################## + # # LINT FRONTEND ########################################################## + # ########################################################################## + # - name: Frontend | Lint + # run: docker run --rm gradido/frontend:test yarn run lint ############################################################################## # JOB: STYLELINT FRONTEND #################################################### ############################################################################## - stylelint_frontend: - name: Stylelint - Frontend - runs-on: ubuntu-latest - needs: [build_test_frontend] - steps: - ########################################################################## - # CHECKOUT CODE ########################################################## - ########################################################################## - - name: Checkout code - uses: actions/checkout@v3 - ########################################################################## - # DOWNLOAD DOCKER IMAGE ################################################## - ########################################################################## - - name: Download Docker Image (Frontend) - uses: actions/download-artifact@v3 - with: - name: docker-frontend-test - path: /tmp - - name: Load Docker Image - run: docker load < /tmp/frontend.tar - ########################################################################## - # STYLELINT FRONTEND ##################################################### - ########################################################################## - - name: Frontend | Stylelint - run: docker run --rm gradido/frontend:test yarn run stylelint + # stylelint_frontend: + # name: Stylelint - Frontend + # runs-on: ubuntu-latest + # needs: [build_test_frontend] + # steps: + # ########################################################################## + # # CHECKOUT CODE ########################################################## + # ########################################################################## + # - name: Checkout code + # uses: actions/checkout@v3 + # ########################################################################## + # # DOWNLOAD DOCKER IMAGE ################################################## + # ########################################################################## + # - name: Download Docker Image (Frontend) + # uses: actions/download-artifact@v3 + # with: + # name: docker-frontend-test + # path: /tmp + # - name: Load Docker Image + # run: docker load < /tmp/frontend.tar + # ########################################################################## + # # STYLELINT FRONTEND ##################################################### + # ########################################################################## + # - name: Frontend | Stylelint + # run: docker run --rm gradido/frontend:test yarn run stylelint ############################################################################## # JOB: LINT ADMIN INTERFACE ################################################## ############################################################################## - lint_admin: - name: Lint - Admin Interface - runs-on: ubuntu-latest - needs: [build_test_admin] - steps: - ########################################################################## - # CHECKOUT CODE ########################################################## - ########################################################################## - - name: Checkout code - uses: actions/checkout@v3 - ########################################################################## - # DOWNLOAD DOCKER IMAGE ################################################## - ########################################################################## - - name: Download Docker Image (Admin Interface) - uses: actions/download-artifact@v3 - with: - name: docker-admin-test - path: /tmp - - name: Load Docker Image - run: docker load < /tmp/admin.tar - ########################################################################## - # LINT ADMIN INTERFACE ################################################### - ########################################################################## - - name: Admin Interface | Lint - run: docker run --rm gradido/admin:test yarn run lint + # lint_admin: + # name: Lint - Admin Interface + # runs-on: ubuntu-latest + # needs: [build_test_admin] + # steps: + # ########################################################################## + # # CHECKOUT CODE ########################################################## + # ########################################################################## + # - name: Checkout code + # uses: actions/checkout@v3 + # ########################################################################## + # # DOWNLOAD DOCKER IMAGE ################################################## + # ########################################################################## + # - name: Download Docker Image (Admin Interface) + # uses: actions/download-artifact@v3 + # with: + # name: docker-admin-test + # path: /tmp + # - name: Load Docker Image + # run: docker load < /tmp/admin.tar + # ########################################################################## + # # LINT ADMIN INTERFACE ################################################### + # ########################################################################## + # - name: Admin Interface | Lint + # run: docker run --rm gradido/admin:test yarn run lint ############################################################################## # JOB: STYLELINT ADMIN INTERFACE ############################################## ############################################################################## - stylelint_admin: - name: Stylelint - Admin Interface - runs-on: ubuntu-latest - needs: [build_test_admin] - steps: - ########################################################################## - # CHECKOUT CODE ########################################################## - ########################################################################## - - name: Checkout code - uses: actions/checkout@v3 - ########################################################################## - # DOWNLOAD DOCKER IMAGE ################################################## - ########################################################################## - - name: Download Docker Image (Admin Interface) - uses: actions/download-artifact@v3 - with: - name: docker-admin-test - path: /tmp - - name: Load Docker Image - run: docker load < /tmp/admin.tar - ########################################################################## - # STYLELINT ADMIN INTERFACE ############################################## - ########################################################################## - - name: Admin Interface | Stylelint - run: docker run --rm gradido/admin:test yarn run stylelint + # stylelint_admin: + # name: Stylelint - Admin Interface + # runs-on: ubuntu-latest + # needs: [build_test_admin] + # steps: + # ########################################################################## + # # CHECKOUT CODE ########################################################## + # ########################################################################## + # - name: Checkout code + # uses: actions/checkout@v3 + # ########################################################################## + # # DOWNLOAD DOCKER IMAGE ################################################## + # ########################################################################## + # - name: Download Docker Image (Admin Interface) + # uses: actions/download-artifact@v3 + # with: + # name: docker-admin-test + # path: /tmp + # - name: Load Docker Image + # run: docker load < /tmp/admin.tar + # ########################################################################## + # # STYLELINT ADMIN INTERFACE ############################################## + # ########################################################################## + # - name: Admin Interface | Stylelint + # run: docker run --rm gradido/admin:test yarn run stylelint ############################################################################## # JOB: LOCALES ADMIN ######################################################### ############################################################################## - locales_admin: - name: Locales - Admin Interface - runs-on: ubuntu-latest - needs: [build_test_admin] - steps: - ########################################################################## - # CHECKOUT CODE ########################################################## - ########################################################################## - - name: Checkout code - uses: actions/checkout@v3 - ########################################################################## - # DOWNLOAD DOCKER IMAGE ################################################## - ########################################################################## - - name: Download Docker Image (Admin Interface) - uses: actions/download-artifact@v3 - with: - name: docker-admin-test - path: /tmp - - name: Load Docker Image - run: docker load < /tmp/admin.tar - ########################################################################## - # LOCALES FRONTEND ####################################################### - ########################################################################## - - name: admin | Locales - run: docker run --rm gradido/admin:test yarn run locales + # locales_admin: + # name: Locales - Admin Interface + # runs-on: ubuntu-latest + # needs: [build_test_admin] + # steps: + # ########################################################################## + # # CHECKOUT CODE ########################################################## + # ########################################################################## + # - name: Checkout code + # uses: actions/checkout@v3 + # ########################################################################## + # # DOWNLOAD DOCKER IMAGE ################################################## + # ########################################################################## + # - name: Download Docker Image (Admin Interface) + # uses: actions/download-artifact@v3 + # with: + # name: docker-admin-test + # path: /tmp + # - name: Load Docker Image + # run: docker load < /tmp/admin.tar + # ########################################################################## + # # LOCALES FRONTEND ####################################################### + # ########################################################################## + # - name: admin | Locales + # run: docker run --rm gradido/admin:test yarn run locales ############################################################################## # JOB: LINT BACKEND ########################################################## ############################################################################## - lint_backend: - name: Lint - Backend - runs-on: ubuntu-latest - needs: [build_test_backend] - steps: - ########################################################################## - # CHECKOUT CODE ########################################################## - ########################################################################## - - name: Checkout code - uses: actions/checkout@v3 - ########################################################################## - # DOWNLOAD DOCKER IMAGE ################################################## - ########################################################################## - - name: Download Docker Image (Backend) - uses: actions/download-artifact@v3 - with: - name: docker-backend-test - path: /tmp - - name: Load Docker Image - run: docker load < /tmp/backend.tar - ########################################################################## - # LINT BACKEND ########################################################### - ########################################################################## - - name: backend | Lint - run: docker run --rm gradido/backend:test yarn run lint + # lint_backend: + # name: Lint - Backend + # runs-on: ubuntu-latest + # needs: [build_test_backend] + # steps: + # ########################################################################## + # # CHECKOUT CODE ########################################################## + # ########################################################################## + # - name: Checkout code + # uses: actions/checkout@v3 + # ########################################################################## + # # DOWNLOAD DOCKER IMAGE ################################################## + # ########################################################################## + # - name: Download Docker Image (Backend) + # uses: actions/download-artifact@v3 + # with: + # name: docker-backend-test + # path: /tmp + # - name: Load Docker Image + # run: docker load < /tmp/backend.tar + # ########################################################################## + # # LINT BACKEND ########################################################### + # ########################################################################## + # - name: backend | Lint + # run: docker run --rm gradido/backend:test yarn run lint ############################################################################## # JOB: LINT DATABASE UP ###################################################### ############################################################################## - lint_database_up: - name: Lint - Database Up - runs-on: ubuntu-latest - needs: [build_test_database_up] - steps: - ########################################################################## - # CHECKOUT CODE ########################################################## - ########################################################################## - - name: Checkout code - uses: actions/checkout@v3 - ########################################################################## - # DOWNLOAD DOCKER IMAGE ################################################## - ########################################################################## - - name: Download Docker Image (Backend) - uses: actions/download-artifact@v3 - with: - name: docker-database-test_up - path: /tmp - - name: Load Docker Image - run: docker load < /tmp/database_up.tar - ########################################################################## - # LINT DATABASE ########################################################## - ########################################################################## - - name: database | Lint - run: docker run --rm gradido/database:test_up yarn run lint + # lint_database_up: + # name: Lint - Database Up + # runs-on: ubuntu-latest + # needs: [build_test_database_up] + # steps: + # ########################################################################## + # # CHECKOUT CODE ########################################################## + # ########################################################################## + # - name: Checkout code + # uses: actions/checkout@v3 + # ########################################################################## + # # DOWNLOAD DOCKER IMAGE ################################################## + # ########################################################################## + # - name: Download Docker Image (Backend) + # uses: actions/download-artifact@v3 + # with: + # name: docker-database-test_up + # path: /tmp + # - name: Load Docker Image + # run: docker load < /tmp/database_up.tar + # ########################################################################## + # # LINT DATABASE ########################################################## + # ########################################################################## + # - name: database | Lint + # run: docker run --rm gradido/database:test_up yarn run lint ############################################################################## # JOB: UNIT TEST FRONTEND ################################################### ############################################################################## - unit_test_frontend: - name: Unit tests - Frontend - runs-on: ubuntu-latest - needs: [build_test_frontend] - steps: - ########################################################################## - # CHECKOUT CODE ########################################################## - ########################################################################## - - name: Checkout code - uses: actions/checkout@v3 - ########################################################################## - # DOWNLOAD DOCKER IMAGES ################################################# - ########################################################################## - - name: Download Docker Image (Frontend) - uses: actions/download-artifact@v3 - with: - name: docker-frontend-test - path: /tmp - - name: Load Docker Image - run: docker load < /tmp/frontend.tar - ########################################################################## - # UNIT TESTS FRONTEND #################################################### - ########################################################################## - - name: frontend | Unit tests - run: | - docker run --env NODE_ENV=test -v ~/coverage:/app/coverage --rm gradido/frontend:test yarn run test - cp -r ~/coverage ./coverage - ########################################################################## - # COVERAGE REPORT FRONTEND ############################################### - ########################################################################## - #- name: frontend | Coverage report - # uses: romeovs/lcov-reporter-action@v0.2.21 - # with: - # github-token: ${{ secrets.GITHUB_TOKEN }} - # lcov-file: ./coverage/lcov.info - ########################################################################## - # COVERAGE CHECK FRONTEND ################################################ - ########################################################################## - - name: frontend | Coverage check - uses: webcraftmedia/coverage-check-action@master - with: - report_name: Coverage Frontend - type: lcov - result_path: ./coverage/lcov.info - min_coverage: 95 - token: ${{ github.token }} + # unit_test_frontend: + # name: Unit tests - Frontend + # runs-on: ubuntu-latest + # needs: [build_test_frontend] + # steps: + # ########################################################################## + # # CHECKOUT CODE ########################################################## + # ########################################################################## + # - name: Checkout code + # uses: actions/checkout@v3 + # ########################################################################## + # # DOWNLOAD DOCKER IMAGES ################################################# + # ########################################################################## + # - name: Download Docker Image (Frontend) + # uses: actions/download-artifact@v3 + # with: + # name: docker-frontend-test + # path: /tmp + # - name: Load Docker Image + # run: docker load < /tmp/frontend.tar + # ########################################################################## + # # UNIT TESTS FRONTEND #################################################### + # ########################################################################## + # - name: frontend | Unit tests + # run: | + # docker run --env NODE_ENV=test -v ~/coverage:/app/coverage --rm gradido/frontend:test yarn run test + # cp -r ~/coverage ./coverage + # ########################################################################## + # # COVERAGE REPORT FRONTEND ############################################### + # ########################################################################## + # #- name: frontend | Coverage report + # # uses: romeovs/lcov-reporter-action@v0.2.21 + # # with: + # # github-token: ${{ secrets.GITHUB_TOKEN }} + # # lcov-file: ./coverage/lcov.info + # ########################################################################## + # # COVERAGE CHECK FRONTEND ################################################ + # ########################################################################## + # - name: frontend | Coverage check + # uses: webcraftmedia/coverage-check-action@master + # with: + # report_name: Coverage Frontend + # type: lcov + # result_path: ./coverage/lcov.info + # min_coverage: 95 + # token: ${{ github.token }} ############################################################################## # JOB: UNIT TEST ADMIN INTERFACE ############################################# ############################################################################## - unit_test_admin: - name: Unit tests - Admin Interface - runs-on: ubuntu-latest - needs: [build_test_admin] - steps: - ########################################################################## - # CHECKOUT CODE ########################################################## - ########################################################################## - - name: Checkout code - uses: actions/checkout@v3 - ########################################################################## - # DOWNLOAD DOCKER IMAGES ################################################# - ########################################################################## - - name: Download Docker Image (Admin Interface) - uses: actions/download-artifact@v3 - with: - name: docker-admin-test - path: /tmp - - name: Load Docker Image - run: docker load < /tmp/admin.tar - ########################################################################## - # UNIT TESTS ADMIN INTERFACE ############################################# - ########################################################################## - - name: Admin Interface | Unit tests - run: | - docker run -v ~/coverage:/app/coverage --rm gradido/admin:test yarn run test - cp -r ~/coverage ./coverage - ########################################################################## - # COVERAGE CHECK ADMIN INTERFACE ######################################### - ########################################################################## - - name: Admin Interface | Coverage check - uses: webcraftmedia/coverage-check-action@master - with: - report_name: Coverage Admin Interface - type: lcov - result_path: ./coverage/lcov.info - min_coverage: 96 - token: ${{ github.token }} + # unit_test_admin: + # name: Unit tests - Admin Interface + # runs-on: ubuntu-latest + # needs: [build_test_admin] + # steps: + # ########################################################################## + # # CHECKOUT CODE ########################################################## + # ########################################################################## + # - name: Checkout code + # uses: actions/checkout@v3 + # ########################################################################## + # # DOWNLOAD DOCKER IMAGES ################################################# + # ########################################################################## + # - name: Download Docker Image (Admin Interface) + # uses: actions/download-artifact@v3 + # with: + # name: docker-admin-test + # path: /tmp + # - name: Load Docker Image + # run: docker load < /tmp/admin.tar + # ########################################################################## + # # UNIT TESTS ADMIN INTERFACE ############################################# + # ########################################################################## + # - name: Admin Interface | Unit tests + # run: | + # docker run -v ~/coverage:/app/coverage --rm gradido/admin:test yarn run test + # cp -r ~/coverage ./coverage + # ########################################################################## + # # COVERAGE CHECK ADMIN INTERFACE ######################################### + # ########################################################################## + # - name: Admin Interface | Coverage check + # uses: webcraftmedia/coverage-check-action@master + # with: + # report_name: Coverage Admin Interface + # type: lcov + # result_path: ./coverage/lcov.info + # min_coverage: 96 + # token: ${{ github.token }} ############################################################################## # JOB: UNIT TEST BACKEND #################################################### ############################################################################## - unit_test_backend: - name: Unit tests - Backend - runs-on: ubuntu-latest - needs: [build_test_mariadb] - steps: - ########################################################################## - # CHECKOUT CODE ########################################################## - ########################################################################## - - name: Checkout code - uses: actions/checkout@v3 - ########################################################################## - # DOWNLOAD DOCKER IMAGES ################################################# - ########################################################################## - - name: Download Docker Image (Mariadb) - uses: actions/download-artifact@v3 - with: - name: docker-mariadb-test - path: /tmp - - name: Load Docker Image - run: docker load < /tmp/mariadb.tar - ########################################################################## - # UNIT TESTS BACKEND ##################################################### - ########################################################################## - - name: backend | docker-compose mariadb - run: docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps mariadb - - name: Sleep for 30 seconds - run: sleep 30s - shell: bash - - name: backend | docker-compose database - run: docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps database - - name: backend Unit tests | test - run: cd database && yarn && yarn build && cd ../backend && yarn && yarn test - # run: docker-compose -f docker-compose.yml -f docker-compose.test.yml exec -T backend yarn test - ########################################################################## - # COVERAGE CHECK BACKEND ################################################# - ########################################################################## - - name: backend | Coverage check - uses: webcraftmedia/coverage-check-action@master - with: - report_name: Coverage Backend - type: lcov - result_path: ./backend/coverage/lcov.info - min_coverage: 78 - token: ${{ github.token }} + # unit_test_backend: + # name: Unit tests - Backend + # runs-on: ubuntu-latest + # needs: [build_test_mariadb] + # steps: + # ########################################################################## + # # CHECKOUT CODE ########################################################## + # ########################################################################## + # - name: Checkout code + # uses: actions/checkout@v3 + # ########################################################################## + # # DOWNLOAD DOCKER IMAGES ################################################# + # ########################################################################## + # - name: Download Docker Image (Mariadb) + # uses: actions/download-artifact@v3 + # with: + # name: docker-mariadb-test + # path: /tmp + # - name: Load Docker Image + # run: docker load < /tmp/mariadb.tar + # ########################################################################## + # # UNIT TESTS BACKEND ##################################################### + # ########################################################################## + # - name: backend | docker-compose mariadb + # run: docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps mariadb + # - name: Sleep for 30 seconds + # run: sleep 30s + # shell: bash + # - name: backend | docker-compose database + # run: docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps database + # - name: backend Unit tests | test + # run: cd database && yarn && yarn build && cd ../backend && yarn && yarn test + # # run: docker-compose -f docker-compose.yml -f docker-compose.test.yml exec -T backend yarn test + # ########################################################################## + # # COVERAGE CHECK BACKEND ################################################# + # ########################################################################## + # - name: backend | Coverage check + # uses: webcraftmedia/coverage-check-action@master + # with: + # report_name: Coverage Backend + # type: lcov + # result_path: ./backend/coverage/lcov.info + # min_coverage: 78 + # token: ${{ github.token }} ########################################################################## # DATABASE MIGRATION TEST UP + RESET ##################################### @@ -624,17 +624,10 @@ jobs: run: docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps database - name: Boot up test system | docker-compose backend - run: | - docker run -i --rm gradido/backend:test /bin/sh - cd backend - cp .env.test_email .env && exit - docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps backend + run: docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps backend - - name: Boot up test system | docker-compose mailserver - run: docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps mailserver - - - name: Sleep for 5 seconds - run: sleep 5s + - name: Sleep for 10 seconds + run: sleep 10s - name: Boot up test system | seed backend run: | From b4550b1af9d48617a1bbcc9fcae801f306141e76 Mon Sep 17 00:00:00 2001 From: mahula Date: Thu, 2 Feb 2023 15:46:13 +0100 Subject: [PATCH 29/62] comment workflow jobs for e2e testing --- .github/workflows/test.yml | 88 +++++++++++++++++++------------------- 1 file changed, 44 insertions(+), 44 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f4b9dfda9..c2660e2f8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -163,31 +163,31 @@ jobs: ############################################################################## # JOB: LOCALES FRONTEND ###################################################### ############################################################################## - locales_frontend: - name: Locales - Frontend - runs-on: ubuntu-latest - needs: [build_test_frontend] - steps: - ########################################################################## - # CHECKOUT CODE ########################################################## - ########################################################################## - - name: Checkout code - uses: actions/checkout@v3 - ########################################################################## - # DOWNLOAD DOCKER IMAGE ################################################## - ########################################################################## - - name: Download Docker Image (Frontend) - uses: actions/download-artifact@v3 - with: - name: docker-frontend-test - path: /tmp - - name: Load Docker Image - run: docker load < /tmp/frontend.tar - ########################################################################## - # LOCALES FRONTEND ####################################################### - ########################################################################## - - name: Frontend | Locales - run: docker run --rm gradido/frontend:test yarn run locales + # locales_frontend: + # name: Locales - Frontend + # runs-on: ubuntu-latest + # needs: [build_test_frontend] + # steps: + # ########################################################################## + # # CHECKOUT CODE ########################################################## + # ########################################################################## + # - name: Checkout code + # uses: actions/checkout@v3 + # ########################################################################## + # # DOWNLOAD DOCKER IMAGE ################################################## + # ########################################################################## + # - name: Download Docker Image (Frontend) + # uses: actions/download-artifact@v3 + # with: + # name: docker-frontend-test + # path: /tmp + # - name: Load Docker Image + # run: docker load < /tmp/frontend.tar + # ########################################################################## + # # LOCALES FRONTEND ####################################################### + # ########################################################################## + # - name: Frontend | Locales + # run: docker run --rm gradido/frontend:test yarn run locales ############################################################################## # JOB: LINT FRONTEND ######################################################### @@ -535,25 +535,25 @@ jobs: ########################################################################## # DATABASE MIGRATION TEST UP + RESET ##################################### ########################################################################## - database_migration_test: - name: Database Migration Test - Up + Reset - runs-on: ubuntu-latest - #needs: [nothing] - steps: - ########################################################################## - # CHECKOUT CODE ########################################################## - ########################################################################## - - name: Checkout code - uses: actions/checkout@v3 - ########################################################################## - # DOCKER COMPOSE DATABASE UP + RESET ##################################### - ########################################################################## - - name: database | docker-compose - run: docker-compose -f docker-compose.yml up --detach mariadb - - name: database | up - run: docker-compose -f docker-compose.yml run -T database yarn up - - name: database | reset - run: docker-compose -f docker-compose.yml run -T database yarn reset + # database_migration_test: + # name: Database Migration Test - Up + Reset + # runs-on: ubuntu-latest + # #needs: [nothing] + # steps: + # ########################################################################## + # # CHECKOUT CODE ########################################################## + # ########################################################################## + # - name: Checkout code + # uses: actions/checkout@v3 + # ########################################################################## + # # DOCKER COMPOSE DATABASE UP + RESET ##################################### + # ########################################################################## + # - name: database | docker-compose + # run: docker-compose -f docker-compose.yml up --detach mariadb + # - name: database | up + # run: docker-compose -f docker-compose.yml run -T database yarn up + # - name: database | reset + # run: docker-compose -f docker-compose.yml run -T database yarn reset ############################################################################## # JOB: END-TO-END TESTS ##################################################### From bea4e7ce4fd464db4a4b551c85d2143e0705f883 Mon Sep 17 00:00:00 2001 From: mahula Date: Thu, 2 Feb 2023 16:13:54 +0100 Subject: [PATCH 30/62] use own backup image with dot-env for e2e testing --- .github/workflows/test.yml | 23 +++++++++++++++-------- backend/.env.test_e2e | 5 +++++ 2 files changed, 20 insertions(+), 8 deletions(-) create mode 100644 backend/.env.test_e2e diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c2660e2f8..9b8ffa8da 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -585,13 +585,13 @@ jobs: path: /tmp - name: Load Docker Image (Database Up) run: docker load < /tmp/database_up.tar - - name: Download Docker Image (Backend) - uses: actions/download-artifact@v3 - with: - name: docker-backend-test - path: /tmp - - name: Load Docker Image (Backend) - run: docker load < /tmp/backend.tar + # - name: Download Docker Image (Backend) + # uses: actions/download-artifact@v3 + # with: + # name: docker-backend-test + # path: /tmp + # - name: Load Docker Image (Backend) + # run: docker load < /tmp/backend.tar - name: Download Docker Image (Frontend) uses: actions/download-artifact@v3 with: @@ -624,7 +624,11 @@ jobs: run: docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps database - name: Boot up test system | docker-compose backend - run: docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps backend + run: | + cd backend + cp .env.XX .env + cd .. + docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps backend - name: Sleep for 10 seconds run: sleep 10s @@ -641,6 +645,9 @@ jobs: - name: Boot up test system | docker-compose frontends run: docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps frontend admin nginx + - name: Boot up test system | docker-compose frontends + run: docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps mailserver + - name: Sleep for 15 seconds run: sleep 15s diff --git a/backend/.env.test_e2e b/backend/.env.test_e2e new file mode 100644 index 000000000..fba34833a --- /dev/null +++ b/backend/.env.test_e2e @@ -0,0 +1,5 @@ +EMAIL=true +EMAIL_TEST_MODUS=false +EMAIL_TLS=false +# for testing password reset +EMAIL_CODE_REQUEST_TIME=1 From 62505d7561aecf2dc333b580f3b4de39de8af167 Mon Sep 17 00:00:00 2001 From: mahula Date: Thu, 2 Feb 2023 16:13:54 +0100 Subject: [PATCH 31/62] use own backup image with dot-env for e2e testing --- .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 9b8ffa8da..bbd4a5151 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -561,7 +561,7 @@ jobs: end-to-end-tests: name: End-to-End Tests runs-on: ubuntu-latest - needs: [build_test_mariadb, build_test_database_up, build_test_backend, build_test_admin, build_test_frontend, build_test_nginx] + needs: [build_test_mariadb, build_test_database_up, build_test_admin, build_test_frontend, build_test_nginx] steps: ########################################################################## # CHECKOUT CODE ########################################################## From 87d2af8d4e34b2568b0094825112cce0dea31464 Mon Sep 17 00:00:00 2001 From: mahula Date: Thu, 2 Feb 2023 16:13:54 +0100 Subject: [PATCH 32/62] use own backup image with dot-env for e2e testing --- .github/workflows/test.yml | 46 +++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bbd4a5151..f887afeef 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -60,28 +60,28 @@ jobs: ############################################################################## # JOB: DOCKER BUILD TEST BACKEND ############################################# ############################################################################## - build_test_backend: - name: Docker Build Test - Backend - runs-on: ubuntu-latest - #needs: [nothing] - steps: - ########################################################################## - # CHECKOUT CODE ########################################################## - ########################################################################## - - name: Checkout code - uses: actions/checkout@v3 - ########################################################################## - # BACKEND ################################################################ - ########################################################################## - - name: Backend | Build `test` image - run: | - docker build -f ./backend/Dockerfile --target test -t "gradido/backend:test" . - docker save "gradido/backend:test" > /tmp/backend.tar - - name: Upload Artifact - uses: actions/upload-artifact@v3 - with: - name: docker-backend-test - path: /tmp/backend.tar + # build_test_backend: + # name: Docker Build Test - Backend + # runs-on: ubuntu-latest + # #needs: [nothing] + # steps: + # ########################################################################## + # # CHECKOUT CODE ########################################################## + # ########################################################################## + # - name: Checkout code + # uses: actions/checkout@v3 + # ########################################################################## + # # BACKEND ################################################################ + # ########################################################################## + # - name: Backend | Build `test` image + # run: | + # docker build -f ./backend/Dockerfile --target test -t "gradido/backend:test" . + # docker save "gradido/backend:test" > /tmp/backend.tar + # - name: Upload Artifact + # uses: actions/upload-artifact@v3 + # with: + # name: docker-backend-test + # path: /tmp/backend.tar ############################################################################## # JOB: DOCKER BUILD TEST DATABASE UP ######################################### @@ -626,7 +626,7 @@ jobs: - name: Boot up test system | docker-compose backend run: | cd backend - cp .env.XX .env + cp .env.test_e2e .env cd .. docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps backend From eaaf3a81c206b0e52ea7b5d053e3f551f6b8e30d Mon Sep 17 00:00:00 2001 From: mahula Date: Thu, 2 Feb 2023 16:13:54 +0100 Subject: [PATCH 33/62] use own backup image with dot-env for e2e testing --- .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 f887afeef..bf6e6fc5f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -645,7 +645,7 @@ jobs: - name: Boot up test system | docker-compose frontends run: docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps frontend admin nginx - - name: Boot up test system | docker-compose frontends + - name: Boot up test system | docker-compose mailserver run: docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps mailserver - name: Sleep for 15 seconds From cb39f0b5052a00e7d94ed6e0ced9a35589ed4b1b Mon Sep 17 00:00:00 2001 From: mahula Date: Thu, 2 Feb 2023 17:04:13 +0100 Subject: [PATCH 34/62] set down jwt expiration time in dot-env for e2e testing --- backend/.env.test_e2e | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/backend/.env.test_e2e b/backend/.env.test_e2e index fba34833a..a5cdc4bfd 100644 --- a/backend/.env.test_e2e +++ b/backend/.env.test_e2e @@ -1,3 +1,7 @@ +# Server +JWT_EXPIRES_IN=1m + +# Email EMAIL=true EMAIL_TEST_MODUS=false EMAIL_TLS=false From d89fc1ef105366d0f9deffb0bf79869ce5dff019 Mon Sep 17 00:00:00 2001 From: mahula Date: Thu, 2 Feb 2023 21:03:14 +0100 Subject: [PATCH 35/62] move response in e2e test to common step definitions --- .../support/step_definitions/common_steps.ts | 12 ++++++++++++ .../step_definitions/user_authentication_steps.ts | 13 ------------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/e2e-tests/cypress/tests/cypress/support/step_definitions/common_steps.ts b/e2e-tests/cypress/tests/cypress/support/step_definitions/common_steps.ts index 42142380b..881394e6d 100644 --- a/e2e-tests/cypress/tests/cypress/support/step_definitions/common_steps.ts +++ b/e2e-tests/cypress/tests/cypress/support/step_definitions/common_steps.ts @@ -18,6 +18,18 @@ Given( Then("the user is logged in with username {string}", (username: string) => { const overviewPage = new OverviewPage(); + cy.intercept("POST", "/graphql", (req) => { + if ( + req.body.hasOwnProperty("query") && + req.body.query.includes("mutation") + ) { + req.alias = "login"; + } + }); + cy.wait("@login").then((interception) => { + expect(interception.response.statusCode).equals(200); + expect(JSON.stringify(interception.response.body)).contains(email); + }); cy.url().should("include", "/overview"); cy.get(overviewPage.navbarName).should("contain", username); }); diff --git a/e2e-tests/cypress/tests/cypress/support/step_definitions/user_authentication_steps.ts b/e2e-tests/cypress/tests/cypress/support/step_definitions/user_authentication_steps.ts index d469180b3..67a64eba0 100644 --- a/e2e-tests/cypress/tests/cypress/support/step_definitions/user_authentication_steps.ts +++ b/e2e-tests/cypress/tests/cypress/support/step_definitions/user_authentication_steps.ts @@ -16,22 +16,9 @@ When("the user submits no credentials", () => { When( "the user submits the credentials {string} {string}", (email: string, password: string) => { - cy.intercept("POST", "/graphql", (req) => { - if ( - req.body.hasOwnProperty("query") && - req.body.query.includes("mutation") - ) { - req.alias = "login"; - } - }); - loginPage.enterEmail(email); loginPage.enterPassword(password); loginPage.submitLogin(); - cy.wait("@login").then((interception) => { - expect(interception.response.statusCode).equals(200); - expect(JSON.stringify(interception.response.body)).contains(email); - }); } ); From 010e17ee62e87b04540711237048d9a5ff373315 Mon Sep 17 00:00:00 2001 From: mahula Date: Thu, 2 Feb 2023 21:58:08 +0100 Subject: [PATCH 36/62] Revert "move response in e2e test to common step definitions" This reverts commit d89fc1ef105366d0f9deffb0bf79869ce5dff019. --- .../support/step_definitions/common_steps.ts | 12 ------------ .../step_definitions/user_authentication_steps.ts | 13 +++++++++++++ 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/e2e-tests/cypress/tests/cypress/support/step_definitions/common_steps.ts b/e2e-tests/cypress/tests/cypress/support/step_definitions/common_steps.ts index 881394e6d..42142380b 100644 --- a/e2e-tests/cypress/tests/cypress/support/step_definitions/common_steps.ts +++ b/e2e-tests/cypress/tests/cypress/support/step_definitions/common_steps.ts @@ -18,18 +18,6 @@ Given( Then("the user is logged in with username {string}", (username: string) => { const overviewPage = new OverviewPage(); - cy.intercept("POST", "/graphql", (req) => { - if ( - req.body.hasOwnProperty("query") && - req.body.query.includes("mutation") - ) { - req.alias = "login"; - } - }); - cy.wait("@login").then((interception) => { - expect(interception.response.statusCode).equals(200); - expect(JSON.stringify(interception.response.body)).contains(email); - }); cy.url().should("include", "/overview"); cy.get(overviewPage.navbarName).should("contain", username); }); diff --git a/e2e-tests/cypress/tests/cypress/support/step_definitions/user_authentication_steps.ts b/e2e-tests/cypress/tests/cypress/support/step_definitions/user_authentication_steps.ts index 67a64eba0..d469180b3 100644 --- a/e2e-tests/cypress/tests/cypress/support/step_definitions/user_authentication_steps.ts +++ b/e2e-tests/cypress/tests/cypress/support/step_definitions/user_authentication_steps.ts @@ -16,9 +16,22 @@ When("the user submits no credentials", () => { When( "the user submits the credentials {string} {string}", (email: string, password: string) => { + cy.intercept("POST", "/graphql", (req) => { + if ( + req.body.hasOwnProperty("query") && + req.body.query.includes("mutation") + ) { + req.alias = "login"; + } + }); + loginPage.enterEmail(email); loginPage.enterPassword(password); loginPage.submitLogin(); + cy.wait("@login").then((interception) => { + expect(interception.response.statusCode).equals(200); + expect(JSON.stringify(interception.response.body)).contains(email); + }); } ); From b2eab939797f5a5fe461b2237e6c394d8d53c643 Mon Sep 17 00:00:00 2001 From: mahula Date: Thu, 2 Feb 2023 21:59:07 +0100 Subject: [PATCH 37/62] fix step_definition for e2e test --- .../step_definitions/user_authentication_steps.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/e2e-tests/cypress/tests/cypress/support/step_definitions/user_authentication_steps.ts b/e2e-tests/cypress/tests/cypress/support/step_definitions/user_authentication_steps.ts index d469180b3..50701098c 100644 --- a/e2e-tests/cypress/tests/cypress/support/step_definitions/user_authentication_steps.ts +++ b/e2e-tests/cypress/tests/cypress/support/step_definitions/user_authentication_steps.ts @@ -21,16 +21,26 @@ When( req.body.hasOwnProperty("query") && req.body.query.includes("mutation") ) { +<<<<<<< Updated upstream req.alias = "login"; +======= + req.alias = "loging"; +>>>>>>> Stashed changes } }); loginPage.enterEmail(email); loginPage.enterPassword(password); loginPage.submitLogin(); +<<<<<<< Updated upstream cy.wait("@login").then((interception) => { expect(interception.response.statusCode).equals(200); expect(JSON.stringify(interception.response.body)).contains(email); +======= + + cy.wait("@loging").then((interception) => { + expect(interception.response.statusCode).equals(200); +>>>>>>> Stashed changes }); } ); From 758bd8e78120562f6a9a75093df6b8667ac3d48e Mon Sep 17 00:00:00 2001 From: mahula Date: Thu, 2 Feb 2023 21:59:07 +0100 Subject: [PATCH 38/62] fix step_definition for e2e test --- .../step_definitions/user_authentication_steps.ts | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/e2e-tests/cypress/tests/cypress/support/step_definitions/user_authentication_steps.ts b/e2e-tests/cypress/tests/cypress/support/step_definitions/user_authentication_steps.ts index 50701098c..17743ebe5 100644 --- a/e2e-tests/cypress/tests/cypress/support/step_definitions/user_authentication_steps.ts +++ b/e2e-tests/cypress/tests/cypress/support/step_definitions/user_authentication_steps.ts @@ -21,26 +21,15 @@ When( req.body.hasOwnProperty("query") && req.body.query.includes("mutation") ) { -<<<<<<< Updated upstream req.alias = "login"; -======= - req.alias = "loging"; ->>>>>>> Stashed changes } }); loginPage.enterEmail(email); loginPage.enterPassword(password); loginPage.submitLogin(); -<<<<<<< Updated upstream cy.wait("@login").then((interception) => { expect(interception.response.statusCode).equals(200); - expect(JSON.stringify(interception.response.body)).contains(email); -======= - - cy.wait("@loging").then((interception) => { - expect(interception.response.statusCode).equals(200); ->>>>>>> Stashed changes }); } ); From 1e52c237a374409b278ca7cd462493e984d113dd Mon Sep 17 00:00:00 2001 From: mahula Date: Fri, 3 Feb 2023 10:14:54 +0100 Subject: [PATCH 39/62] remove unnecessary dot-env file --- backend/.env.test_email | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 backend/.env.test_email diff --git a/backend/.env.test_email b/backend/.env.test_email deleted file mode 100644 index fba34833a..000000000 --- a/backend/.env.test_email +++ /dev/null @@ -1,5 +0,0 @@ -EMAIL=true -EMAIL_TEST_MODUS=false -EMAIL_TLS=false -# for testing password reset -EMAIL_CODE_REQUEST_TIME=1 From c1461ede98e612c0831930f4ad10e9a72c35ecfa Mon Sep 17 00:00:00 2001 From: mahula Date: Fri, 3 Feb 2023 10:33:38 +0100 Subject: [PATCH 40/62] uncomment all jobs in test workflow --- .github/workflows/test.yml | 747 ++++++++++++++++++------------------- 1 file changed, 370 insertions(+), 377 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bf6e6fc5f..34c49e12d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -60,28 +60,28 @@ jobs: ############################################################################## # JOB: DOCKER BUILD TEST BACKEND ############################################# ############################################################################## - # build_test_backend: - # name: Docker Build Test - Backend - # runs-on: ubuntu-latest - # #needs: [nothing] - # steps: - # ########################################################################## - # # CHECKOUT CODE ########################################################## - # ########################################################################## - # - name: Checkout code - # uses: actions/checkout@v3 - # ########################################################################## - # # BACKEND ################################################################ - # ########################################################################## - # - name: Backend | Build `test` image - # run: | - # docker build -f ./backend/Dockerfile --target test -t "gradido/backend:test" . - # docker save "gradido/backend:test" > /tmp/backend.tar - # - name: Upload Artifact - # uses: actions/upload-artifact@v3 - # with: - # name: docker-backend-test - # path: /tmp/backend.tar + build_test_backend: + name: Docker Build Test - Backend + runs-on: ubuntu-latest + #needs: [nothing] + steps: + ########################################################################## + # CHECKOUT CODE ########################################################## + ########################################################################## + - name: Checkout code + uses: actions/checkout@v3 + ########################################################################## + # BACKEND ################################################################ + ########################################################################## + - name: Backend | Build `test` image + run: | + docker build -f ./backend/Dockerfile --target test -t "gradido/backend:test" . + docker save "gradido/backend:test" > /tmp/backend.tar + - name: Upload Artifact + uses: actions/upload-artifact@v3 + with: + name: docker-backend-test + path: /tmp/backend.tar ############################################################################## # JOB: DOCKER BUILD TEST DATABASE UP ######################################### @@ -163,397 +163,397 @@ jobs: ############################################################################## # JOB: LOCALES FRONTEND ###################################################### ############################################################################## - # locales_frontend: - # name: Locales - Frontend - # runs-on: ubuntu-latest - # needs: [build_test_frontend] - # steps: - # ########################################################################## - # # CHECKOUT CODE ########################################################## - # ########################################################################## - # - name: Checkout code - # uses: actions/checkout@v3 - # ########################################################################## - # # DOWNLOAD DOCKER IMAGE ################################################## - # ########################################################################## - # - name: Download Docker Image (Frontend) - # uses: actions/download-artifact@v3 - # with: - # name: docker-frontend-test - # path: /tmp - # - name: Load Docker Image - # run: docker load < /tmp/frontend.tar - # ########################################################################## - # # LOCALES FRONTEND ####################################################### - # ########################################################################## - # - name: Frontend | Locales - # run: docker run --rm gradido/frontend:test yarn run locales + locales_frontend: + name: Locales - Frontend + runs-on: ubuntu-latest + needs: [build_test_frontend] + steps: + ########################################################################## + # CHECKOUT CODE ########################################################## + ########################################################################## + - name: Checkout code + uses: actions/checkout@v3 + ########################################################################## + # DOWNLOAD DOCKER IMAGE ################################################## + ########################################################################## + - name: Download Docker Image (Frontend) + uses: actions/download-artifact@v3 + with: + name: docker-frontend-test + path: /tmp + - name: Load Docker Image + run: docker load < /tmp/frontend.tar + ########################################################################## + # LOCALES FRONTEND ####################################################### + ########################################################################## + - name: Frontend | Locales + run: docker run --rm gradido/frontend:test yarn run locales ############################################################################## # JOB: LINT FRONTEND ######################################################### ############################################################################## - # lint_frontend: - # name: Lint - Frontend - # runs-on: ubuntu-latest - # needs: [build_test_frontend] - # steps: - # ########################################################################## - # # CHECKOUT CODE ########################################################## - # ########################################################################## - # - name: Checkout code - # uses: actions/checkout@v3 - # ########################################################################## - # # DOWNLOAD DOCKER IMAGE ################################################## - # ########################################################################## - # - name: Download Docker Image (Frontend) - # uses: actions/download-artifact@v3 - # with: - # name: docker-frontend-test - # path: /tmp - # - name: Load Docker Image - # run: docker load < /tmp/frontend.tar - # ########################################################################## - # # LINT FRONTEND ########################################################## - # ########################################################################## - # - name: Frontend | Lint - # run: docker run --rm gradido/frontend:test yarn run lint + lint_frontend: + name: Lint - Frontend + runs-on: ubuntu-latest + needs: [build_test_frontend] + steps: + ########################################################################## + # CHECKOUT CODE ########################################################## + ########################################################################## + - name: Checkout code + uses: actions/checkout@v3 + ########################################################################## + # DOWNLOAD DOCKER IMAGE ################################################## + ########################################################################## + - name: Download Docker Image (Frontend) + uses: actions/download-artifact@v3 + with: + name: docker-frontend-test + path: /tmp + - name: Load Docker Image + run: docker load < /tmp/frontend.tar + ########################################################################## + # LINT FRONTEND ########################################################## + ########################################################################## + - name: Frontend | Lint + run: docker run --rm gradido/frontend:test yarn run lint ############################################################################## # JOB: STYLELINT FRONTEND #################################################### ############################################################################## - # stylelint_frontend: - # name: Stylelint - Frontend - # runs-on: ubuntu-latest - # needs: [build_test_frontend] - # steps: - # ########################################################################## - # # CHECKOUT CODE ########################################################## - # ########################################################################## - # - name: Checkout code - # uses: actions/checkout@v3 - # ########################################################################## - # # DOWNLOAD DOCKER IMAGE ################################################## - # ########################################################################## - # - name: Download Docker Image (Frontend) - # uses: actions/download-artifact@v3 - # with: - # name: docker-frontend-test - # path: /tmp - # - name: Load Docker Image - # run: docker load < /tmp/frontend.tar - # ########################################################################## - # # STYLELINT FRONTEND ##################################################### - # ########################################################################## - # - name: Frontend | Stylelint - # run: docker run --rm gradido/frontend:test yarn run stylelint + stylelint_frontend: + name: Stylelint - Frontend + runs-on: ubuntu-latest + needs: [build_test_frontend] + steps: + ########################################################################## + # CHECKOUT CODE ########################################################## + ########################################################################## + - name: Checkout code + uses: actions/checkout@v3 + ########################################################################## + # DOWNLOAD DOCKER IMAGE ################################################## + ########################################################################## + - name: Download Docker Image (Frontend) + uses: actions/download-artifact@v3 + with: + name: docker-frontend-test + path: /tmp + - name: Load Docker Image + run: docker load < /tmp/frontend.tar + ########################################################################## + # STYLELINT FRONTEND ##################################################### + ########################################################################## + - name: Frontend | Stylelint + run: docker run --rm gradido/frontend:test yarn run stylelint ############################################################################## # JOB: LINT ADMIN INTERFACE ################################################## ############################################################################## - # lint_admin: - # name: Lint - Admin Interface - # runs-on: ubuntu-latest - # needs: [build_test_admin] - # steps: - # ########################################################################## - # # CHECKOUT CODE ########################################################## - # ########################################################################## - # - name: Checkout code - # uses: actions/checkout@v3 - # ########################################################################## - # # DOWNLOAD DOCKER IMAGE ################################################## - # ########################################################################## - # - name: Download Docker Image (Admin Interface) - # uses: actions/download-artifact@v3 - # with: - # name: docker-admin-test - # path: /tmp - # - name: Load Docker Image - # run: docker load < /tmp/admin.tar - # ########################################################################## - # # LINT ADMIN INTERFACE ################################################### - # ########################################################################## - # - name: Admin Interface | Lint - # run: docker run --rm gradido/admin:test yarn run lint + lint_admin: + name: Lint - Admin Interface + runs-on: ubuntu-latest + needs: [build_test_admin] + steps: + ########################################################################## + # CHECKOUT CODE ########################################################## + ########################################################################## + - name: Checkout code + uses: actions/checkout@v3 + ########################################################################## + # DOWNLOAD DOCKER IMAGE ################################################## + ########################################################################## + - name: Download Docker Image (Admin Interface) + uses: actions/download-artifact@v3 + with: + name: docker-admin-test + path: /tmp + - name: Load Docker Image + run: docker load < /tmp/admin.tar + ########################################################################## + # LINT ADMIN INTERFACE ################################################### + ########################################################################## + - name: Admin Interface | Lint + run: docker run --rm gradido/admin:test yarn run lint ############################################################################## - # JOB: STYLELINT ADMIN INTERFACE ############################################## + # JOB: STYLELINT ADMIN INTERFACE ############################################# ############################################################################## - # stylelint_admin: - # name: Stylelint - Admin Interface - # runs-on: ubuntu-latest - # needs: [build_test_admin] - # steps: - # ########################################################################## - # # CHECKOUT CODE ########################################################## - # ########################################################################## - # - name: Checkout code - # uses: actions/checkout@v3 - # ########################################################################## - # # DOWNLOAD DOCKER IMAGE ################################################## - # ########################################################################## - # - name: Download Docker Image (Admin Interface) - # uses: actions/download-artifact@v3 - # with: - # name: docker-admin-test - # path: /tmp - # - name: Load Docker Image - # run: docker load < /tmp/admin.tar - # ########################################################################## - # # STYLELINT ADMIN INTERFACE ############################################## - # ########################################################################## - # - name: Admin Interface | Stylelint - # run: docker run --rm gradido/admin:test yarn run stylelint + stylelint_admin: + name: Stylelint - Admin Interface + runs-on: ubuntu-latest + needs: [build_test_admin] + steps: + ########################################################################## + # CHECKOUT CODE ########################################################## + ########################################################################## + - name: Checkout code + uses: actions/checkout@v3 + ########################################################################## + # DOWNLOAD DOCKER IMAGE ################################################## + ########################################################################## + - name: Download Docker Image (Admin Interface) + uses: actions/download-artifact@v3 + with: + name: docker-admin-test + path: /tmp + - name: Load Docker Image + run: docker load < /tmp/admin.tar + ########################################################################## + # STYLELINT ADMIN INTERFACE ############################################## + ########################################################################## + - name: Admin Interface | Stylelint + run: docker run --rm gradido/admin:test yarn run stylelint ############################################################################## # JOB: LOCALES ADMIN ######################################################### ############################################################################## - # locales_admin: - # name: Locales - Admin Interface - # runs-on: ubuntu-latest - # needs: [build_test_admin] - # steps: - # ########################################################################## - # # CHECKOUT CODE ########################################################## - # ########################################################################## - # - name: Checkout code - # uses: actions/checkout@v3 - # ########################################################################## - # # DOWNLOAD DOCKER IMAGE ################################################## - # ########################################################################## - # - name: Download Docker Image (Admin Interface) - # uses: actions/download-artifact@v3 - # with: - # name: docker-admin-test - # path: /tmp - # - name: Load Docker Image - # run: docker load < /tmp/admin.tar - # ########################################################################## - # # LOCALES FRONTEND ####################################################### - # ########################################################################## - # - name: admin | Locales - # run: docker run --rm gradido/admin:test yarn run locales + locales_admin: + name: Locales - Admin Interface + runs-on: ubuntu-latest + needs: [build_test_admin] + steps: + ########################################################################## + # CHECKOUT CODE ########################################################## + ########################################################################## + - name: Checkout code + uses: actions/checkout@v3 + ########################################################################## + # DOWNLOAD DOCKER IMAGE ################################################## + ########################################################################## + - name: Download Docker Image (Admin Interface) + uses: actions/download-artifact@v3 + with: + name: docker-admin-test + path: /tmp + - name: Load Docker Image + run: docker load < /tmp/admin.tar + ########################################################################## + # LOCALES FRONTEND ####################################################### + ########################################################################## + - name: admin | Locales + run: docker run --rm gradido/admin:test yarn run locales ############################################################################## # JOB: LINT BACKEND ########################################################## ############################################################################## - # lint_backend: - # name: Lint - Backend - # runs-on: ubuntu-latest - # needs: [build_test_backend] - # steps: - # ########################################################################## - # # CHECKOUT CODE ########################################################## - # ########################################################################## - # - name: Checkout code - # uses: actions/checkout@v3 - # ########################################################################## - # # DOWNLOAD DOCKER IMAGE ################################################## - # ########################################################################## - # - name: Download Docker Image (Backend) - # uses: actions/download-artifact@v3 - # with: - # name: docker-backend-test - # path: /tmp - # - name: Load Docker Image - # run: docker load < /tmp/backend.tar - # ########################################################################## - # # LINT BACKEND ########################################################### - # ########################################################################## - # - name: backend | Lint - # run: docker run --rm gradido/backend:test yarn run lint + lint_backend: + name: Lint - Backend + runs-on: ubuntu-latest + needs: [build_test_backend] + steps: + ########################################################################## + # CHECKOUT CODE ########################################################## + ########################################################################## + - name: Checkout code + uses: actions/checkout@v3 + ########################################################################## + # DOWNLOAD DOCKER IMAGE ################################################## + ########################################################################## + - name: Download Docker Image (Backend) + uses: actions/download-artifact@v3 + with: + name: docker-backend-test + path: /tmp + - name: Load Docker Image + run: docker load < /tmp/backend.tar + ########################################################################## + # LINT BACKEND ########################################################### + ########################################################################## + - name: backend | Lint + run: docker run --rm gradido/backend:test yarn run lint ############################################################################## # JOB: LINT DATABASE UP ###################################################### ############################################################################## - # lint_database_up: - # name: Lint - Database Up - # runs-on: ubuntu-latest - # needs: [build_test_database_up] - # steps: - # ########################################################################## - # # CHECKOUT CODE ########################################################## - # ########################################################################## - # - name: Checkout code - # uses: actions/checkout@v3 - # ########################################################################## - # # DOWNLOAD DOCKER IMAGE ################################################## - # ########################################################################## - # - name: Download Docker Image (Backend) - # uses: actions/download-artifact@v3 - # with: - # name: docker-database-test_up - # path: /tmp - # - name: Load Docker Image - # run: docker load < /tmp/database_up.tar - # ########################################################################## - # # LINT DATABASE ########################################################## - # ########################################################################## - # - name: database | Lint - # run: docker run --rm gradido/database:test_up yarn run lint + lint_database_up: + name: Lint - Database Up + runs-on: ubuntu-latest + needs: [build_test_database_up] + steps: + ########################################################################## + # CHECKOUT CODE ########################################################## + ########################################################################## + - name: Checkout code + uses: actions/checkout@v3 + ########################################################################## + # DOWNLOAD DOCKER IMAGE ################################################## + ########################################################################## + - name: Download Docker Image (Backend) + uses: actions/download-artifact@v3 + with: + name: docker-database-test_up + path: /tmp + - name: Load Docker Image + run: docker load < /tmp/database_up.tar + ########################################################################## + # LINT DATABASE ########################################################## + ########################################################################## + - name: database | Lint + run: docker run --rm gradido/database:test_up yarn run lint ############################################################################## # JOB: UNIT TEST FRONTEND ################################################### ############################################################################## - # unit_test_frontend: - # name: Unit tests - Frontend - # runs-on: ubuntu-latest - # needs: [build_test_frontend] - # steps: - # ########################################################################## - # # CHECKOUT CODE ########################################################## - # ########################################################################## - # - name: Checkout code - # uses: actions/checkout@v3 - # ########################################################################## - # # DOWNLOAD DOCKER IMAGES ################################################# - # ########################################################################## - # - name: Download Docker Image (Frontend) - # uses: actions/download-artifact@v3 - # with: - # name: docker-frontend-test - # path: /tmp - # - name: Load Docker Image - # run: docker load < /tmp/frontend.tar - # ########################################################################## - # # UNIT TESTS FRONTEND #################################################### - # ########################################################################## - # - name: frontend | Unit tests - # run: | - # docker run --env NODE_ENV=test -v ~/coverage:/app/coverage --rm gradido/frontend:test yarn run test - # cp -r ~/coverage ./coverage - # ########################################################################## - # # COVERAGE REPORT FRONTEND ############################################### - # ########################################################################## - # #- name: frontend | Coverage report - # # uses: romeovs/lcov-reporter-action@v0.2.21 - # # with: - # # github-token: ${{ secrets.GITHUB_TOKEN }} - # # lcov-file: ./coverage/lcov.info - # ########################################################################## - # # COVERAGE CHECK FRONTEND ################################################ - # ########################################################################## - # - name: frontend | Coverage check - # uses: webcraftmedia/coverage-check-action@master - # with: - # report_name: Coverage Frontend - # type: lcov - # result_path: ./coverage/lcov.info - # min_coverage: 95 - # token: ${{ github.token }} + unit_test_frontend: + name: Unit tests - Frontend + runs-on: ubuntu-latest + needs: [build_test_frontend] + steps: + ########################################################################## + # CHECKOUT CODE ########################################################## + ########################################################################## + - name: Checkout code + uses: actions/checkout@v3 + ########################################################################## + # DOWNLOAD DOCKER IMAGES ################################################# + ########################################################################## + - name: Download Docker Image (Frontend) + uses: actions/download-artifact@v3 + with: + name: docker-frontend-test + path: /tmp + - name: Load Docker Image + run: docker load < /tmp/frontend.tar + ########################################################################## + # UNIT TESTS FRONTEND #################################################### + ########################################################################## + - name: frontend | Unit tests + run: | + docker run --env NODE_ENV=test -v ~/coverage:/app/coverage --rm gradido/frontend:test yarn run test + cp -r ~/coverage ./coverage + ########################################################################## + # COVERAGE REPORT FRONTEND ############################################### + ########################################################################## + #- name: frontend | Coverage report + # uses: romeovs/lcov-reporter-action@v0.2.21 + # with: + # github-token: ${{ secrets.GITHUB_TOKEN }} + # lcov-file: ./coverage/lcov.info + ########################################################################## + # COVERAGE CHECK FRONTEND ################################################ + ########################################################################## + - name: frontend | Coverage check + uses: webcraftmedia/coverage-check-action@master + with: + report_name: Coverage Frontend + type: lcov + result_path: ./coverage/lcov.info + min_coverage: 95 + token: ${{ github.token }} ############################################################################## # JOB: UNIT TEST ADMIN INTERFACE ############################################# ############################################################################## - # unit_test_admin: - # name: Unit tests - Admin Interface - # runs-on: ubuntu-latest - # needs: [build_test_admin] - # steps: - # ########################################################################## - # # CHECKOUT CODE ########################################################## - # ########################################################################## - # - name: Checkout code - # uses: actions/checkout@v3 - # ########################################################################## - # # DOWNLOAD DOCKER IMAGES ################################################# - # ########################################################################## - # - name: Download Docker Image (Admin Interface) - # uses: actions/download-artifact@v3 - # with: - # name: docker-admin-test - # path: /tmp - # - name: Load Docker Image - # run: docker load < /tmp/admin.tar - # ########################################################################## - # # UNIT TESTS ADMIN INTERFACE ############################################# - # ########################################################################## - # - name: Admin Interface | Unit tests - # run: | - # docker run -v ~/coverage:/app/coverage --rm gradido/admin:test yarn run test - # cp -r ~/coverage ./coverage - # ########################################################################## - # # COVERAGE CHECK ADMIN INTERFACE ######################################### - # ########################################################################## - # - name: Admin Interface | Coverage check - # uses: webcraftmedia/coverage-check-action@master - # with: - # report_name: Coverage Admin Interface - # type: lcov - # result_path: ./coverage/lcov.info - # min_coverage: 96 - # token: ${{ github.token }} + unit_test_admin: + name: Unit tests - Admin Interface + runs-on: ubuntu-latest + needs: [build_test_admin] + steps: + ########################################################################## + # CHECKOUT CODE ########################################################## + ########################################################################## + - name: Checkout code + uses: actions/checkout@v3 + ########################################################################## + # DOWNLOAD DOCKER IMAGES ################################################# + ########################################################################## + - name: Download Docker Image (Admin Interface) + uses: actions/download-artifact@v3 + with: + name: docker-admin-test + path: /tmp + - name: Load Docker Image + run: docker load < /tmp/admin.tar + ########################################################################## + # UNIT TESTS ADMIN INTERFACE ############################################# + ########################################################################## + - name: Admin Interface | Unit tests + run: | + docker run -v ~/coverage:/app/coverage --rm gradido/admin:test yarn run test + cp -r ~/coverage ./coverage + ########################################################################## + # COVERAGE CHECK ADMIN INTERFACE ######################################### + ########################################################################## + - name: Admin Interface | Coverage check + uses: webcraftmedia/coverage-check-action@master + with: + report_name: Coverage Admin Interface + type: lcov + result_path: ./coverage/lcov.info + min_coverage: 96 + token: ${{ github.token }} ############################################################################## # JOB: UNIT TEST BACKEND #################################################### ############################################################################## - # unit_test_backend: - # name: Unit tests - Backend - # runs-on: ubuntu-latest - # needs: [build_test_mariadb] - # steps: - # ########################################################################## - # # CHECKOUT CODE ########################################################## - # ########################################################################## - # - name: Checkout code - # uses: actions/checkout@v3 - # ########################################################################## - # # DOWNLOAD DOCKER IMAGES ################################################# - # ########################################################################## - # - name: Download Docker Image (Mariadb) - # uses: actions/download-artifact@v3 - # with: - # name: docker-mariadb-test - # path: /tmp - # - name: Load Docker Image - # run: docker load < /tmp/mariadb.tar - # ########################################################################## - # # UNIT TESTS BACKEND ##################################################### - # ########################################################################## - # - name: backend | docker-compose mariadb - # run: docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps mariadb - # - name: Sleep for 30 seconds - # run: sleep 30s - # shell: bash - # - name: backend | docker-compose database - # run: docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps database - # - name: backend Unit tests | test - # run: cd database && yarn && yarn build && cd ../backend && yarn && yarn test - # # run: docker-compose -f docker-compose.yml -f docker-compose.test.yml exec -T backend yarn test - # ########################################################################## - # # COVERAGE CHECK BACKEND ################################################# - # ########################################################################## - # - name: backend | Coverage check - # uses: webcraftmedia/coverage-check-action@master - # with: - # report_name: Coverage Backend - # type: lcov - # result_path: ./backend/coverage/lcov.info - # min_coverage: 78 - # token: ${{ github.token }} + unit_test_backend: + name: Unit tests - Backend + runs-on: ubuntu-latest + needs: [build_test_mariadb] + steps: + ########################################################################## + # CHECKOUT CODE ########################################################## + ########################################################################## + - name: Checkout code + uses: actions/checkout@v3 + ########################################################################## + # DOWNLOAD DOCKER IMAGES ################################################# + ########################################################################## + - name: Download Docker Image (Mariadb) + uses: actions/download-artifact@v3 + with: + name: docker-mariadb-test + path: /tmp + - name: Load Docker Image + run: docker load < /tmp/mariadb.tar + ########################################################################## + # UNIT TESTS BACKEND ##################################################### + ########################################################################## + - name: backend | docker-compose mariadb + run: docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps mariadb + - name: Sleep for 30 seconds + run: sleep 30s + shell: bash + - name: backend | docker-compose database + run: docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps database + - name: backend Unit tests | test + run: cd database && yarn && yarn build && cd ../backend && yarn && yarn test + # run: docker-compose -f docker-compose.yml -f docker-compose.test.yml exec -T backend yarn test + ########################################################################## + # COVERAGE CHECK BACKEND ################################################# + ########################################################################## + - name: backend | Coverage check + uses: webcraftmedia/coverage-check-action@master + with: + report_name: Coverage Backend + type: lcov + result_path: ./backend/coverage/lcov.info + min_coverage: 78 + token: ${{ github.token }} ########################################################################## # DATABASE MIGRATION TEST UP + RESET ##################################### ########################################################################## - # database_migration_test: - # name: Database Migration Test - Up + Reset - # runs-on: ubuntu-latest - # #needs: [nothing] - # steps: - # ########################################################################## - # # CHECKOUT CODE ########################################################## - # ########################################################################## - # - name: Checkout code - # uses: actions/checkout@v3 - # ########################################################################## - # # DOCKER COMPOSE DATABASE UP + RESET ##################################### - # ########################################################################## - # - name: database | docker-compose - # run: docker-compose -f docker-compose.yml up --detach mariadb - # - name: database | up - # run: docker-compose -f docker-compose.yml run -T database yarn up - # - name: database | reset - # run: docker-compose -f docker-compose.yml run -T database yarn reset + database_migration_test: + name: Database Migration Test - Up + Reset + runs-on: ubuntu-latest + #needs: [nothing] + steps: + ########################################################################## + # CHECKOUT CODE ########################################################## + ########################################################################## + - name: Checkout code + uses: actions/checkout@v3 + ########################################################################## + # DOCKER COMPOSE DATABASE UP + RESET ##################################### + ########################################################################## + - name: database | docker-compose + run: docker-compose -f docker-compose.yml up --detach mariadb + - name: database | up + run: docker-compose -f docker-compose.yml run -T database yarn up + - name: database | reset + run: docker-compose -f docker-compose.yml run -T database yarn reset ############################################################################## # JOB: END-TO-END TESTS ##################################################### @@ -585,13 +585,6 @@ jobs: path: /tmp - name: Load Docker Image (Database Up) run: docker load < /tmp/database_up.tar - # - name: Download Docker Image (Backend) - # uses: actions/download-artifact@v3 - # with: - # name: docker-backend-test - # path: /tmp - # - name: Load Docker Image (Backend) - # run: docker load < /tmp/backend.tar - name: Download Docker Image (Frontend) uses: actions/download-artifact@v3 with: From d3f8c22fdb5df3f8d72b0c00bd7b69084b36f4c5 Mon Sep 17 00:00:00 2001 From: mahula Date: Fri, 3 Feb 2023 14:43:06 +0100 Subject: [PATCH 41/62] straighten out the wording of the feature's focus Co-authored-by: Ulf Gebhardt --- .../tests/cypress/e2e/User.Authentication.ResetPassword.feature | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e-tests/cypress/tests/cypress/e2e/User.Authentication.ResetPassword.feature b/e2e-tests/cypress/tests/cypress/e2e/User.Authentication.ResetPassword.feature index 7722e636e..a2fd3b36a 100644 --- a/e2e-tests/cypress/tests/cypress/e2e/User.Authentication.ResetPassword.feature +++ b/e2e-tests/cypress/tests/cypress/e2e/User.Authentication.ResetPassword.feature @@ -1,6 +1,6 @@ Feature: User Authentication - reset password As a user - I want the option to reset my password from the sign in page + I want to reset my password from the sign in page # TODO for these pre-conditions utilize seeding or API check, if user exists in test system # Background: From a8a107628d8d9d370ee1a1f8f5b17dc14e2dc474 Mon Sep 17 00:00:00 2001 From: mahula Date: Fri, 3 Feb 2023 14:51:26 +0100 Subject: [PATCH 42/62] for more coherent reading of scenario's storyline change completely to the user as the actor --- .../tests/cypress/e2e/User.Authentication.ResetPassword.feature | 2 +- e2e-tests/cypress/tests/cypress/e2e/User.Authentication.feature | 2 +- e2e-tests/cypress/tests/cypress/e2e/User.Registration.feature | 2 +- .../tests/cypress/e2e/UserProfile.ChangePassword.feature | 2 +- .../tests/cypress/support/step_definitions/common_steps.ts | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/e2e-tests/cypress/tests/cypress/e2e/User.Authentication.ResetPassword.feature b/e2e-tests/cypress/tests/cypress/e2e/User.Authentication.ResetPassword.feature index a2fd3b36a..55ca87215 100644 --- a/e2e-tests/cypress/tests/cypress/e2e/User.Authentication.ResetPassword.feature +++ b/e2e-tests/cypress/tests/cypress/e2e/User.Authentication.ResetPassword.feature @@ -9,7 +9,7 @@ Feature: User Authentication - reset password # | bibi@bloxberg.de | Aa12345_ | Bibi Bloxberg | Scenario: Reset password from signin page successfully - Given the browser navigates to page "/login" + 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" And the user submits the e-mail form diff --git a/e2e-tests/cypress/tests/cypress/e2e/User.Authentication.feature b/e2e-tests/cypress/tests/cypress/e2e/User.Authentication.feature index e2c459692..3b460efc6 100644 --- a/e2e-tests/cypress/tests/cypress/e2e/User.Authentication.feature +++ b/e2e-tests/cypress/tests/cypress/e2e/User.Authentication.feature @@ -11,7 +11,7 @@ Feature: User authentication # | bibi@bloxberg.de | Aa12345_ | Bibi Bloxberg | Scenario: Log in successfully - Given the browser navigates to page "/login" + Given the user navigates to page "/login" When the user submits the credentials "bibi@bloxberg.de" "Aa12345_" Then the user is logged in with username "Bibi Bloxberg" diff --git a/e2e-tests/cypress/tests/cypress/e2e/User.Registration.feature b/e2e-tests/cypress/tests/cypress/e2e/User.Registration.feature index 9361d2b84..ed53bb4b0 100644 --- a/e2e-tests/cypress/tests/cypress/e2e/User.Registration.feature +++ b/e2e-tests/cypress/tests/cypress/e2e/User.Registration.feature @@ -4,7 +4,7 @@ Feature: User registration @skip Scenario: Register successfully - Given the browser navigates to page "/register" + Given the user navigates to page "/register" When the user fills name and email "Regina" "Register" "regina@register.com" And the user agrees to the privacy policy And the user submits the registration form diff --git a/e2e-tests/cypress/tests/cypress/e2e/UserProfile.ChangePassword.feature b/e2e-tests/cypress/tests/cypress/e2e/UserProfile.ChangePassword.feature index ceee131fb..aa853f6ff 100644 --- a/e2e-tests/cypress/tests/cypress/e2e/UserProfile.ChangePassword.feature +++ b/e2e-tests/cypress/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 browser navigates to page "/profile" + Given the user navigates to page "/profile" And the user opens the change password menu When the user fills the password form with: | Old password | Aa12345_ | diff --git a/e2e-tests/cypress/tests/cypress/support/step_definitions/common_steps.ts b/e2e-tests/cypress/tests/cypress/support/step_definitions/common_steps.ts index 42142380b..e2d66f76a 100644 --- a/e2e-tests/cypress/tests/cypress/support/step_definitions/common_steps.ts +++ b/e2e-tests/cypress/tests/cypress/support/step_definitions/common_steps.ts @@ -3,7 +3,7 @@ import { OverviewPage } from "../../e2e/models/OverviewPage"; import { SideNavMenu } from "../../e2e/models/SideNavMenu"; import { Toasts } from "../../e2e/models/Toasts"; -Given("the browser navigates to page {string}", (page: string) => { +Given("the user navigates to page {string}", (page: string) => { cy.visit(page); }); From b79a7a453632d11a3267174f988a0d6b84538256 Mon Sep 17 00:00:00 2001 From: mahula Date: Fri, 3 Feb 2023 15:04:13 +0100 Subject: [PATCH 43/62] remove whitespace from test workflow file --- .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 34c49e12d..c737f10f4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -625,7 +625,7 @@ jobs: - name: Sleep for 10 seconds run: sleep 10s - + - name: Boot up test system | seed backend run: | sudo chown runner:docker -R * From d2665583b51e593be1172ce3b75c088703b6263f Mon Sep 17 00:00:00 2001 From: mahula Date: Fri, 3 Feb 2023 15:28:52 +0100 Subject: [PATCH 44/62] set test workflow trigger back to push --- .github/workflows/test.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c737f10f4..04dbb8382 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,9 +1,6 @@ name: gradido test CI -on: - push: - branches: - - 2352-feat-user-story-user-authentication-reset-password +on: push jobs: ############################################################################## From e1bf7b20f4dbb7fcf65554892158829652e46118 Mon Sep 17 00:00:00 2001 From: mahula Date: Tue, 7 Feb 2023 07:53:12 +0100 Subject: [PATCH 45/62] set data-test attribute in forgot password page avoiding v-if --- frontend/src/pages/ForgotPassword.vue | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/frontend/src/pages/ForgotPassword.vue b/frontend/src/pages/ForgotPassword.vue index 70d578e10..a7cf81c71 100644 --- a/frontend/src/pages/ForgotPassword.vue +++ b/frontend/src/pages/ForgotPassword.vue @@ -24,20 +24,11 @@ -
From 2214ce90e42d3e40452cf2d18826dcc289a4d7da Mon Sep 17 00:00:00 2001 From: mahula Date: Tue, 7 Feb 2023 08:11:26 +0100 Subject: [PATCH 46/62] linting --- frontend/src/pages/ForgotPassword.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/pages/ForgotPassword.vue b/frontend/src/pages/ForgotPassword.vue index a7cf81c71..692f2da93 100644 --- a/frontend/src/pages/ForgotPassword.vue +++ b/frontend/src/pages/ForgotPassword.vue @@ -26,7 +26,7 @@ From 3beb5cad624bfb8dd2b650ae9b6116308c6e3300 Mon Sep 17 00:00:00 2001 From: mahula Date: Tue, 7 Feb 2023 08:11:26 +0100 Subject: [PATCH 47/62] linting --- frontend/src/pages/ForgotPassword.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/frontend/src/pages/ForgotPassword.vue b/frontend/src/pages/ForgotPassword.vue index 692f2da93..e014592ca 100644 --- a/frontend/src/pages/ForgotPassword.vue +++ b/frontend/src/pages/ForgotPassword.vue @@ -1,3 +1,4 @@ +