From f58276b6556917002df825265d3829093ef0bea0 Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Sat, 28 Jun 2025 13:43:24 +0200 Subject: [PATCH 01/31] test java playwright test --- e2e-tests/.gitignore | 2 +- e2e-tests/playwright/Dockerfile | 42 ------------ e2e-tests/playwright/README.md | 24 ------- e2e-tests/playwright/java/Readme.md | 12 ++++ e2e-tests/playwright/java/pom.xml | 52 ++++++++++++++ .../java/net/gradido/e2e/base/BaseTest.java | 68 +++++++++++++++++++ .../net/gradido/e2e/components/Toasts.java | 29 ++++++++ .../java/net/gradido/e2e/pages/LoginPage.java | 28 ++++++++ .../net/gradido/e2e/tests/DashboardTests.java | 0 .../gradido/e2e/tests/InvalidLoginTest.java | 26 +++++++ .../net/gradido/e2e/tests/ValidLoginTest.java | 28 ++++++++ .../java/net/gradido/e2e/utils/TestUtil.java | 0 .../test/resources/junit-platform.properties | 5 ++ e2e-tests/playwright/tests/global-setup.ts | 10 --- .../playwright/tests/gradido_login.spec.ts | 15 ---- .../playwright/tests/models/login_page.ts | 33 --------- .../playwright/tests/models/welcome_page.ts | 13 ---- .../playwright/tests/playwright.config.ts | 21 ------ 18 files changed, 249 insertions(+), 159 deletions(-) delete mode 100644 e2e-tests/playwright/Dockerfile delete mode 100644 e2e-tests/playwright/README.md create mode 100644 e2e-tests/playwright/java/Readme.md create mode 100644 e2e-tests/playwright/java/pom.xml create mode 100644 e2e-tests/playwright/java/src/test/java/net/gradido/e2e/base/BaseTest.java create mode 100644 e2e-tests/playwright/java/src/test/java/net/gradido/e2e/components/Toasts.java create mode 100644 e2e-tests/playwright/java/src/test/java/net/gradido/e2e/pages/LoginPage.java create mode 100644 e2e-tests/playwright/java/src/test/java/net/gradido/e2e/tests/DashboardTests.java create mode 100644 e2e-tests/playwright/java/src/test/java/net/gradido/e2e/tests/InvalidLoginTest.java create mode 100644 e2e-tests/playwright/java/src/test/java/net/gradido/e2e/tests/ValidLoginTest.java create mode 100644 e2e-tests/playwright/java/src/test/java/net/gradido/e2e/utils/TestUtil.java create mode 100644 e2e-tests/playwright/java/src/test/resources/junit-platform.properties delete mode 100644 e2e-tests/playwright/tests/global-setup.ts delete mode 100644 e2e-tests/playwright/tests/gradido_login.spec.ts delete mode 100644 e2e-tests/playwright/tests/models/login_page.ts delete mode 100644 e2e-tests/playwright/tests/models/welcome_page.ts delete mode 100644 e2e-tests/playwright/tests/playwright.config.ts diff --git a/e2e-tests/.gitignore b/e2e-tests/.gitignore index 0d29725c0..405b844c5 100644 --- a/e2e-tests/.gitignore +++ b/e2e-tests/.gitignore @@ -3,4 +3,4 @@ cypress/screenshots/ cypress/videos/ cypress/reports/ cucumber-messages.ndjson - +**/target diff --git a/e2e-tests/playwright/Dockerfile b/e2e-tests/playwright/Dockerfile deleted file mode 100644 index c0dfbde47..000000000 --- a/e2e-tests/playwright/Dockerfile +++ /dev/null @@ -1,42 +0,0 @@ -############################################################################### -# Dockerfile to create a ready-to-use Playwright Docker image for end-to-end -# testing. -# -# To avoid hardcoded versoning of Playwright, this Dockerfile is a custom -# version of the ready-to-use Dockerfile privided by Playwright developement -# (https://github.com/microsoft/playwright/blob/main/utils/docker/Dockerfile.focal) -# -# Here the latest stable versions of the browsers Chromium, Firefox, and Webkit -# (Safari) are installed, icluding all dependencies based on Ubuntu specified by -# Playwright developement. -############################################################################### - -FROM ubuntu:focal - -# set a timezone for the Playwright browser dependency installation -ARG TZ=Europe/Berlin - -ARG DOCKER_WORKDIR=/tests/ -WORKDIR $DOCKER_WORKDIR - -# package manager preparation -RUN apt-get -qq update && apt-get install -qq -y curl gpg > /dev/null -# for Node.js -RUN curl -sL https://deb.nodesource.com/setup_16.x | bash - -# for Yarn -RUN curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \ - echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list - -# install node v16 and Yarn -RUN apt-get -qq update && apt-get install -qq -y nodejs yarn - -COPY tests/package.json tests/yarn.lock $DOCKER_WORKDIR - -# install Playwright with all dependencies -# for the browsers chromium, firefox, and webkit -RUN yarn install && yarn playwright install --with-deps - -# clean up -RUN rm -rf /var/lib/apt/lists/* && apt-get -qq clean - -COPY tests/ $DOCKER_WORKDIR diff --git a/e2e-tests/playwright/README.md b/e2e-tests/playwright/README.md deleted file mode 100644 index a3a2b34bb..000000000 --- a/e2e-tests/playwright/README.md +++ /dev/null @@ -1,24 +0,0 @@ -# Gradido End-to-End Testing with [Playwright](https://playwright.dev/) (CI-ready via Docker) - - -A sample setup to show-case Playwright (using Typescript) as an end-to-end testing tool for Gradido runniing in a Docker container. -Here we have a simple UI-based happy path login test running against the DEV system. - -## Precondition -Since dependencies and configurations for Github Actions integration is not set up yet, please run in root directory - -```bash -docker-compose up -``` - -to boot up the DEV system, before running the test. - -## Execute the test - -```bash -# build a Docker image from the Dockerfile -docker build -t gradido_e2e-tests-playwright . - -# run the Docker container and execute the given tests -docker run -it --network=host gradido_e2e-tests-playwright yarn playwright-e2e-tests -``` diff --git a/e2e-tests/playwright/java/Readme.md b/e2e-tests/playwright/java/Readme.md new file mode 100644 index 000000000..68aebae3d --- /dev/null +++ b/e2e-tests/playwright/java/Readme.md @@ -0,0 +1,12 @@ +# gradido-e2e-tests-playwright with java + +Experimental End-to-end tests with Playwright and Java + +## Prerequisites + +- Java 17 +- Maven +- Playwright +- Gradle +- Git + diff --git a/e2e-tests/playwright/java/pom.xml b/e2e-tests/playwright/java/pom.xml new file mode 100644 index 000000000..4e8b82d8c --- /dev/null +++ b/e2e-tests/playwright/java/pom.xml @@ -0,0 +1,52 @@ + + + 4.0.0 + net.gradido + gradido-e2e-tests-playwright + 0.0.1 + Gradido Playwright End-to-End Tests in Java + + UTF-8 + 17 + 17 + + + + com.microsoft.playwright + playwright + 1.52.0 + + + + org.junit.jupiter + junit-jupiter + 5.10.0 + test + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.10.1 + + + 17 + 17 + + + + org.apache.maven.plugins + maven-surefire-plugin + 3.0.0-M9 + + + **/*Test*.java + + + + + + \ No newline at end of file diff --git a/e2e-tests/playwright/java/src/test/java/net/gradido/e2e/base/BaseTest.java b/e2e-tests/playwright/java/src/test/java/net/gradido/e2e/base/BaseTest.java new file mode 100644 index 000000000..b3449e5b0 --- /dev/null +++ b/e2e-tests/playwright/java/src/test/java/net/gradido/e2e/base/BaseTest.java @@ -0,0 +1,68 @@ +package net.gradido.e2e.base; + +import com.microsoft.playwright.Browser; +import com.microsoft.playwright.BrowserContext; +import com.microsoft.playwright.Playwright; +import com.microsoft.playwright.Page; +import com.microsoft.playwright.Tracing; +import org.junit.jupiter.api.*; +import java.nio.file.Path; +import java.nio.file.Paths; + +// Subclasses will inherit PER_CLASS behavior. +@TestInstance(TestInstance.Lifecycle.PER_CLASS) +public class BaseTest { + protected Playwright playwright; + protected Browser browser; + + @BeforeAll + void setUpAll() { + playwright = Playwright.create(); + browser = playwright.chromium().launch(); + } + + @AfterAll + void tearDownAll() { + playwright.close(); + } + + // New instance for each test method. + protected BrowserContext context; + protected Page page; + protected Path currentTracePath; + + @BeforeEach + void setUp(TestInfo testInfo) { + context = browser.newContext( + new Browser.NewContextOptions().setBaseURL("http://localhost:3000") + ); + context.route("**/*", route -> { + String url = route.request().url(); + + // we skip fontawesome and googleapis requests, we don't need them for functions test, but they cost time + if (url.contains("use.fontawesome.com") || url.contains("fonts.googleapis.com")) { + route.abort(); + return; + } + route.resume(); + }); + + // Start tracing before creating + String testName = testInfo.getDisplayName().replaceAll("[^a-zA-Z0-9]", ""); + currentTracePath = Paths.get("target/traces/" + testName + ".zip"); + context.tracing().start(new Tracing.StartOptions() + .setScreenshots(true) + .setSnapshots(true) + .setSources(true)); + page = context.newPage(); + } + + @AfterEach + void tearDown() { + // Stop tracing and export it into a zip archive. + context.tracing().stop(new Tracing.StopOptions().setPath(currentTracePath)); + + page.close(); + context.close(); + } +} \ No newline at end of file diff --git a/e2e-tests/playwright/java/src/test/java/net/gradido/e2e/components/Toasts.java b/e2e-tests/playwright/java/src/test/java/net/gradido/e2e/components/Toasts.java new file mode 100644 index 000000000..6e95e95ef --- /dev/null +++ b/e2e-tests/playwright/java/src/test/java/net/gradido/e2e/components/Toasts.java @@ -0,0 +1,29 @@ +package net.gradido.e2e.components; + +import com.microsoft.playwright.Locator; +import com.microsoft.playwright.Page; + +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class Toasts { + private final Page page; + + public final Locator toastSlot; + public final Locator toastTypeError; + public final Locator toastTitle; + public final Locator toastMessage; + + public Toasts(Page page) { + this.page = page; + toastSlot = page.locator("#__BVID__toaster-container"); + toastTypeError = toastSlot.locator(".toast.text-bg-danger"); + toastTitle = toastTypeError.locator(".gdd-toaster-title"); + toastMessage = toastTypeError.locator(".gdd-toaster-body"); + } + + public void assertErrorToastVisible() { + toastTypeError.waitFor(); // auf Fehler-Toast warten + assertTrue(toastTitle.isVisible()); + assertTrue(toastMessage.isVisible()); + } +} diff --git a/e2e-tests/playwright/java/src/test/java/net/gradido/e2e/pages/LoginPage.java b/e2e-tests/playwright/java/src/test/java/net/gradido/e2e/pages/LoginPage.java new file mode 100644 index 000000000..091c346bf --- /dev/null +++ b/e2e-tests/playwright/java/src/test/java/net/gradido/e2e/pages/LoginPage.java @@ -0,0 +1,28 @@ +package net.gradido.e2e.pages; + +import com.microsoft.playwright.Locator; +import com.microsoft.playwright.Page; +import com.microsoft.playwright.Response; + +public class LoginPage { + private final Page page; + + private final Locator emailInput; + private final Locator passwordInput; + private final Locator submitButton; + + public LoginPage(Page page) { + this.page = page; + emailInput = page.locator("input[name='email']"); + passwordInput = page.locator("input[name='password']"); + submitButton = page.locator("button[type='submit']"); + } + + public void login(String email, String password) { + emailInput.fill(email); + passwordInput.fill(password); + Response response = page.waitForResponse("**/graphql", () -> { + submitButton.click(); + }); + } +} \ No newline at end of file diff --git a/e2e-tests/playwright/java/src/test/java/net/gradido/e2e/tests/DashboardTests.java b/e2e-tests/playwright/java/src/test/java/net/gradido/e2e/tests/DashboardTests.java new file mode 100644 index 000000000..e69de29bb diff --git a/e2e-tests/playwright/java/src/test/java/net/gradido/e2e/tests/InvalidLoginTest.java b/e2e-tests/playwright/java/src/test/java/net/gradido/e2e/tests/InvalidLoginTest.java new file mode 100644 index 000000000..b8168aaec --- /dev/null +++ b/e2e-tests/playwright/java/src/test/java/net/gradido/e2e/tests/InvalidLoginTest.java @@ -0,0 +1,26 @@ +package net.gradido.e2e.tests; + +import net.gradido.e2e.base.BaseTest; +import net.gradido.e2e.pages.LoginPage; +import net.gradido.e2e.components.Toasts; +import org.junit.jupiter.api.*; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class InvalidLoginTest extends BaseTest { + private LoginPage loginPage; + + @BeforeEach + void initPageObjects() { + loginPage = new LoginPage(page); + } + + @Test + void invalidUserSeesError() { + page.navigate("http://localhost:3000/login"); + loginPage.login("peter@lustig.de", "wrongpass"); + Toasts toast = new Toasts(page); + toast.assertErrorToastVisible(); + } +} \ No newline at end of file diff --git a/e2e-tests/playwright/java/src/test/java/net/gradido/e2e/tests/ValidLoginTest.java b/e2e-tests/playwright/java/src/test/java/net/gradido/e2e/tests/ValidLoginTest.java new file mode 100644 index 000000000..92f0e82fc --- /dev/null +++ b/e2e-tests/playwright/java/src/test/java/net/gradido/e2e/tests/ValidLoginTest.java @@ -0,0 +1,28 @@ +package net.gradido.e2e.tests; + +import net.gradido.e2e.base.BaseTest; +import net.gradido.e2e.pages.LoginPage; +import net.gradido.e2e.components.Toasts; + +import org.junit.jupiter.api.*; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class ValidLoginTest extends BaseTest { + private LoginPage loginPage; + + @BeforeEach + void initPageObjects() { + loginPage = new LoginPage(page); + } + + @Test + void validUserCanLogin() { + page.navigate("http://localhost:3000/login"); + loginPage.login("peter@lustig.de", "Aa12345_"); + page.waitForURL("http://localhost:3000/overview"); + assertTrue(page.url().contains("/overview")); + } +} + diff --git a/e2e-tests/playwright/java/src/test/java/net/gradido/e2e/utils/TestUtil.java b/e2e-tests/playwright/java/src/test/java/net/gradido/e2e/utils/TestUtil.java new file mode 100644 index 000000000..e69de29bb diff --git a/e2e-tests/playwright/java/src/test/resources/junit-platform.properties b/e2e-tests/playwright/java/src/test/resources/junit-platform.properties new file mode 100644 index 000000000..4570caf06 --- /dev/null +++ b/e2e-tests/playwright/java/src/test/resources/junit-platform.properties @@ -0,0 +1,5 @@ +junit.jupiter.execution.parallel.enabled = true +junit.jupiter.execution.parallel.mode.default = same_thread +junit.jupiter.execution.parallel.mode.classes.default = concurrent +junit.jupiter.execution.parallel.config.strategy=dynamic +junit.jupiter.execution.parallel.config.dynamic.factor=0.5 \ No newline at end of file diff --git a/e2e-tests/playwright/tests/global-setup.ts b/e2e-tests/playwright/tests/global-setup.ts deleted file mode 100644 index 1581a9aea..000000000 --- a/e2e-tests/playwright/tests/global-setup.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { FullConfig } from '@playwright/test'; - -async function globalSetup(config: FullConfig) { - process.env.EMAIL = 'bibi@bloxberg.de'; - process.env.PASSWORD = 'Aa12345_'; - process.env.GMS_ACTIVE = false; - process.env.HUMHUB_ACTIVE = false; -} - -export default globalSetup; diff --git a/e2e-tests/playwright/tests/gradido_login.spec.ts b/e2e-tests/playwright/tests/gradido_login.spec.ts deleted file mode 100644 index 0853780d1..000000000 --- a/e2e-tests/playwright/tests/gradido_login.spec.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { test, expect } from '@playwright/test'; -import { LoginPage } from './models/login_page'; -import { WelcomePage } from './models/welcome_page'; - - -test('Gradido login test (happy path)', async ({ page }) => { - const { EMAIL, PASSWORD } = process.env; - const loginPage = new LoginPage(page); - await loginPage.goto(); - await loginPage.enterEmail(EMAIL); - await loginPage.enterPassword(PASSWORD); - await loginPage.submitLogin(); - // assertions - await expect(page).toHaveURL('./overview'); -}); diff --git a/e2e-tests/playwright/tests/models/login_page.ts b/e2e-tests/playwright/tests/models/login_page.ts deleted file mode 100644 index 50abb4933..000000000 --- a/e2e-tests/playwright/tests/models/login_page.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { expect, test, Locator, Page } from '@playwright/test'; - -export class LoginPage { - readonly page: Page; - readonly url: string; - readonly emailInput: Locator; - readonly passwordInput: Locator; - readonly submitBtn: Locator; - - constructor(page: Page) { - this.page = page; - this.url = './login'; - this.emailInput = page.locator('id=Email-input-field'); - this.passwordInput = page.locator('id=Password-input-field'); - this.submitBtn = page.locator('text=Login'); - } - - async goto() { - await this.page.goto(this.url); - } - - async enterEmail(email: string) { - await this.emailInput.fill(email); - } - - async enterPassword(password: string) { - await this.passwordInput.fill(password); - } - - async submitLogin() { - await this.submitBtn.click(); - } -} diff --git a/e2e-tests/playwright/tests/models/welcome_page.ts b/e2e-tests/playwright/tests/models/welcome_page.ts deleted file mode 100644 index 81d73a771..000000000 --- a/e2e-tests/playwright/tests/models/welcome_page.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { expect, Locator, Page } from '@playwright/test'; - -export class WelcomePage { - readonly page: Page; - readonly url: string; - readonly profileLink: Locator; - - constructor(page: Page){ - this.page = page; - this.url = './overview'; - this.profileLink = page.locator('href=/profile'); - } -} diff --git a/e2e-tests/playwright/tests/playwright.config.ts b/e2e-tests/playwright/tests/playwright.config.ts deleted file mode 100644 index 13ea41d89..000000000 --- a/e2e-tests/playwright/tests/playwright.config.ts +++ /dev/null @@ -1,21 +0,0 @@ -import type { PlaywrightTestConfig } from '@playwright/test'; - -const config: PlaywrightTestConfig = { - globalSetup: require.resolve('./global-setup'), - ignoreHTTPSErrors: true, - locale: 'de-DE', - reporter: process.env.CI ? 'github' : 'list', - retries: 1, - screenshot: 'only-on-failure', - testDir: '.', - timeout: 30000, - trace: 'on-first-retry', - video: 'never', - viewport: { width: 1280, height: 720 }, - use: { - baseURL: process.env.URL || 'http://127.0.0.1:3000', - browserName: 'webkit', - - }, -}; -export default config; From bdb3b8f7a9cf8e768ab490e6a9d052be19c5a0f8 Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Sat, 28 Jun 2025 15:12:01 +0200 Subject: [PATCH 02/31] add typescript test, update java test --- .../java/net/gradido/e2e/base/BaseTest.java | 1 + .../net/gradido/e2e/components/Toasts.java | 5 +- .../java/net/gradido/e2e/pages/LoginPage.java | 4 + .../net/gradido/e2e/tests/DashboardTests.java | 0 .../gradido/e2e/tests/InvalidLoginTest.java | 2 +- .../net/gradido/e2e/tests/ValidLoginTest.java | 2 +- e2e-tests/playwright/typescript/.gitignore | 7 ++ .../typescript/components/Toasts.ts | 22 +++++ .../playwright/typescript/config/index.ts | 1 + e2e-tests/playwright/typescript/package.json | 13 +++ .../playwright/typescript/pages/LoginPage.ts | 28 +++++++ .../typescript/playwright.config.ts | 82 +++++++++++++++++++ .../typescript/tests/InvalidLoginTest.ts | 13 +++ .../typescript/tests/ValidLoginTest.ts | 11 +++ e2e-tests/playwright/typescript/yarn.lock | 41 ++++++++++ 15 files changed, 226 insertions(+), 6 deletions(-) delete mode 100644 e2e-tests/playwright/java/src/test/java/net/gradido/e2e/tests/DashboardTests.java create mode 100644 e2e-tests/playwright/typescript/.gitignore create mode 100644 e2e-tests/playwright/typescript/components/Toasts.ts create mode 100644 e2e-tests/playwright/typescript/config/index.ts create mode 100644 e2e-tests/playwright/typescript/package.json create mode 100644 e2e-tests/playwright/typescript/pages/LoginPage.ts create mode 100644 e2e-tests/playwright/typescript/playwright.config.ts create mode 100644 e2e-tests/playwright/typescript/tests/InvalidLoginTest.ts create mode 100644 e2e-tests/playwright/typescript/tests/ValidLoginTest.ts create mode 100644 e2e-tests/playwright/typescript/yarn.lock diff --git a/e2e-tests/playwright/java/src/test/java/net/gradido/e2e/base/BaseTest.java b/e2e-tests/playwright/java/src/test/java/net/gradido/e2e/base/BaseTest.java index b3449e5b0..fbf751f6c 100644 --- a/e2e-tests/playwright/java/src/test/java/net/gradido/e2e/base/BaseTest.java +++ b/e2e-tests/playwright/java/src/test/java/net/gradido/e2e/base/BaseTest.java @@ -12,6 +12,7 @@ import java.nio.file.Paths; // Subclasses will inherit PER_CLASS behavior. @TestInstance(TestInstance.Lifecycle.PER_CLASS) public class BaseTest { + protected Playwright playwright; protected Browser browser; diff --git a/e2e-tests/playwright/java/src/test/java/net/gradido/e2e/components/Toasts.java b/e2e-tests/playwright/java/src/test/java/net/gradido/e2e/components/Toasts.java index 6e95e95ef..2e59684b3 100644 --- a/e2e-tests/playwright/java/src/test/java/net/gradido/e2e/components/Toasts.java +++ b/e2e-tests/playwright/java/src/test/java/net/gradido/e2e/components/Toasts.java @@ -6,15 +6,12 @@ import com.microsoft.playwright.Page; import static org.junit.jupiter.api.Assertions.assertTrue; public class Toasts { - private final Page page; - public final Locator toastSlot; public final Locator toastTypeError; public final Locator toastTitle; public final Locator toastMessage; public Toasts(Page page) { - this.page = page; toastSlot = page.locator("#__BVID__toaster-container"); toastTypeError = toastSlot.locator(".toast.text-bg-danger"); toastTitle = toastTypeError.locator(".gdd-toaster-title"); @@ -22,7 +19,7 @@ public class Toasts { } public void assertErrorToastVisible() { - toastTypeError.waitFor(); // auf Fehler-Toast warten + toastTypeError.waitFor(); assertTrue(toastTitle.isVisible()); assertTrue(toastMessage.isVisible()); } diff --git a/e2e-tests/playwright/java/src/test/java/net/gradido/e2e/pages/LoginPage.java b/e2e-tests/playwright/java/src/test/java/net/gradido/e2e/pages/LoginPage.java index 091c346bf..1de1ba9f5 100644 --- a/e2e-tests/playwright/java/src/test/java/net/gradido/e2e/pages/LoginPage.java +++ b/e2e-tests/playwright/java/src/test/java/net/gradido/e2e/pages/LoginPage.java @@ -25,4 +25,8 @@ public class LoginPage { submitButton.click(); }); } + + public void navigate() { + page.navigate("http://localhost:3000/login"); + } } \ No newline at end of file diff --git a/e2e-tests/playwright/java/src/test/java/net/gradido/e2e/tests/DashboardTests.java b/e2e-tests/playwright/java/src/test/java/net/gradido/e2e/tests/DashboardTests.java deleted file mode 100644 index e69de29bb..000000000 diff --git a/e2e-tests/playwright/java/src/test/java/net/gradido/e2e/tests/InvalidLoginTest.java b/e2e-tests/playwright/java/src/test/java/net/gradido/e2e/tests/InvalidLoginTest.java index b8168aaec..5d9a70d5b 100644 --- a/e2e-tests/playwright/java/src/test/java/net/gradido/e2e/tests/InvalidLoginTest.java +++ b/e2e-tests/playwright/java/src/test/java/net/gradido/e2e/tests/InvalidLoginTest.java @@ -18,7 +18,7 @@ public class InvalidLoginTest extends BaseTest { @Test void invalidUserSeesError() { - page.navigate("http://localhost:3000/login"); + loginPage.navigate(); loginPage.login("peter@lustig.de", "wrongpass"); Toasts toast = new Toasts(page); toast.assertErrorToastVisible(); diff --git a/e2e-tests/playwright/java/src/test/java/net/gradido/e2e/tests/ValidLoginTest.java b/e2e-tests/playwright/java/src/test/java/net/gradido/e2e/tests/ValidLoginTest.java index 92f0e82fc..e9b3d4a50 100644 --- a/e2e-tests/playwright/java/src/test/java/net/gradido/e2e/tests/ValidLoginTest.java +++ b/e2e-tests/playwright/java/src/test/java/net/gradido/e2e/tests/ValidLoginTest.java @@ -19,7 +19,7 @@ public class ValidLoginTest extends BaseTest { @Test void validUserCanLogin() { - page.navigate("http://localhost:3000/login"); + loginPage.navigate(); loginPage.login("peter@lustig.de", "Aa12345_"); page.waitForURL("http://localhost:3000/overview"); assertTrue(page.url().contains("/overview")); diff --git a/e2e-tests/playwright/typescript/.gitignore b/e2e-tests/playwright/typescript/.gitignore new file mode 100644 index 000000000..58786aac7 --- /dev/null +++ b/e2e-tests/playwright/typescript/.gitignore @@ -0,0 +1,7 @@ + +# Playwright +node_modules/ +/test-results/ +/playwright-report/ +/blob-report/ +/playwright/.cache/ diff --git a/e2e-tests/playwright/typescript/components/Toasts.ts b/e2e-tests/playwright/typescript/components/Toasts.ts new file mode 100644 index 000000000..2cfc64f16 --- /dev/null +++ b/e2e-tests/playwright/typescript/components/Toasts.ts @@ -0,0 +1,22 @@ +import type { Locator, Page } from '@playwright/test' +import { expect } from '@playwright/test' + +export class Toasts { + public readonly toastSlot: Locator + public readonly toastTypeError: Locator + public readonly toastTitle: Locator + public readonly toastMessage: Locator + + constructor(page: Page) { + this.toastSlot = page.locator('#__BVID__toaster-container') + this.toastTypeError = this.toastSlot.locator('.toast.text-bg-danger') + this.toastTitle = this.toastTypeError.locator('.gdd-toaster-title') + this.toastMessage = this.toastTypeError.locator('.gdd-toaster-body') + } + + async assertErrorToastVisible(): Promise { + await this.toastTypeError.waitFor({ state: 'visible' }) + expect(this.toastTitle).toBeVisible() + expect(this.toastMessage).toBeVisible() + } +} diff --git a/e2e-tests/playwright/typescript/config/index.ts b/e2e-tests/playwright/typescript/config/index.ts new file mode 100644 index 000000000..0f62c6739 --- /dev/null +++ b/e2e-tests/playwright/typescript/config/index.ts @@ -0,0 +1 @@ +export const FRONTEND_URL = "http://localhost:3000" \ No newline at end of file diff --git a/e2e-tests/playwright/typescript/package.json b/e2e-tests/playwright/typescript/package.json new file mode 100644 index 000000000..66b8c8806 --- /dev/null +++ b/e2e-tests/playwright/typescript/package.json @@ -0,0 +1,13 @@ +{ + "name": "typescript", + "version": "1.0.0", + "main": "index.js", + "license": "MIT", + "devDependencies": { + "@playwright/test": "^1.53.1", + "@types/node": "^24.0.7" + }, + "scripts": { + "test": "playwright test --reporter=list" + } +} diff --git a/e2e-tests/playwright/typescript/pages/LoginPage.ts b/e2e-tests/playwright/typescript/pages/LoginPage.ts new file mode 100644 index 000000000..8a10c05c3 --- /dev/null +++ b/e2e-tests/playwright/typescript/pages/LoginPage.ts @@ -0,0 +1,28 @@ +import type { Locator, Page } from '@playwright/test' +import { FRONTEND_URL } from '../config' + +export class LoginPage { + readonly page: Page + readonly emailInput: Locator + readonly passwordInput: Locator + readonly submitButton: Locator + + constructor(page: Page) { + this.page = page + this.emailInput = page.locator('#email-input-field') + this.passwordInput = page.locator('#password-input-field') + this.submitButton = page.locator("button[type='submit']") + } + + async goto() { + await this.page.goto(`${FRONTEND_URL}/login`) + } + + async login(email: string, password: string) { + await this.emailInput.fill(email) + await this.passwordInput.fill(password) + const responsePromise = this.page.waitForResponse('**/graphql') + await this.submitButton.click() + await responsePromise + } +} \ No newline at end of file diff --git a/e2e-tests/playwright/typescript/playwright.config.ts b/e2e-tests/playwright/typescript/playwright.config.ts new file mode 100644 index 000000000..af1356ed4 --- /dev/null +++ b/e2e-tests/playwright/typescript/playwright.config.ts @@ -0,0 +1,82 @@ +import { defineConfig, devices } from '@playwright/test'; + +/** + * Read environment variables from file. + * https://github.com/motdotla/dotenv + */ +// import dotenv from 'dotenv'; +// import path from 'path'; +// dotenv.config({ path: path.resolve(__dirname, '.env') }); + +/** + * See https://playwright.dev/docs/test-configuration. + */ +export default defineConfig({ + testDir: './tests', + // Glob patterns or regular expressions that match test files. + testMatch: '*', + /* Run tests in files in parallel */ + fullyParallel: true, + /* Fail the build on CI if you accidentally left test.only in the source code. */ + forbidOnly: !!process.env.CI, + /* Retry on CI only */ + retries: 2, + /* Opt out of parallel tests on CI. */ + workers: process.env.CI ? '90%' : '75%', + /* Reporter to use. See https://playwright.dev/docs/test-reporters */ + reporter: 'html', + /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ + use: { + /* Base URL to use in actions like `await page.goto('/')`. */ + // baseURL: 'http://localhost:3000', + + /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ + trace: 'on-first-retry', + video: 'on-first-retry', + }, + + /* Configure projects for major browsers */ + projects: [ + { + name: 'chromium', + use: { ...devices['Desktop Chrome'] }, + }, + + { + name: 'firefox', + use: { ...devices['Desktop Firefox'] }, + }, + + { + name: 'webkit', + use: { ...devices['Desktop Safari'] }, + }, + + /* Test against mobile viewports. */ + // { + // name: 'Mobile Chrome', + // use: { ...devices['Pixel 5'] }, + // }, + // { + // name: 'Mobile Safari', + // use: { ...devices['iPhone 12'] }, + // }, + + /* Test against branded browsers. */ + // { + // name: 'Microsoft Edge', + // use: { ...devices['Desktop Edge'], channel: 'msedge' }, + // }, + // { + // name: 'Google Chrome', + // use: { ...devices['Desktop Chrome'], channel: 'chrome' }, + // }, + ], + + /* Run your local dev server before starting the tests */ + // webServer: { + // command: 'npm run start', + // url: 'http://localhost:3000', + // reuseExistingServer: !process.env.CI, + // }, +}); diff --git a/e2e-tests/playwright/typescript/tests/InvalidLoginTest.ts b/e2e-tests/playwright/typescript/tests/InvalidLoginTest.ts new file mode 100644 index 000000000..23747030c --- /dev/null +++ b/e2e-tests/playwright/typescript/tests/InvalidLoginTest.ts @@ -0,0 +1,13 @@ +import { test, expect } from '@playwright/test' +import { LoginPage } from '../pages/LoginPage' +import { Toasts } from '../components/Toasts' + +test('invalid login', async ({ page }) => { + const loginPage = new LoginPage(page) + await loginPage.goto() + await loginPage.login('peter@lustig.de', 'wrongpass') + + const toast = new Toasts(page) + await toast.assertErrorToastVisible() + await page.waitForTimeout(50) +}) \ No newline at end of file diff --git a/e2e-tests/playwright/typescript/tests/ValidLoginTest.ts b/e2e-tests/playwright/typescript/tests/ValidLoginTest.ts new file mode 100644 index 000000000..3380ba3c8 --- /dev/null +++ b/e2e-tests/playwright/typescript/tests/ValidLoginTest.ts @@ -0,0 +1,11 @@ +import { test, expect } from '@playwright/test' +import { LoginPage } from '../pages/LoginPage' +import { FRONTEND_URL } from '../config' + +test('valid login', async ({ page }) => { + const loginPage = new LoginPage(page) + await loginPage.goto() + await loginPage.login('peter@lustig.de', 'Aa12345_') + await page.waitForURL(`${FRONTEND_URL}/overview`) + expect(page.url()).toContain('/overview') +}) \ No newline at end of file diff --git a/e2e-tests/playwright/typescript/yarn.lock b/e2e-tests/playwright/typescript/yarn.lock new file mode 100644 index 000000000..0cd9b4a0a --- /dev/null +++ b/e2e-tests/playwright/typescript/yarn.lock @@ -0,0 +1,41 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +"@playwright/test@^1.53.1": + version "1.53.1" + resolved "https://registry.yarnpkg.com/@playwright/test/-/test-1.53.1.tgz#3ad5a2ce334b4a78390fd91e0a9d8423c09bc808" + integrity sha512-Z4c23LHV0muZ8hfv4jw6HngPJkbbtZxTkxPNIg7cJcTc9C28N/p2q7g3JZS2SiKBBHJ3uM1dgDye66bB7LEk5w== + dependencies: + playwright "1.53.1" + +"@types/node@^24.0.7": + version "24.0.7" + resolved "https://registry.yarnpkg.com/@types/node/-/node-24.0.7.tgz#ee580f7850c7eabaeef61ef96b8d8c04fdf94f53" + integrity sha512-YIEUUr4yf8q8oQoXPpSlnvKNVKDQlPMWrmOcgzoduo7kvA2UF0/BwJ/eMKFTiTtkNL17I0M6Xe2tvwFU7be6iw== + dependencies: + undici-types "~7.8.0" + +fsevents@2.3.2: + version "2.3.2" + resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a" + integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA== + +playwright-core@1.53.1: + version "1.53.1" + resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.53.1.tgz#0b6f7a2006ccb6126ffcc3e3b2fa9efda23b6638" + integrity sha512-Z46Oq7tLAyT0lGoFx4DOuB1IA9D1TPj0QkYxpPVUnGDqHHvDpCftu1J2hM2PiWsNMoZh8+LQaarAWcDfPBc6zg== + +playwright@1.53.1: + version "1.53.1" + resolved "https://registry.yarnpkg.com/playwright/-/playwright-1.53.1.tgz#86fb041b237a6868d163c87c4b9737fd1cac145e" + integrity sha512-LJ13YLr/ocweuwxyGf1XNFWIU4M2zUSo149Qbp+A4cpwDjsxRPj7k6H25LBrEHiEwxvRbD8HdwvQmRMSvquhYw== + dependencies: + playwright-core "1.53.1" + optionalDependencies: + fsevents "2.3.2" + +undici-types@~7.8.0: + version "7.8.0" + resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-7.8.0.tgz#de00b85b710c54122e44fbfd911f8d70174cd294" + integrity sha512-9UJ2xGDvQ43tYyVMpuHlsgApydB8ZKfVYTsLDhXkFL/6gfkp+U8xTGdh8pMJv1SpZna0zxG1DwsKZsreLbXBxw== From 6a4ddb07079ed2f3b6d391c5cc42c457eac7443e Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Sat, 28 Jun 2025 15:21:25 +0200 Subject: [PATCH 03/31] test playwright test in github ci --- .github/workflows/test_e2e.yml | 67 ++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/.github/workflows/test_e2e.yml b/.github/workflows/test_e2e.yml index 50de7090b..9c120c4cf 100644 --- a/.github/workflows/test_e2e.yml +++ b/.github/workflows/test_e2e.yml @@ -106,3 +106,70 @@ jobs: with: name: backend-logs-pr-#${{ steps.pr.outputs.number }} path: /home/runner/work/gradido/gradido/logs/backend + + end-to-end-tests-playwright: + name: End-to-End Tests Playwright + runs-on: ubuntu-22.04 + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set Node.js version + uses: actions/setup-node@v4 + with: + node-version: '18.20.7' + + - name: install bun + uses: oven-sh/setup-bun@v2 + + - name: Boot up test system | docker-compose mariadb mailserver + run: docker compose -f docker-compose.yml -f docker-compose.test.yml up --detach mariadb mailserver + + - name: Prepare test system + run: | + sudo chown runner:docker -R * + bun install + sudo cp ./nginx/e2e-test.conf /etc/nginx/sites-available/default + + - name: Boot up test system | seed backend + run: bun turbo seed + + - name: Moving logs after seeding + run: | + mkdir -p /home/runner/work/gradido/gradido/logs/backend/seed + mv /home/runner/work/gradido/gradido/logs/backend/*.log /home/runner/work/gradido/gradido/logs/backend/seed/ + + - name: Boot up test system | docker-compose backend, frontend + run: | + cd backend + cp .env.test_e2e .env + cd .. + bun turbo backend#build + bun turbo frontend#build + bun turbo backend#start frontend#start --env-mode=loose & + + - name: End-to-end tests | prepare + run: | + cd e2e-tests/playwright/typescript + bun install + + - name: wait for frontend and backend to be ready + run: | + until nc -z 127.0.0.1 3000; do echo waiting for frontend; sleep 1; done; + until nc -z 127.0.0.1 4000; do echo waiting for backend; sleep 1; done; + + - name: Start local nginx webserver + run: | + sudo nginx -t + sudo systemctl start nginx + + - name: wait for nginx and mailserver to be ready + run: | + until nc -z 127.0.0.1 80; do echo waiting for nginx; sleep 1; done; + until nc -z 127.0.0.1 1025; do echo waiting for mailserver; sleep 1; done; + + - name: End-to-end tests | run tests + id: e2e-tests + run: | + cd e2e-tests/playwright/typescript + bun run test From 2819047dca69d2a5a99ec5908acdbbc183b9d88c Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Sat, 28 Jun 2025 15:25:16 +0200 Subject: [PATCH 04/31] =?UTF-8?q?install=20browsers=20f=C3=BCr=20playwrigh?= =?UTF-8?q?t?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/test_e2e.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/test_e2e.yml b/.github/workflows/test_e2e.yml index 9c120c4cf..f9bcc03c7 100644 --- a/.github/workflows/test_e2e.yml +++ b/.github/workflows/test_e2e.yml @@ -152,6 +152,9 @@ jobs: run: | cd e2e-tests/playwright/typescript bun install + + - name: Install Playwright Browsers + run: npx playwright install --with-deps - name: wait for frontend and backend to be ready run: | From 779c28e725a897762111da0c2943174ffda830ba Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Sat, 28 Jun 2025 15:27:55 +0200 Subject: [PATCH 05/31] add java test ci --- .github/workflows/test_e2e.yml | 77 ++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) diff --git a/.github/workflows/test_e2e.yml b/.github/workflows/test_e2e.yml index f9bcc03c7..7d2ccaa92 100644 --- a/.github/workflows/test_e2e.yml +++ b/.github/workflows/test_e2e.yml @@ -176,3 +176,80 @@ jobs: run: | cd e2e-tests/playwright/typescript bun run test + + end-to-end-tests-playwright-java: + name: End-to-End Tests Playwright java + runs-on: ubuntu-22.04 + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set Node.js version + uses: actions/setup-node@v4 + with: + node-version: '18.20.7' + + - uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '17' + + - name: install bun + uses: oven-sh/setup-bun@v2 + + - name: Boot up test system | docker-compose mariadb mailserver + run: docker compose -f docker-compose.yml -f docker-compose.test.yml up --detach mariadb mailserver + + - name: Prepare test system + run: | + sudo chown runner:docker -R * + bun install + sudo cp ./nginx/e2e-test.conf /etc/nginx/sites-available/default + + - name: Boot up test system | seed backend + run: bun turbo seed + + - name: Moving logs after seeding + run: | + mkdir -p /home/runner/work/gradido/gradido/logs/backend/seed + mv /home/runner/work/gradido/gradido/logs/backend/*.log /home/runner/work/gradido/gradido/logs/backend/seed/ + + - name: Boot up test system | docker-compose backend, frontend + run: | + cd backend + cp .env.test_e2e .env + cd .. + bun turbo backend#build + bun turbo frontend#build + bun turbo backend#start frontend#start --env-mode=loose & + + - name: End-to-end tests | prepare + run: | + cd e2e-tests/playwright/typescript + bun install + + - name: Install Playwright Browsers + run: npx playwright install --with-deps + + - name: wait for frontend and backend to be ready + run: | + until nc -z 127.0.0.1 3000; do echo waiting for frontend; sleep 1; done; + until nc -z 127.0.0.1 4000; do echo waiting for backend; sleep 1; done; + + - name: Start local nginx webserver + run: | + sudo nginx -t + sudo systemctl start nginx + + - name: wait for nginx and mailserver to be ready + run: | + until nc -z 127.0.0.1 80; do echo waiting for nginx; sleep 1; done; + until nc -z 127.0.0.1 1025; do echo waiting for mailserver; sleep 1; done; + + - name: End-to-end tests | run tests + id: e2e-tests + run: | + cd e2e-tests/playwright/java + mvn -B install -D skipTests --no-transfer-progress + mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="install --with-deps" + mvn test \ No newline at end of file From 972c09f8fb06f02ccca50ed7d3b46904c1a86762 Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Sat, 28 Jun 2025 15:29:15 +0200 Subject: [PATCH 06/31] use crypto worker for password, running multiple test in parallel really need it --- backend/.env.test_e2e | 1 + 1 file changed, 1 insertion(+) diff --git a/backend/.env.test_e2e b/backend/.env.test_e2e index 62abb975d..e7f3a29c8 100644 --- a/backend/.env.test_e2e +++ b/backend/.env.test_e2e @@ -4,6 +4,7 @@ JWT_EXPIRES_IN=2m GDT_ACTIVE=false HUMHUB_ACTIVE=false GMS_ACTIVE=false +USE_CRYPTO_WORKER=true # Email EMAIL=true From e92d14b0f9a115147c5e7ef22b6d1aa2911b4b39 Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Sat, 28 Jun 2025 15:48:45 +0200 Subject: [PATCH 07/31] upload results on failure --- .github/workflows/test_e2e.yml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test_e2e.yml b/.github/workflows/test_e2e.yml index 7d2ccaa92..b7a4ca0b6 100644 --- a/.github/workflows/test_e2e.yml +++ b/.github/workflows/test_e2e.yml @@ -152,9 +152,7 @@ jobs: run: | cd e2e-tests/playwright/typescript bun install - - - name: Install Playwright Browsers - run: npx playwright install --with-deps + npx playwright install - name: wait for frontend and backend to be ready run: | @@ -176,6 +174,14 @@ jobs: run: | cd e2e-tests/playwright/typescript bun run test + + - name: End-to-end tests | if tests failed, upload video + id: e2e-video + if: ${{ failure() && steps.e2e-tests.conclusion == 'failure' }} + uses: actions/upload-artifact@v4 + with: + name: cypress-videos-pr-#${{ steps.pr.outputs.number }} + path: /home/runner/work/gradido/gradido/e2e-tests/playwright/typescript/test-results end-to-end-tests-playwright-java: name: End-to-End Tests Playwright java @@ -228,9 +234,6 @@ jobs: cd e2e-tests/playwright/typescript bun install - - name: Install Playwright Browsers - run: npx playwright install --with-deps - - name: wait for frontend and backend to be ready run: | until nc -z 127.0.0.1 3000; do echo waiting for frontend; sleep 1; done; From 2edb1709d2326ed72a04d32670cc7becad0b15f3 Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Sat, 28 Jun 2025 15:52:39 +0200 Subject: [PATCH 08/31] fix deps --- .github/workflows/test_e2e.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_e2e.yml b/.github/workflows/test_e2e.yml index b7a4ca0b6..3fe481a5e 100644 --- a/.github/workflows/test_e2e.yml +++ b/.github/workflows/test_e2e.yml @@ -152,7 +152,7 @@ jobs: run: | cd e2e-tests/playwright/typescript bun install - npx playwright install + npx playwright install --with-deps - name: wait for frontend and backend to be ready run: | From 3ddd7e5c5899239f6d237fe0dc3f3509b3d14f55 Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Sat, 28 Jun 2025 16:10:44 +0200 Subject: [PATCH 09/31] use test config for frontend, safari don't like 0.0.0.0 --- .github/workflows/test_e2e.yml | 4 +++- frontend/.env.test_e2e | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 frontend/.env.test_e2e diff --git a/.github/workflows/test_e2e.yml b/.github/workflows/test_e2e.yml index 3fe481a5e..4a89afaf0 100644 --- a/.github/workflows/test_e2e.yml +++ b/.github/workflows/test_e2e.yml @@ -141,7 +141,9 @@ jobs: - name: Boot up test system | docker-compose backend, frontend run: | - cd backend + cd frontend + cp .env.test_e2e .env + cd ../backend cp .env.test_e2e .env cd .. bun turbo backend#build diff --git a/frontend/.env.test_e2e b/frontend/.env.test_e2e new file mode 100644 index 000000000..c4a8a666d --- /dev/null +++ b/frontend/.env.test_e2e @@ -0,0 +1 @@ +GRAPHQL_URI=http://localhost:4000/graphql \ No newline at end of file From c452dfcc215071369d7631a9503a924ff64dbd74 Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Sat, 28 Jun 2025 16:42:07 +0200 Subject: [PATCH 10/31] use only installed browser chrome on ci --- .github/workflows/test_e2e.yml | 5 +---- e2e-tests/playwright/typescript/playwright.config.ts | 8 ++++---- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/.github/workflows/test_e2e.yml b/.github/workflows/test_e2e.yml index 4a89afaf0..b2e0d4315 100644 --- a/.github/workflows/test_e2e.yml +++ b/.github/workflows/test_e2e.yml @@ -146,15 +146,12 @@ jobs: cd ../backend cp .env.test_e2e .env cd .. - bun turbo backend#build - bun turbo frontend#build bun turbo backend#start frontend#start --env-mode=loose & - name: End-to-end tests | prepare run: | cd e2e-tests/playwright/typescript bun install - npx playwright install --with-deps - name: wait for frontend and backend to be ready run: | @@ -175,7 +172,7 @@ jobs: id: e2e-tests run: | cd e2e-tests/playwright/typescript - bun run test + bun run test --project="Google Chrome" - name: End-to-end tests | if tests failed, upload video id: e2e-video diff --git a/e2e-tests/playwright/typescript/playwright.config.ts b/e2e-tests/playwright/typescript/playwright.config.ts index af1356ed4..1418b5af9 100644 --- a/e2e-tests/playwright/typescript/playwright.config.ts +++ b/e2e-tests/playwright/typescript/playwright.config.ts @@ -67,10 +67,10 @@ export default defineConfig({ // name: 'Microsoft Edge', // use: { ...devices['Desktop Edge'], channel: 'msedge' }, // }, - // { - // name: 'Google Chrome', - // use: { ...devices['Desktop Chrome'], channel: 'chrome' }, - // }, + { + name: 'Google Chrome', + use: { ...devices['Desktop Chrome'], channel: 'chrome' }, + }, ], /* Run your local dev server before starting the tests */ From e33e3fc0464089ecbf33a6cfbc33a6eb5c529b3b Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Sat, 28 Jun 2025 16:49:47 +0200 Subject: [PATCH 11/31] try to use mysql already installed in testrunner --- .github/workflows/test_e2e.yml | 5 ++++- backend/.env.test_e2e | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test_e2e.yml b/.github/workflows/test_e2e.yml index b2e0d4315..7ab8b1fcf 100644 --- a/.github/workflows/test_e2e.yml +++ b/.github/workflows/test_e2e.yml @@ -123,7 +123,10 @@ jobs: uses: oven-sh/setup-bun@v2 - name: Boot up test system | docker-compose mariadb mailserver - run: docker compose -f docker-compose.yml -f docker-compose.test.yml up --detach mariadb mailserver + run: docker compose -f docker-compose.yml -f docker-compose.test.yml up --detach mailserver + + - name: Start mysql + run: sudo systemctl start mysql.service - name: Prepare test system run: | diff --git a/backend/.env.test_e2e b/backend/.env.test_e2e index e7f3a29c8..753d21905 100644 --- a/backend/.env.test_e2e +++ b/backend/.env.test_e2e @@ -6,6 +6,10 @@ HUMHUB_ACTIVE=false GMS_ACTIVE=false USE_CRYPTO_WORKER=true +# DB +DB_USER=root +DB_PASSWORD=root + # Email EMAIL=true EMAIL_TEST_MODUS=false From 00ec4c5a648670dbc6e5032e439ee799623eca15 Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Sat, 28 Jun 2025 16:53:33 +0200 Subject: [PATCH 12/31] db host --- backend/.env.test_e2e | 3 +++ 1 file changed, 3 insertions(+) diff --git a/backend/.env.test_e2e b/backend/.env.test_e2e index 753d21905..d3c42238b 100644 --- a/backend/.env.test_e2e +++ b/backend/.env.test_e2e @@ -9,6 +9,9 @@ USE_CRYPTO_WORKER=true # DB DB_USER=root DB_PASSWORD=root +DB_HOST=127.0.0.1 +DB_PORT=3306 +DB_DATABASE=gradido_community # Email EMAIL=true From 59e79dd8469fb9b2b9eff58b072be6b6ebda3b67 Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Sat, 28 Jun 2025 17:09:27 +0200 Subject: [PATCH 13/31] adjustments --- .github/workflows/test_e2e.yml | 14 ++++++++------ frontend/.env.test_e2e | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test_e2e.yml b/.github/workflows/test_e2e.yml index 7ab8b1fcf..0414af0ca 100644 --- a/.github/workflows/test_e2e.yml +++ b/.github/workflows/test_e2e.yml @@ -135,7 +135,13 @@ jobs: sudo cp ./nginx/e2e-test.conf /etc/nginx/sites-available/default - name: Boot up test system | seed backend - run: bun turbo seed + run: | + cd frontend + cp .env.test_e2e .env + cd ../backend + cp .env.test_e2e .env + cd .. + bun turbo seed --env-mode=loose - name: Moving logs after seeding run: | @@ -144,11 +150,7 @@ jobs: - name: Boot up test system | docker-compose backend, frontend run: | - cd frontend - cp .env.test_e2e .env - cd ../backend - cp .env.test_e2e .env - cd .. + bun turbo backend#build frontend#build --env-mode=loose bun turbo backend#start frontend#start --env-mode=loose & - name: End-to-end tests | prepare diff --git a/frontend/.env.test_e2e b/frontend/.env.test_e2e index c4a8a666d..fb85151cb 100644 --- a/frontend/.env.test_e2e +++ b/frontend/.env.test_e2e @@ -1 +1 @@ -GRAPHQL_URI=http://localhost:4000/graphql \ No newline at end of file +GRAPHQL_URI=http://127.0.0.1:4000/graphql \ No newline at end of file From fc693967acc727b8659f7401b1eedd0e587f7a8a Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Sat, 28 Jun 2025 17:14:01 +0200 Subject: [PATCH 14/31] additional db .env --- .github/workflows/test_e2e.yml | 2 ++ database/.env.test_e2e | 7 +++++++ 2 files changed, 9 insertions(+) create mode 100644 database/.env.test_e2e diff --git a/.github/workflows/test_e2e.yml b/.github/workflows/test_e2e.yml index 0414af0ca..14ee92e67 100644 --- a/.github/workflows/test_e2e.yml +++ b/.github/workflows/test_e2e.yml @@ -140,6 +140,8 @@ jobs: cp .env.test_e2e .env cd ../backend cp .env.test_e2e .env + cd ../database + cp .env.test_e2e .env cd .. bun turbo seed --env-mode=loose diff --git a/database/.env.test_e2e b/database/.env.test_e2e new file mode 100644 index 000000000..a49aa39a0 --- /dev/null +++ b/database/.env.test_e2e @@ -0,0 +1,7 @@ + +# DB +DB_USER=root +DB_PASSWORD=root +DB_HOST=127.0.0.1 +DB_PORT=3306 +DB_DATABASE=gradido_community From 61196fe1e17e602bf39d4fd6eae3385baeff5496 Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Sat, 28 Jun 2025 17:26:04 +0200 Subject: [PATCH 15/31] try fix mysql --- .github/workflows/test_e2e.yml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test_e2e.yml b/.github/workflows/test_e2e.yml index 14ee92e67..e73f56b6e 100644 --- a/.github/workflows/test_e2e.yml +++ b/.github/workflows/test_e2e.yml @@ -42,7 +42,7 @@ jobs: cd .. bun turbo backend#build bun turbo frontend#build - bun turbo backend#start frontend#start --env-mode=loose & + bun turbo backend#start frontend#start --env-mode=loose - name: End-to-end tests | prepare run: | @@ -126,7 +126,14 @@ jobs: run: docker compose -f docker-compose.yml -f docker-compose.test.yml up --detach mailserver - name: Start mysql - run: sudo systemctl start mysql.service + run: | + sudo systemctl start mysql.service + sudo mysql -u root < Date: Sat, 28 Jun 2025 17:28:07 +0200 Subject: [PATCH 16/31] not u --- .github/workflows/test_e2e.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_e2e.yml b/.github/workflows/test_e2e.yml index e73f56b6e..3cf359f8e 100644 --- a/.github/workflows/test_e2e.yml +++ b/.github/workflows/test_e2e.yml @@ -128,7 +128,7 @@ jobs: - name: Start mysql run: | sudo systemctl start mysql.service - sudo mysql -u root < Date: Sat, 28 Jun 2025 17:33:54 +0200 Subject: [PATCH 17/31] fix mysql query --- .github/workflows/test_e2e.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/test_e2e.yml b/.github/workflows/test_e2e.yml index 3cf359f8e..3e265bd5c 100644 --- a/.github/workflows/test_e2e.yml +++ b/.github/workflows/test_e2e.yml @@ -129,8 +129,7 @@ jobs: run: | sudo systemctl start mysql.service sudo mysql < Date: Sat, 28 Jun 2025 17:36:09 +0200 Subject: [PATCH 18/31] use root pwd --- .github/workflows/test_e2e.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test_e2e.yml b/.github/workflows/test_e2e.yml index 3e265bd5c..1300aeda2 100644 --- a/.github/workflows/test_e2e.yml +++ b/.github/workflows/test_e2e.yml @@ -128,11 +128,11 @@ jobs: - name: Start mysql run: | sudo systemctl start mysql.service - sudo mysql < Date: Sat, 28 Jun 2025 17:40:21 +0200 Subject: [PATCH 19/31] fix for mysql8 --- database/migration/migrations/0003-login_server_tables.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/database/migration/migrations/0003-login_server_tables.ts b/database/migration/migrations/0003-login_server_tables.ts index 6b87f1ffb..8fd5437bf 100644 --- a/database/migration/migrations/0003-login_server_tables.ts +++ b/database/migration/migrations/0003-login_server_tables.ts @@ -116,7 +116,7 @@ export async function upgrade(queryFn: (query: string, values?: any[]) => Promis \`first_name\` varchar(150) NOT NULL, \`last_name\` varchar(255) DEFAULT '', \`username\` varchar(255) DEFAULT '', - \`description\` text DEFAULT '', + \`description\` text DEFAULT NULL, \`password\` bigint unsigned DEFAULT '0', \`pubkey\` binary(32) DEFAULT NULL, \`privkey\` binary(80) DEFAULT NULL, From 5057e57ca642458b0a960e0948d6ca534ed00fe2 Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Sat, 28 Jun 2025 17:45:05 +0200 Subject: [PATCH 20/31] fix for mysql8 --- .../migration/migrations/0010-login_users_state_users_sync.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/database/migration/migrations/0010-login_users_state_users_sync.ts b/database/migration/migrations/0010-login_users_state_users_sync.ts index 1c326db54..8181835a9 100644 --- a/database/migration/migrations/0010-login_users_state_users_sync.ts +++ b/database/migration/migrations/0010-login_users_state_users_sync.ts @@ -35,7 +35,7 @@ export async function upgrade(queryFn: (query: string, values?: any[]) => Promis (SELECT pubkey FROM login_users WHERE pubkey IS NOT NULL) AND email IN (SELECT email FROM state_users GROUP BY email HAVING COUNT(*) > 1 - ) + ) AS subquery )`, ) } From acb6fc06184721840919e21261ef269569ffebd8 Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Sat, 28 Jun 2025 17:48:22 +0200 Subject: [PATCH 21/31] fix again --- .../0010-login_users_state_users_sync.ts | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/database/migration/migrations/0010-login_users_state_users_sync.ts b/database/migration/migrations/0010-login_users_state_users_sync.ts index 8181835a9..b5a0579a4 100644 --- a/database/migration/migrations/0010-login_users_state_users_sync.ts +++ b/database/migration/migrations/0010-login_users_state_users_sync.ts @@ -29,14 +29,20 @@ export async function upgrade(queryFn: (query: string, values?: any[]) => Promis // 18 entries await queryFn( `DELETE FROM state_users - WHERE id IN - (SELECT state_users.id FROM state_users - WHERE public_key NOT IN - (SELECT pubkey FROM login_users - WHERE pubkey IS NOT NULL) - AND email IN (SELECT email FROM state_users GROUP BY email HAVING COUNT(*) > 1 + WHERE id IN ( + SELECT id FROM ( + SELECT id FROM state_users + WHERE public_key NOT IN ( + SELECT pubkey FROM login_users + WHERE pubkey IS NOT NULL + ) + AND email IN ( + SELECT email FROM state_users + GROUP BY email + HAVING COUNT(*) > 1 + ) ) AS subquery - )`, + )`, ) } From fdf6ab89aadb5091b072d3648c59e876ee0ed127 Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Sat, 28 Jun 2025 17:52:41 +0200 Subject: [PATCH 22/31] ... --- database/migration/migrations/0017-combine_user_tables.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/database/migration/migrations/0017-combine_user_tables.ts b/database/migration/migrations/0017-combine_user_tables.ts index 04be53615..31e1ea2ee 100644 --- a/database/migration/migrations/0017-combine_user_tables.ts +++ b/database/migration/migrations/0017-combine_user_tables.ts @@ -29,7 +29,7 @@ export async function upgrade(queryFn: (query: string, values?: any[]) => Promis // Create missing data columns for the data stored in `login_users` await queryFn( - "ALTER TABLE `state_users` ADD COLUMN `description` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT '' AFTER `disabled`;", + "ALTER TABLE `state_users` ADD COLUMN `description` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL AFTER `disabled`;", ) await queryFn( 'ALTER TABLE `state_users` ADD COLUMN `password` bigint(20) unsigned DEFAULT 0 AFTER `description`;', @@ -93,7 +93,7 @@ export async function downgrade(queryFn: (query: string, values?: any[]) => Prom \`first_name\` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL, \`last_name\` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT '', \`username\` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT '', - \`description\` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT '', + \`description\` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL, \`password\` bigint(20) unsigned DEFAULT 0, \`pubkey\` binary(32) DEFAULT NULL, \`privkey\` binary(80) DEFAULT NULL, From f67f65b47bad17eb2b47bd9aa3234ceb491ba066 Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Sat, 28 Jun 2025 19:33:16 +0200 Subject: [PATCH 23/31] rollback mysql8 changes --- .github/workflows/test_e2e.yml | 23 ++++--------------- backend/.env.test_e2e | 7 ------ database/.env.test_e2e | 7 ------ .../migrations/0003-login_server_tables.ts | 2 +- .../0010-login_users_state_users_sync.ts | 22 +++++++----------- .../migrations/0017-combine_user_tables.ts | 2 +- 6 files changed, 15 insertions(+), 48 deletions(-) delete mode 100644 database/.env.test_e2e diff --git a/.github/workflows/test_e2e.yml b/.github/workflows/test_e2e.yml index 1300aeda2..9691241cf 100644 --- a/.github/workflows/test_e2e.yml +++ b/.github/workflows/test_e2e.yml @@ -40,9 +40,8 @@ jobs: cd backend cp .env.test_e2e .env cd .. - bun turbo backend#build - bun turbo frontend#build - bun turbo backend#start frontend#start --env-mode=loose + bun turbo backend#build frontend#build --env-mode=loose + bun turbo backend#start frontend#start --env-mode=loose & - name: End-to-end tests | prepare run: | @@ -123,17 +122,8 @@ jobs: uses: oven-sh/setup-bun@v2 - name: Boot up test system | docker-compose mariadb mailserver - run: docker compose -f docker-compose.yml -f docker-compose.test.yml up --detach mailserver + run: docker compose -f docker-compose.yml -f docker-compose.test.yml up --detach mariadb mailserver - - name: Start mysql - run: | - sudo systemctl start mysql.service - sudo mysql -u root -proot < Promis \`first_name\` varchar(150) NOT NULL, \`last_name\` varchar(255) DEFAULT '', \`username\` varchar(255) DEFAULT '', - \`description\` text DEFAULT NULL, + \`description\` text DEFAULT '', \`password\` bigint unsigned DEFAULT '0', \`pubkey\` binary(32) DEFAULT NULL, \`privkey\` binary(80) DEFAULT NULL, diff --git a/database/migration/migrations/0010-login_users_state_users_sync.ts b/database/migration/migrations/0010-login_users_state_users_sync.ts index b5a0579a4..1c326db54 100644 --- a/database/migration/migrations/0010-login_users_state_users_sync.ts +++ b/database/migration/migrations/0010-login_users_state_users_sync.ts @@ -29,20 +29,14 @@ export async function upgrade(queryFn: (query: string, values?: any[]) => Promis // 18 entries await queryFn( `DELETE FROM state_users - WHERE id IN ( - SELECT id FROM ( - SELECT id FROM state_users - WHERE public_key NOT IN ( - SELECT pubkey FROM login_users - WHERE pubkey IS NOT NULL - ) - AND email IN ( - SELECT email FROM state_users - GROUP BY email - HAVING COUNT(*) > 1 - ) - ) AS subquery - )`, + WHERE id IN + (SELECT state_users.id FROM state_users + WHERE public_key NOT IN + (SELECT pubkey FROM login_users + WHERE pubkey IS NOT NULL) + AND email IN (SELECT email FROM state_users GROUP BY email HAVING COUNT(*) > 1 + ) + )`, ) } diff --git a/database/migration/migrations/0017-combine_user_tables.ts b/database/migration/migrations/0017-combine_user_tables.ts index 31e1ea2ee..351208b38 100644 --- a/database/migration/migrations/0017-combine_user_tables.ts +++ b/database/migration/migrations/0017-combine_user_tables.ts @@ -93,7 +93,7 @@ export async function downgrade(queryFn: (query: string, values?: any[]) => Prom \`first_name\` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL, \`last_name\` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT '', \`username\` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT '', - \`description\` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL, + \`description\` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT '', \`password\` bigint(20) unsigned DEFAULT 0, \`pubkey\` binary(32) DEFAULT NULL, \`privkey\` binary(80) DEFAULT NULL, From 766beb0b60756a38eb10f2329fccb09ccb13c363 Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Sat, 28 Jun 2025 19:34:15 +0200 Subject: [PATCH 24/31] rollback --- database/migration/migrations/0017-combine_user_tables.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/database/migration/migrations/0017-combine_user_tables.ts b/database/migration/migrations/0017-combine_user_tables.ts index 351208b38..04be53615 100644 --- a/database/migration/migrations/0017-combine_user_tables.ts +++ b/database/migration/migrations/0017-combine_user_tables.ts @@ -29,7 +29,7 @@ export async function upgrade(queryFn: (query: string, values?: any[]) => Promis // Create missing data columns for the data stored in `login_users` await queryFn( - "ALTER TABLE `state_users` ADD COLUMN `description` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL AFTER `disabled`;", + "ALTER TABLE `state_users` ADD COLUMN `description` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT '' AFTER `disabled`;", ) await queryFn( 'ALTER TABLE `state_users` ADD COLUMN `password` bigint(20) unsigned DEFAULT 0 AFTER `description`;', From 683fd53ef72bacc9268eaa2d47684674dabd065b Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Sat, 28 Jun 2025 19:44:14 +0200 Subject: [PATCH 25/31] adjust test setup --- .github/workflows/test_e2e.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test_e2e.yml b/.github/workflows/test_e2e.yml index 9691241cf..8cc0a024b 100644 --- a/.github/workflows/test_e2e.yml +++ b/.github/workflows/test_e2e.yml @@ -130,14 +130,15 @@ jobs: bun install sudo cp ./nginx/e2e-test.conf /etc/nginx/sites-available/default - - name: Boot up test system | seed backend + - name: copy test config run: | cd frontend cp .env.test_e2e .env cd ../backend cp .env.test_e2e .env - cd .. - bun turbo seed --env-mode=loose + + - name: Boot up test system | seed backend + run: bun turbo seed - name: Moving logs after seeding run: | From ae7b5f6cee6a525ef6935264f2c6896e5a4f291f Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Sat, 28 Jun 2025 19:51:26 +0200 Subject: [PATCH 26/31] don't wait on close connection after seeding --- backend/src/seeds/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/src/seeds/index.ts b/backend/src/seeds/index.ts index 4189f87e3..f3f6237f3 100644 --- a/backend/src/seeds/index.ts +++ b/backend/src/seeds/index.ts @@ -98,7 +98,8 @@ const run = async () => { } logger.info('##seed## seeding all contributionLinks successful...') - await con.destroy() + // TODO: check why this sometimes hangs + // await con.destroy() } run().catch((err) => { From 187694df03145c10439f54f8effca12b0ebb35c2 Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Sat, 28 Jun 2025 20:00:32 +0200 Subject: [PATCH 27/31] extra build step before seed --- .github/workflows/test_e2e.yml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test_e2e.yml b/.github/workflows/test_e2e.yml index 8cc0a024b..2056aefdb 100644 --- a/.github/workflows/test_e2e.yml +++ b/.github/workflows/test_e2e.yml @@ -28,7 +28,9 @@ jobs: sudo cp ./nginx/e2e-test.conf /etc/nginx/sites-available/default - name: Boot up test system | seed backend - run: bun turbo seed + run: | + bun turbo backend#build + bun turbo seed - name: Moving logs after seeding run: | @@ -136,9 +138,12 @@ jobs: cp .env.test_e2e .env cd ../backend cp .env.test_e2e .env + cd .. - name: Boot up test system | seed backend - run: bun turbo seed + run: | + bun turbo backend#build + bun turbo seed - name: Moving logs after seeding run: | @@ -214,7 +219,9 @@ jobs: sudo cp ./nginx/e2e-test.conf /etc/nginx/sites-available/default - name: Boot up test system | seed backend - run: bun turbo seed + run: | + bun turbo backend#build + bun turbo seed - name: Moving logs after seeding run: | From dd8565973be362276f2e5663a9b47734720d1750 Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Sat, 28 Jun 2025 20:07:26 +0200 Subject: [PATCH 28/31] use turbo direct and bun with frozen lockfile --- .github/workflows/test_e2e.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test_e2e.yml b/.github/workflows/test_e2e.yml index 2056aefdb..f1aa02c48 100644 --- a/.github/workflows/test_e2e.yml +++ b/.github/workflows/test_e2e.yml @@ -123,13 +123,16 @@ jobs: - name: install bun uses: oven-sh/setup-bun@v2 + - name: install turbo + run: bun install --global --no-save turbo@2.5.0 + - name: Boot up test system | docker-compose mariadb mailserver run: docker compose -f docker-compose.yml -f docker-compose.test.yml up --detach mariadb mailserver - name: Prepare test system run: | sudo chown runner:docker -R * - bun install + bun install --frozen-lockfile sudo cp ./nginx/e2e-test.conf /etc/nginx/sites-available/default - name: copy test config @@ -142,8 +145,8 @@ jobs: - name: Boot up test system | seed backend run: | - bun turbo backend#build - bun turbo seed + turbo backend#build + turbo seed - name: Moving logs after seeding run: | @@ -152,8 +155,8 @@ jobs: - name: Boot up test system | docker-compose backend, frontend run: | - bun turbo backend#build frontend#build --env-mode=loose - bun turbo backend#start frontend#start --env-mode=loose & + turbo backend#build frontend#build --env-mode=loose + turbo backend#start frontend#start --env-mode=loose & - name: End-to-end tests | prepare run: | From fd5f28d44860931b8b91d1b71cacc7e1c8880f20 Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Sat, 28 Jun 2025 20:15:16 +0200 Subject: [PATCH 29/31] call seed direct, without turbo --- .github/workflows/test_e2e.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test_e2e.yml b/.github/workflows/test_e2e.yml index f1aa02c48..8d4144196 100644 --- a/.github/workflows/test_e2e.yml +++ b/.github/workflows/test_e2e.yml @@ -29,8 +29,9 @@ jobs: - name: Boot up test system | seed backend run: | - bun turbo backend#build - bun turbo seed + bun turbo backend#build up + cd backend + bun seed - name: Moving logs after seeding run: | From efa90a0b106f01c5a7ed901f88576ecc857cdbb3 Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Sun, 29 Jun 2025 11:14:55 +0200 Subject: [PATCH 30/31] optimize strategy --- .github/workflows/test_e2e.yml | 25 +++++++------------------ backend/src/seeds/index.ts | 4 ++-- 2 files changed, 9 insertions(+), 20 deletions(-) diff --git a/.github/workflows/test_e2e.yml b/.github/workflows/test_e2e.yml index 8d4144196..525c63109 100644 --- a/.github/workflows/test_e2e.yml +++ b/.github/workflows/test_e2e.yml @@ -24,14 +24,11 @@ jobs: - name: Prepare test system run: | sudo chown runner:docker -R * - bun install + bun install --frozen-lockfile sudo cp ./nginx/e2e-test.conf /etc/nginx/sites-available/default - name: Boot up test system | seed backend - run: | - bun turbo backend#build up - cd backend - bun seed + run: bun turbo seed - name: Moving logs after seeding run: | @@ -124,9 +121,6 @@ jobs: - name: install bun uses: oven-sh/setup-bun@v2 - - name: install turbo - run: bun install --global --no-save turbo@2.5.0 - - name: Boot up test system | docker-compose mariadb mailserver run: docker compose -f docker-compose.yml -f docker-compose.test.yml up --detach mariadb mailserver @@ -135,19 +129,16 @@ jobs: sudo chown runner:docker -R * bun install --frozen-lockfile sudo cp ./nginx/e2e-test.conf /etc/nginx/sites-available/default - + + - name: Boot up test system | seed backend + run: bun turbo seed + - name: copy test config run: | cd frontend cp .env.test_e2e .env cd ../backend cp .env.test_e2e .env - cd .. - - - name: Boot up test system | seed backend - run: | - turbo backend#build - turbo seed - name: Moving logs after seeding run: | @@ -223,9 +214,7 @@ jobs: sudo cp ./nginx/e2e-test.conf /etc/nginx/sites-available/default - name: Boot up test system | seed backend - run: | - bun turbo backend#build - bun turbo seed + run: bun turbo seed - name: Moving logs after seeding run: | diff --git a/backend/src/seeds/index.ts b/backend/src/seeds/index.ts index f3f6237f3..451f671ac 100644 --- a/backend/src/seeds/index.ts +++ b/backend/src/seeds/index.ts @@ -58,6 +58,7 @@ const run = async () => { const { con } = server await cleanDB() logger.info('##seed## clean database successful...') + logger.info(`crypto worker enabled: ${CONFIG.USE_CRYPTO_WORKER}`) // seed home community await writeHomeCommunityEntry() @@ -98,8 +99,7 @@ const run = async () => { } logger.info('##seed## seeding all contributionLinks successful...') - // TODO: check why this sometimes hangs - // await con.destroy() + await con.destroy() } run().catch((err) => { From 0410c05d0926d48afea15db5b88cb02ca7f479a5 Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Sun, 29 Jun 2025 11:16:39 +0200 Subject: [PATCH 31/31] put back bun --- .github/workflows/test_e2e.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test_e2e.yml b/.github/workflows/test_e2e.yml index 525c63109..9a36f063f 100644 --- a/.github/workflows/test_e2e.yml +++ b/.github/workflows/test_e2e.yml @@ -147,8 +147,8 @@ jobs: - name: Boot up test system | docker-compose backend, frontend run: | - turbo backend#build frontend#build --env-mode=loose - turbo backend#start frontend#start --env-mode=loose & + bun turbo backend#build frontend#build --env-mode=loose + bun turbo backend#start frontend#start --env-mode=loose & - name: End-to-end tests | prepare run: |