From 5fd87d139e0f7be937635ae66ffabd4deb205a8d Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Wed, 4 Sep 2024 11:47:35 +0200 Subject: [PATCH 1/7] add line to clear also ~/.cache/yarn --- deployment/bare_metal/start.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/deployment/bare_metal/start.sh b/deployment/bare_metal/start.sh index 634f60c97..12f9f71d0 100755 --- a/deployment/bare_metal/start.sh +++ b/deployment/bare_metal/start.sh @@ -140,6 +140,8 @@ envsubst "$(env | sed -e 's/=.*//' -e 's/^/\$/g')" < $NGINX_CONFIG_DIR/$TEMPLATE # Clean tmp folder - remove yarn files find /tmp -name "yarn--*" -exec rm -r {} \; +# Clean user cache folder +rm -Rf ~/.cache/yarn # Remove node_modules folders # we had problems with corrupted node_modules folder From a5356d260a08e78b6297174960248587db6ba1ca Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Wed, 4 Sep 2024 11:51:19 +0200 Subject: [PATCH 2/7] try to fix broken p2p test, broken because of default workrunner update --- .github/workflows/test_e2e.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test_e2e.yml b/.github/workflows/test_e2e.yml index 617097a53..590758248 100644 --- a/.github/workflows/test_e2e.yml +++ b/.github/workflows/test_e2e.yml @@ -11,17 +11,17 @@ jobs: uses: actions/checkout@v3 - name: Boot up test system | docker-compose mariadb - run: docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach mariadb + run: docker compose -f docker-compose.yml -f docker-compose.test.yml up --detach mariadb - name: Boot up test system | docker-compose database - run: docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps database + 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: | cd backend cp .env.test_e2e .env cd .. - docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps backend + docker compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps backend - name: Sleep for 10 seconds run: sleep 10s @@ -35,10 +35,10 @@ jobs: yarn && yarn seed - 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 + 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 mailserver - run: docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps mailserver + run: docker compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps mailserver - name: End-to-end tests | prepare run: | From 0e1fa84332daee57d510bd5f046cfcbafbf9728f Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Sat, 1 Feb 2025 11:46:37 +0100 Subject: [PATCH 3/7] use spy instead of mock which calls original function --- backend/src/emails/sendEmailVariants.test.ts | 30 ++++++++------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/backend/src/emails/sendEmailVariants.test.ts b/backend/src/emails/sendEmailVariants.test.ts index 76705deb9..ee36c3e9a 100644 --- a/backend/src/emails/sendEmailVariants.test.ts +++ b/backend/src/emails/sendEmailVariants.test.ts @@ -11,7 +11,7 @@ import { logger, i18n as localization } from '@test/testSetup' import { CONFIG } from '@/config' -import { sendEmailTranslated } from './sendEmailTranslated' +import * as sendEmailTranslatedApi from './sendEmailTranslated' import { sendAddedContributionMessageEmail, sendAccountActivationEmail, @@ -50,13 +50,7 @@ afterAll(async () => { await con.close() }) -jest.mock('./sendEmailTranslated', () => { - const originalModule = jest.requireActual('./sendEmailTranslated') - return { - __esModule: true, - sendEmailTranslated: jest.fn((a) => originalModule.sendEmailTranslated(a)), - } -}) +const sendEmailTranslatedSpy = jest.spyOn(sendEmailTranslatedApi, 'sendEmailTranslated') describe('sendEmailVariants', () => { // eslint-disable-next-line @typescript-eslint/no-explicit-any @@ -77,7 +71,7 @@ describe('sendEmailVariants', () => { describe('calls "sendEmailTranslated"', () => { it('with expected parameters', () => { - expect(sendEmailTranslated).toBeCalledWith({ + expect(sendEmailTranslatedSpy).toBeCalledWith({ receiver: { to: 'Peter Lustig ', }, @@ -131,7 +125,7 @@ describe('sendEmailVariants', () => { describe('calls "sendEmailTranslated"', () => { it('with expected parameters', () => { - expect(sendEmailTranslated).toBeCalledWith({ + expect(sendEmailTranslatedSpy).toBeCalledWith({ receiver: { to: 'Peter Lustig ', }, @@ -182,7 +176,7 @@ describe('sendEmailVariants', () => { describe('calls "sendEmailTranslated"', () => { it('with expected parameters', () => { - expect(sendEmailTranslated).toBeCalledWith({ + expect(sendEmailTranslatedSpy).toBeCalledWith({ receiver: { to: 'Peter Lustig ', }, @@ -235,7 +229,7 @@ describe('sendEmailVariants', () => { describe('calls "sendEmailTranslated"', () => { it('with expected parameters', () => { - expect(sendEmailTranslated).toBeCalledWith({ + expect(sendEmailTranslatedSpy).toBeCalledWith({ receiver: { to: 'Peter Lustig ', }, @@ -292,7 +286,7 @@ describe('sendEmailVariants', () => { describe('calls "sendEmailTranslated"', () => { it('with expected parameters', () => { - expect(sendEmailTranslated).toBeCalledWith({ + expect(sendEmailTranslatedSpy).toBeCalledWith({ receiver: { to: 'Peter Lustig ', }, @@ -348,7 +342,7 @@ describe('sendEmailVariants', () => { describe('calls "sendEmailTranslated"', () => { it('with expected parameters', () => { - expect(sendEmailTranslated).toBeCalledWith({ + expect(sendEmailTranslatedSpy).toBeCalledWith({ receiver: { to: 'Peter Lustig ', }, @@ -403,7 +397,7 @@ describe('sendEmailVariants', () => { describe('calls "sendEmailTranslated"', () => { it('with expected parameters', () => { - expect(sendEmailTranslated).toBeCalledWith({ + expect(sendEmailTranslatedSpy).toBeCalledWith({ receiver: { to: 'Peter Lustig ', }, @@ -457,7 +451,7 @@ describe('sendEmailVariants', () => { describe('calls "sendEmailTranslated"', () => { it('with expected parameters', () => { - expect(sendEmailTranslated).toBeCalledWith({ + expect(sendEmailTranslatedSpy).toBeCalledWith({ receiver: { to: 'Peter Lustig ', }, @@ -513,7 +507,7 @@ describe('sendEmailVariants', () => { describe('calls "sendEmailTranslated"', () => { it('with expected parameters', () => { - expect(sendEmailTranslated).toBeCalledWith({ + expect(sendEmailTranslatedSpy).toBeCalledWith({ receiver: { to: 'Peter Lustig ', }, @@ -572,7 +566,7 @@ describe('sendEmailVariants', () => { describe('calls "sendEmailTranslated"', () => { it('with expected parameters', () => { - expect(sendEmailTranslated).toBeCalledWith({ + expect(sendEmailTranslatedSpy).toBeCalledWith({ receiver: { to: 'Peter Lustig ', }, From 32cbdeb71451eb146742f47f08985bc0b07f9244 Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Sat, 1 Feb 2025 11:46:56 +0100 Subject: [PATCH 4/7] additional check --- backend/src/seeds/factory/user.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/backend/src/seeds/factory/user.ts b/backend/src/seeds/factory/user.ts index f0bda3a3f..8eb29348c 100644 --- a/backend/src/seeds/factory/user.ts +++ b/backend/src/seeds/factory/user.ts @@ -18,11 +18,17 @@ export const userFactory = async ( const homeCom = await writeHomeCommunityEntry() + const response = await mutate({ mutation: createUser, variables: user }) + if (!response?.data?.createUser) { + // eslint-disable-next-line no-console + console.log(response) + throw new Error('createUser mutation returned unexpected response') + } const { data: { createUser: { id }, }, - } = await mutate({ mutation: createUser, variables: user }) + } = response // get user from database let dbUser = await User.findOneOrFail({ where: { id }, relations: ['emailContact', 'userRoles'] }) From 18092cea9b0cdcb73fe3c4699be36f373a4c0999 Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Sat, 1 Feb 2025 12:00:40 +0100 Subject: [PATCH 5/7] lint --- backend/src/emails/sendEmailVariants.test.ts | 3 ++- backend/src/seeds/factory/user.ts | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/backend/src/emails/sendEmailVariants.test.ts b/backend/src/emails/sendEmailVariants.test.ts index ee36c3e9a..05d450770 100644 --- a/backend/src/emails/sendEmailVariants.test.ts +++ b/backend/src/emails/sendEmailVariants.test.ts @@ -11,7 +11,8 @@ import { logger, i18n as localization } from '@test/testSetup' import { CONFIG } from '@/config' -import * as sendEmailTranslatedApi from './sendEmailTranslated' +// eslint-disable-next-line import/no-namespace +import * as sendEmailTranslatedApi from './sendEmailTranslated' import { sendAddedContributionMessageEmail, sendAccountActivationEmail, diff --git a/backend/src/seeds/factory/user.ts b/backend/src/seeds/factory/user.ts index 8eb29348c..3e42ab86c 100644 --- a/backend/src/seeds/factory/user.ts +++ b/backend/src/seeds/factory/user.ts @@ -19,6 +19,7 @@ export const userFactory = async ( const homeCom = await writeHomeCommunityEntry() const response = await mutate({ mutation: createUser, variables: user }) + // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access if (!response?.data?.createUser) { // eslint-disable-next-line no-console console.log(response) From c73d5d4628c49f494ffebd4118ccb13e21355852 Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Sat, 1 Feb 2025 12:44:58 +0100 Subject: [PATCH 6/7] remove mailserver from docker test setup --- .github/workflows/test_backend.yml | 2 +- backend/src/emails/sendEmailTranslated.test.ts | 4 ++-- backend/src/emails/sendEmailVariants.test.ts | 15 +++++++++++++++ 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test_backend.yml b/.github/workflows/test_backend.yml index 96415cfff..8d1a8e2c4 100644 --- a/.github/workflows/test_backend.yml +++ b/.github/workflows/test_backend.yml @@ -44,7 +44,7 @@ jobs: uses: actions/checkout@v3 - name: Backend | docker-compose mariadb - run: docker compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps mariadb mailserver + 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 diff --git a/backend/src/emails/sendEmailTranslated.test.ts b/backend/src/emails/sendEmailTranslated.test.ts index c10c76a62..f38342985 100644 --- a/backend/src/emails/sendEmailTranslated.test.ts +++ b/backend/src/emails/sendEmailTranslated.test.ts @@ -23,11 +23,11 @@ jest.mock('nodemailer', () => { __esModule: true, createTransport: jest.fn(() => { return { - sendMail: jest.fn(() => { + sendMail: () => { return { messageId: 'message', } - }), + }, } }), } diff --git a/backend/src/emails/sendEmailVariants.test.ts b/backend/src/emails/sendEmailVariants.test.ts index 05d450770..88cd851d2 100644 --- a/backend/src/emails/sendEmailVariants.test.ts +++ b/backend/src/emails/sendEmailVariants.test.ts @@ -35,6 +35,21 @@ CONFIG.EMAIL_SMTP_HOST = testMailServerHost CONFIG.EMAIL_SMTP_PORT = testMailServerPort CONFIG.EMAIL_TLS = testMailTLS +jest.mock('nodemailer', () => { + return { + __esModule: true, + createTransport: jest.fn(() => { + return { + sendMail: () => { + return { + messageId: 'message', + } + }, + } + }), + } +}) + let con: Connection let testEnv: { mutate: ApolloServerTestClient['mutate'] From 81d6228b62a6fc04c7f721bc0353ab626e638a76 Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Thu, 6 Feb 2025 09:40:02 +0100 Subject: [PATCH 7/7] make content in emails darker --- .../sendEmailVariants.test.ts.snap | 52 +++++++++---------- .../src/emails/templates/includes/webflow.css | 2 +- 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/backend/src/emails/__snapshots__/sendEmailVariants.test.ts.snap b/backend/src/emails/__snapshots__/sendEmailVariants.test.ts.snap index 0e4e4ba7c..37263e937 100644 --- a/backend/src/emails/__snapshots__/sendEmailVariants.test.ts.snap +++ b/backend/src/emails/__snapshots__/sendEmailVariants.test.ts.snap @@ -146,11 +146,11 @@ exports[`sendEmailVariants sendAccountActivationEmail result has the correct htm

Complete registration

-
Please click here to complete the registration and activate your Gradido account.
Activate account -
Or copy the link into your browser window.
http://localhost/checkEmail/6627633878930542284 +
Please click here to complete the registration and activate your Gradido account.
Activate account +
Or copy the link into your browser window.
http://localhost/checkEmail/6627633878930542284

Request new valid link

-
The link has a validity of 23 hours and 30 minutes. +
The link has a validity of 23 hours and 30 minutes. If the validity of the link has already expired, you can have a new link sent to you here.
New link
@@ -323,10 +323,10 @@ exports[`sendEmailVariants sendAccountMultiRegistrationEmail calls "sendEmailTra

Reset password

-
If you have forgotten your password, please click here.
reset -
Or copy the link into your browser window.
http://localhost/forgot-password +
If you have forgotten your password, please click here.
reset +
Or copy the link into your browser window.
http://localhost/forgot-password

Contact support

-
If you did not try to register again, please contact our support:
support@supportmail.com +
If you did not try to register again, please contact our support:
support@supportmail.com

Kind regards,
your Gradido team @@ -496,8 +496,8 @@ exports[`sendEmailVariants sendAddedContributionMessageEmail result has the corr

Read and reply to message

-
To view and reply to the message, go to the “Creation” menu in your Gradido account and click on the “My contributions” tab.
To account -
Please do not reply to this email.
+
To view and reply to the message, go to the “Creation” menu in your Gradido account and click on the “My contributions” tab.
To account +
Please do not reply to this email.

Kind regards,
your Gradido team @@ -667,9 +667,9 @@ exports[`sendEmailVariants sendContributionChangedByModeratorEmail result has th

Contribution details

-
To see your common good contributions and related messages, go to the “Creation” menu in your Gradido account and click on the “My contributions” tab.
To account -
Or copy the link into your browser window.
http://localhost/community/contributions -
Please do not reply to this email.
+
To see your common good contributions and related messages, go to the “Creation” menu in your Gradido account and click on the “My contributions” tab.
To account +
Or copy the link into your browser window.
http://localhost/community/contributions +
Please do not reply to this email.

Kind regards,
your Gradido team @@ -839,9 +839,9 @@ exports[`sendEmailVariants sendContributionConfirmedEmail result has the correct

Contribution details

-
To see your common good contributions and related messages, go to the “Creation” menu in your Gradido account and click on the “My contributions” tab.
To account -
Or copy the link into your browser window.
http://localhost/community/contributions -
Please do not reply to this email.
+
To see your common good contributions and related messages, go to the “Creation” menu in your Gradido account and click on the “My contributions” tab.
To account +
Or copy the link into your browser window.
http://localhost/community/contributions +
Please do not reply to this email.

Kind regards,
your Gradido team @@ -1011,9 +1011,9 @@ exports[`sendEmailVariants sendContributionDeletedEmail result has the correct h

Contribution details

-
To see your common good contributions and related messages, go to the “Creation” menu in your Gradido account and click on the “My contributions” tab.
To account -
Or copy the link into your browser window.
http://localhost/community/contributions -
Please do not reply to this email.
+
To see your common good contributions and related messages, go to the “Creation” menu in your Gradido account and click on the “My contributions” tab.
To account +
Or copy the link into your browser window.
http://localhost/community/contributions +
Please do not reply to this email.

Kind regards,
your Gradido team @@ -1183,9 +1183,9 @@ exports[`sendEmailVariants sendContributionDeniedEmail result has the correct ht

Contribution details

-
To see your common good contributions and related messages, go to the “Creation” menu in your Gradido account and click on the “My contributions” tab.
To account -
Or copy the link into your browser window.
http://localhost/community/contributions -
Please do not reply to this email.
+
To see your common good contributions and related messages, go to the “Creation” menu in your Gradido account and click on the “My contributions” tab.
To account +
Or copy the link into your browser window.
http://localhost/community/contributions +
Please do not reply to this email.

Kind regards,
your Gradido team @@ -1355,11 +1355,11 @@ exports[`sendEmailVariants sendResetPasswordEmail result has the correct html as

Reset password

-
If it was you, please click here.
reset -
Or copy the link into your browser window.
http://localhost/reset-password/3762660021544901417 +
If it was you, please click here.
reset +
Or copy the link into your browser window.
http://localhost/reset-password/3762660021544901417

Request new valid link

-
The link has a validity of 23 hours and 30 minutes. +
The link has a validity of 23 hours and 30 minutes. If the validity of the link has already expired, you can have a new link sent to you here.
New link
@@ -1531,9 +1531,9 @@ exports[`sendEmailVariants sendTransactionLinkRedeemedEmail result has the corre

Transaction details

-
Amount: 17.65 GDD
Message: You deserve it! 🙏🏼
You can find transaction details in your Gradido account. +
Amount: 17.65 GDD
Message: You deserve it! 🙏🏼
You can find transaction details in your Gradido account.
To account -
Please do not reply to this email.
+
Please do not reply to this email.

Kind regards,
your Gradido team @@ -1705,7 +1705,7 @@ exports[`sendEmailVariants sendTransactionReceivedEmail result has the correct h

Message

-
Du bist schon lustiger ;)
+
Du bist schon lustiger ;)
diff --git a/backend/src/emails/templates/includes/webflow.css b/backend/src/emails/templates/includes/webflow.css index a78c0ed4f..45e4420c4 100644 --- a/backend/src/emails/templates/includes/webflow.css +++ b/backend/src/emails/templates/includes/webflow.css @@ -42,7 +42,7 @@ h2 { .p_content{ margin: 15px 0 15px 0; line-height: 26px; - color: #9ca0a8; + color: #696c72; } .clink {