From 5724745fb9945544946b1b5795a6bf87fc9b1d01 Mon Sep 17 00:00:00 2001 From: Thorsten Marx Date: Tue, 23 Jun 2026 15:59:37 +0200 Subject: [PATCH 1/5] add more tests --- .../cms/api/extensions/http/PathMapping.java | 2 +- .../com/condation/cms/test/e2e/HttpUtil.java | 46 ++++++++++++++ .../condation/cms/e2e/ExampleModuleTest.java | 61 +++++++++++++++++++ test-server/hosts/demo/content/index.md | 6 +- 4 files changed, 113 insertions(+), 2 deletions(-) create mode 100644 cms-test-server/src/main/java/com/condation/cms/test/e2e/HttpUtil.java create mode 100644 integration-tests/src/test/java/com/condation/cms/e2e/ExampleModuleTest.java diff --git a/cms-api/src/main/java/com/condation/cms/api/extensions/http/PathMapping.java b/cms-api/src/main/java/com/condation/cms/api/extensions/http/PathMapping.java index 888914c70..52d24b825 100644 --- a/cms-api/src/main/java/com/condation/cms/api/extensions/http/PathMapping.java +++ b/cms-api/src/main/java/com/condation/cms/api/extensions/http/PathMapping.java @@ -11,7 +11,7 @@ * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, + * This program is distributed in the hope that it wil6l be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. diff --git a/cms-test-server/src/main/java/com/condation/cms/test/e2e/HttpUtil.java b/cms-test-server/src/main/java/com/condation/cms/test/e2e/HttpUtil.java new file mode 100644 index 000000000..bd1f63905 --- /dev/null +++ b/cms-test-server/src/main/java/com/condation/cms/test/e2e/HttpUtil.java @@ -0,0 +1,46 @@ +package com.condation.cms.test.e2e; + +import java.net.URI; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.time.Duration; + +public class HttpUtil { + + // HttpClient als Klassenattribut – thread-safe und wiederverwendbar + private static final HttpClient HTTP_CLIENT = HttpClient.newBuilder() + .connectTimeout(Duration.ofSeconds(10)) // Verbindungs-Timeout: 10 Sekunden + .followRedirects(HttpClient.Redirect.NORMAL) // Weiterleitungen automatisch folgen + .build(); + + /** + * Lädt den Text-Response einer URL und gibt ihn als String zurück. + * + * @param url Die Ziel-URL als String + * @return Den Response-Body als String + * @throws Exception Bei Verbindungsfehlern oder ungültiger URL + */ + public static String fetchText(String url) throws Exception { + HttpRequest request = HttpRequest.newBuilder() + .uri(URI.create(url)) // URL setzen + .timeout(Duration.ofSeconds(30)) // Request-Timeout: 30 Sekunden + .header("Accept", "text/plain, text/html, */*") // Akzeptierte Content-Types + .GET() // HTTP GET-Methode + .build(); + + HttpResponse response = HTTP_CLIENT.send( + request, + HttpResponse.BodyHandlers.ofString() // Response-Body als String lesen + ); + + // HTTP-Fehler (4xx / 5xx) als Exception werfen + if (response.statusCode() < 200 || response.statusCode() >= 300) { + throw new RuntimeException( + "HTTP-Fehler: Status " + response.statusCode() + " für URL: " + url + ); + } + + return response.body(); + } +} \ No newline at end of file diff --git a/integration-tests/src/test/java/com/condation/cms/e2e/ExampleModuleTest.java b/integration-tests/src/test/java/com/condation/cms/e2e/ExampleModuleTest.java new file mode 100644 index 000000000..40332ca6a --- /dev/null +++ b/integration-tests/src/test/java/com/condation/cms/e2e/ExampleModuleTest.java @@ -0,0 +1,61 @@ +package com.condation.cms.e2e; + +/*- + * #%L + * integration-tests + * %% + * Copyright (C) 2023 - 2026 CondationCMS + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * #L% + */ +import com.condation.cms.test.e2e.CMSServerExtension; +import com.condation.cms.test.e2e.HttpUtil; +import com.microsoft.playwright.Page; +import com.microsoft.playwright.junit.UsePlaywright; +import org.assertj.core.api.Assertions; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; + +/** + * + * @author thmar + */ +@UsePlaywright +@ExtendWith(CMSServerExtension.class) +public class ExampleModuleTest { + + + @Test + void test_api() throws Exception { + Assertions.assertThat(HttpUtil.fetchText("http://localhost:2020/api/test-api")).isEqualTo("CondationCMS test api"); + } + + @Test + void test_hook (Page page) { + page.navigate("http://localhost:2020"); + Assertions.assertThat(page.locator("body").innerHTML()).isEqualTo(""); + } + + @Test + void test_http_module () throws Exception { + Assertions.assertThat(HttpUtil.fetchText("http://localhost:2020/module/example-module/world")).isEqualTo("Hello world!"); + } + + @Test + void test_shortcode (Page page) throws Exception { + page.navigate("http://localhost:2020"); + Assertions.assertThat(page.locator("body").innerHTML()).isEqualTo("example from module"); + } +} diff --git a/test-server/hosts/demo/content/index.md b/test-server/hosts/demo/content/index.md index f8c92cd87..1144980cb 100644 --- a/test-server/hosts/demo/content/index.md +++ b/test-server/hosts/demo/content/index.md @@ -62,4 +62,8 @@ System.out.println("Hello world!"); ### test ShortCode with content --- [[ext:bold_content]]This content will be bold[[/ext:bold_content]] ---- \ No newline at end of file +--- + + +### edxample from module +[[]] \ No newline at end of file From 2072c4ed339a781aca32abcaa9c2c7988604c268 Mon Sep 17 00:00:00 2001 From: Thorsten Marx Date: Tue, 23 Jun 2026 18:06:22 +0200 Subject: [PATCH 2/5] fix example tests --- .../cms/api/extensions/http/PathMapping.java | 2 +- .../com/condation/cms/test/e2e/HttpUtil.java | 23 +++++++++++++++++- .../condation/cms/e2e/ExampleModuleTest.java | 4 +-- .../modules/example/ExampleTagExtension.java | 6 ----- test-server/hosts/demo/content/index.md | 4 +-- ...ule-8.1.0.jar => example-module-8.2.0.jar} | Bin 20184 -> 19411 bytes 6 files changed, 27 insertions(+), 12 deletions(-) rename test-server/modules/example-module/libs/{example-module-8.1.0.jar => example-module-8.2.0.jar} (58%) diff --git a/cms-api/src/main/java/com/condation/cms/api/extensions/http/PathMapping.java b/cms-api/src/main/java/com/condation/cms/api/extensions/http/PathMapping.java index 52d24b825..888914c70 100644 --- a/cms-api/src/main/java/com/condation/cms/api/extensions/http/PathMapping.java +++ b/cms-api/src/main/java/com/condation/cms/api/extensions/http/PathMapping.java @@ -11,7 +11,7 @@ * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * This program is distributed in the hope that it wil6l be useful, + * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. diff --git a/cms-test-server/src/main/java/com/condation/cms/test/e2e/HttpUtil.java b/cms-test-server/src/main/java/com/condation/cms/test/e2e/HttpUtil.java index bd1f63905..79440945e 100644 --- a/cms-test-server/src/main/java/com/condation/cms/test/e2e/HttpUtil.java +++ b/cms-test-server/src/main/java/com/condation/cms/test/e2e/HttpUtil.java @@ -1,5 +1,26 @@ package com.condation.cms.test.e2e; +/*- + * #%L + * CMS Test Server + * %% + * Copyright (C) 2023 - 2026 CondationCMS + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * #L% + */ + import java.net.URI; import java.net.http.HttpClient; import java.net.http.HttpRequest; @@ -43,4 +64,4 @@ public static String fetchText(String url) throws Exception { return response.body(); } -} \ No newline at end of file +} diff --git a/integration-tests/src/test/java/com/condation/cms/e2e/ExampleModuleTest.java b/integration-tests/src/test/java/com/condation/cms/e2e/ExampleModuleTest.java index 40332ca6a..d3b859027 100644 --- a/integration-tests/src/test/java/com/condation/cms/e2e/ExampleModuleTest.java +++ b/integration-tests/src/test/java/com/condation/cms/e2e/ExampleModuleTest.java @@ -45,7 +45,7 @@ void test_api() throws Exception { @Test void test_hook (Page page) { page.navigate("http://localhost:2020"); - Assertions.assertThat(page.locator("body").innerHTML()).isEqualTo(""); + Assertions.assertThat(page.locator("body").innerHTML()).contains(""); } @Test @@ -56,6 +56,6 @@ void test_http_module () throws Exception { @Test void test_shortcode (Page page) throws Exception { page.navigate("http://localhost:2020"); - Assertions.assertThat(page.locator("body").innerHTML()).isEqualTo("example from module"); + Assertions.assertThat(page.locator("body").innerHTML()).contains("example from module"); } } diff --git a/modules/example-module/src/main/java/com/condation/cms/modules/example/ExampleTagExtension.java b/modules/example-module/src/main/java/com/condation/cms/modules/example/ExampleTagExtension.java index 8d8f2729f..8d9c8c051 100644 --- a/modules/example-module/src/main/java/com/condation/cms/modules/example/ExampleTagExtension.java +++ b/modules/example-module/src/main/java/com/condation/cms/modules/example/ExampleTagExtension.java @@ -22,15 +22,9 @@ */ -import com.condation.cms.api.annotations.Action; -import com.condation.cms.api.annotations.Scope; import com.condation.cms.api.annotations.ShortCode; import com.condation.cms.api.extensions.RegisterShortCodesExtensionPoint; -import com.condation.cms.api.model.Parameter; import com.condation.modules.api.annotation.Extension; -import java.util.HashMap; -import java.util.Map; -import java.util.function.Function; /** * diff --git a/test-server/hosts/demo/content/index.md b/test-server/hosts/demo/content/index.md index 1144980cb..3aa94b4e4 100644 --- a/test-server/hosts/demo/content/index.md +++ b/test-server/hosts/demo/content/index.md @@ -65,5 +65,5 @@ System.out.println("Hello world!"); --- -### edxample from module -[[]] \ No newline at end of file +### example from module +[[ext:example /]] \ No newline at end of file diff --git a/test-server/modules/example-module/libs/example-module-8.1.0.jar b/test-server/modules/example-module/libs/example-module-8.2.0.jar similarity index 58% rename from test-server/modules/example-module/libs/example-module-8.1.0.jar rename to test-server/modules/example-module/libs/example-module-8.2.0.jar index e08480f7af78296bb00ed01e0459e536212fa79a..a66b86c225c27f0f3a53670647de9b314138e802 100644 GIT binary patch delta 2868 zcmY*b3piBi8$WY~alZ_0%#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WnLm&_my%_#_PX&PttR6RF1971aVrdG6 zaWVY9y8^3N74UtR)Y1m;soq-0L1t=cfE>}nf#ks%fIb%-31m6W5+n@2cc0b6Yl6=d z{0Wf5cz2Lm+CCtQw8KD3>6~NTz0Ur3O$F}hoB^BQy8N(2HUP>f3xu;O0AxJ`C|{$? zLmaEPkGF?t{mFhU^q^v(YJ%Z+H@1jr!KWi#N1Da!q7kp##FimBV-RSpx$k8@hw*toWJe zxogm+7n^-1+O7!$5RK$Oqhjj)a!tAcPcN4HjH#-ivC~KzG&;#jztf=`^y$THpAn}9 z8e>(EfFp5l+y2JTqrqSi=>Y#fHBm7(TA@ajiH9)zMs0jW~D|G4et|SAf znka#ij|o34SM!&|4s59L0~00)=6}EEz^chnm;)9FP}c>BrU>Ex%g??wYvKVbtTFJ| Ml$~*Ick7V<0qsaYfdBvi From 74f7d17af186236daf3e01913d6aec1fc6380da0 Mon Sep 17 00:00:00 2001 From: Thorsten Marx Date: Wed, 24 Jun 2026 14:46:54 +0200 Subject: [PATCH 3/5] example for node as parameter for template function --- test-server/themes/demo/extensions/theme.extension.js | 4 ++++ test-server/themes/demo/templates/start.html | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/test-server/themes/demo/extensions/theme.extension.js b/test-server/themes/demo/extensions/theme.extension.js index 9202a2056..59fb0b9d5 100644 --- a/test-server/themes/demo/extensions/theme.extension.js +++ b/test-server/themes/demo/extensions/theme.extension.js @@ -23,6 +23,10 @@ $hooks.registerAction("system/template/function", ({functions}) => { "fn_message", ({color, message}) => `
MESSAGE: ${message}
` ) + functions.put( + "node", + ({node}) => `
TITLE: ${node.meta.title}
` + ) return null; }) diff --git a/test-server/themes/demo/templates/start.html b/test-server/themes/demo/templates/start.html index e31823c2e..9745cf892 100644 --- a/test-server/themes/demo/templates/start.html +++ b/test-server/themes/demo/templates/start.html @@ -97,6 +97,15 @@

Template component content test

--- + +
+

Template function with node as parameter

+
+ --- + {{ ext.node({'node': node}) | raw }} + --- +
+
{{ cms.hooks({'hook': 'theme/template/footer'}) | raw }} From d3b8c9d28459534cb8efc9d6c14c97b4d728eb29 Mon Sep 17 00:00:00 2001 From: Thorsten Marx Date: Wed, 24 Jun 2026 15:44:04 +0200 Subject: [PATCH 4/5] add test for template functions via extension --- .../com/condation/cms/e2e/ExtensionsTest.java | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 integration-tests/src/test/java/com/condation/cms/e2e/ExtensionsTest.java diff --git a/integration-tests/src/test/java/com/condation/cms/e2e/ExtensionsTest.java b/integration-tests/src/test/java/com/condation/cms/e2e/ExtensionsTest.java new file mode 100644 index 000000000..3855e8a9a --- /dev/null +++ b/integration-tests/src/test/java/com/condation/cms/e2e/ExtensionsTest.java @@ -0,0 +1,46 @@ +package com.condation.cms.e2e; + +/*- + * #%L + * integration-tests + * %% + * Copyright (C) 2023 - 2026 CondationCMS + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * #L% + */ +import com.condation.cms.test.e2e.CMSServerExtension; +import com.condation.cms.test.e2e.HttpUtil; +import com.microsoft.playwright.Page; +import com.microsoft.playwright.junit.UsePlaywright; +import org.assertj.core.api.Assertions; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; + +/** + * + * @author thmar + */ +@UsePlaywright +@ExtendWith(CMSServerExtension.class) +public class ExtensionsTest { + + + + @Test + void test_template_function_node_paramter (Page page) throws Exception { + page.navigate("http://localhost:2020"); + Assertions.assertThat(page.locator("body").innerHTML()).contains("
TITLE: Startpage
"); + } +} From f89a8937c9cd7e1f4992c7a538adf617c29ac5be Mon Sep 17 00:00:00 2001 From: Thorsten Marx Date: Thu, 25 Jun 2026 14:25:30 +0200 Subject: [PATCH 5/5] fix manager integration --- test-server/themes/demo/templates/libs/fragments.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-server/themes/demo/templates/libs/fragments.html b/test-server/themes/demo/templates/libs/fragments.html index 69b41990f..b07e9b895 100644 --- a/test-server/themes/demo/templates/libs/fragments.html +++ b/test-server/themes/demo/templates/libs/fragments.html @@ -14,7 +14,7 @@ -{% if PREVIEW_MODE %} +{% if MANAGER %} {% endif %}