Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,4 @@ public static String fetchText(String url) throws Exception {

return response.body();
}

// --- Beispielaufruf ---
public static void main(String[] args) throws Exception {
String inhalt = fetchText("https://example.com");
System.out.println(inhalt);
}
}
Original file line number Diff line number Diff line change
@@ -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 <http://www.gnu.org/licenses/>.
* #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()).contains("<!-- example from application scope -->");
}

@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()).contains("<b>example from module</b>");
}
}
Original file line number Diff line number Diff line change
@@ -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 <http://www.gnu.org/licenses/>.
* #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("<div>TITLE: Startpage</div>");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
*
Expand Down
6 changes: 5 additions & 1 deletion test-server/hosts/demo/content/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,8 @@ System.out.println("Hello world!");
### test ShortCode with content
---
[[ext:bold_content]]This content will be bold[[/ext:bold_content]]
---
---


### example from module
[[ext:example /]]
Binary file not shown.
4 changes: 4 additions & 0 deletions test-server/themes/demo/extensions/theme.extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ $hooks.registerAction("system/template/function", ({functions}) => {
"fn_message",
({color, message}) => `<div style="color: ${color}">MESSAGE: ${message}</div>`
)
functions.put(
"node",
({node}) => `<div>TITLE: ${node.meta.title}</div>`
)
return null;
})

Expand Down
2 changes: 1 addition & 1 deletion test-server/themes/demo/templates/libs/fragments.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

<link href="{{ cms.links.createUrl('/theme/assets/highlightjs/panda-syntax-dark.min.css') }}" rel="stylesheet" defer />

{% if PREVIEW_MODE %}
{% if MANAGER %}
<script src="{{ cms.links.createUrl('/manager/js/manager-inject.js') }}" type="module"></script>
<link rel="stylesheet" href="{{ cms.links.createUrl('/manager/css/manager-inject.css') }}" />
{% endif %}
Expand Down
9 changes: 9 additions & 0 deletions test-server/themes/demo/templates/start.html
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,15 @@ <h3>Template component content test</h3>
---
</div>
</div>

<div>
<h3>Template function with node as parameter</h3>
<div>
---
{{ ext.node({'node': node}) | raw }}
---
</div>
</div>

<!-- start call hook -->
{{ cms.hooks({'hook': 'theme/template/footer'}) | raw }}
Expand Down
Loading