Skip to content
Open
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
51 changes: 41 additions & 10 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: Java CI with Maven

on:
Expand All @@ -16,16 +8,55 @@ on:

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6

- name: Set up JDK 25
uses: actions/setup-java@v5
with:
java-version: '25-ea'
distribution: 'temurin'
cache: maven

# Playwright-Binaries cachen → automatischer Download beim ersten Playwright.create()
- name: Cache Playwright browsers
uses: actions/cache@v5
with:
path: ~/.cache/ms-playwright
key: playwright-${{ hashFiles('**/pom.xml') }}
restore-keys: playwright-

# Systembibliotheken für Chromium direkt via apt – kein Maven-Classpath-Problem
- name: Install Chromium system dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
libglib2.0-0 \
libnss3 \
libnspr4 \
libatk1.0-0 \
libatk-bridge2.0-0 \
libcups2 \
libdrm2 \
libdbus-1-3 \
libxkbcommon0 \
libxcomposite1 \
libxdamage1 \
libxfixes3 \
libxrandr2 \
libgbm1 \
libasound2t64

- name: Build with Maven
run: mvn -B package --file pom.xml

# Test-Reports bei Fehler als Artifact sichern
- name: Upload Surefire Reports
if: failure()
uses: actions/upload-artifact@v4
with:
name: surefire-reports
path: target/surefire-reports/
retention-days: 7
2 changes: 1 addition & 1 deletion cms-server/src/main/java/com/condation/cms/cli/CMSCli.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public static CommandLine getCommandLine() {
return new CommandLine(new CLICommand());
}

public static void main(String[] args) {
public static void main(String... args) {
CMSCli.getCommandLine().execute(args);
}
}
144 changes: 79 additions & 65 deletions integration-tests/pom.xml
Original file line number Diff line number Diff line change
@@ -1,72 +1,86 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.condation.cms</groupId>
<artifactId>cms-parent</artifactId>
<version>8.1.0</version>
</parent>
<artifactId>integration-tests</artifactId>
<packaging>jar</packaging>
<name>integration-tests</name>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.condation.cms</groupId>
<artifactId>cms-parent</artifactId>
<version>8.1.0</version>
</parent>
<artifactId>integration-tests</artifactId>
<packaging>jar</packaging>
<name>integration-tests</name>

<properties>
<maven.deploy.skip>true</maven.deploy.skip>
<central.publishing.skip>true</central.publishing.skip>
</properties>
<properties>
<maven.deploy.skip>true</maven.deploy.skip>
<central.publishing.skip>true</central.publishing.skip>
</properties>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>3.1.4</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>3.1.4</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>

<dependencies>
<dependency>
<groupId>com.condation.cms</groupId>
<artifactId>cms-api</artifactId>
</dependency>
<dependency>
<groupId>com.condation.cms</groupId>
<artifactId>cms-filesystem</artifactId>
</dependency>
<dependency>
<groupId>com.condation.cms</groupId>
<artifactId>cms-core</artifactId>
</dependency>
<dependency>
<groupId>com.condation.cms</groupId>
<artifactId>cms-content</artifactId>
</dependency>
<dependency>
<groupId>com.condation.cms</groupId>
<artifactId>cms-hooksystem</artifactId>
</dependency>
<dependency>
<groupId>com.condation.cms</groupId>
<artifactId>cms-media</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-text</artifactId>
</dependency>
<dependency>
<groupId>com.condation.cms</groupId>
<artifactId>cms-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<dependencies>

<dependency>
<groupId>com.condation.cms</groupId>
<artifactId>cms-server</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.microsoft.playwright</groupId>
<artifactId>playwright</artifactId>
<version>1.60.0</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.condation.cms</groupId>
<artifactId>cms-api</artifactId>
</dependency>
<dependency>
<groupId>com.condation.cms</groupId>
<artifactId>cms-filesystem</artifactId>
</dependency>
<dependency>
<groupId>com.condation.cms</groupId>
<artifactId>cms-core</artifactId>
</dependency>
<dependency>
<groupId>com.condation.cms</groupId>
<artifactId>cms-content</artifactId>
</dependency>
<dependency>
<groupId>com.condation.cms</groupId>
<artifactId>cms-hooksystem</artifactId>
</dependency>
<dependency>
<groupId>com.condation.cms</groupId>
<artifactId>cms-media</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-text</artifactId>
</dependency>
<dependency>
<groupId>com.condation.cms</groupId>
<artifactId>cms-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
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.cli.CMSCli;
import com.condation.cms.cli.tools.CLIServerUtils;
import org.junit.jupiter.api.extension.BeforeAllCallback;
import org.junit.jupiter.api.extension.ExtensionContext;

/**
*
* @author thmar
*/
public class CMSServerExtension implements BeforeAllCallback, AutoCloseable {

private static volatile boolean started = false;
private static Thread serverThread;

@Override
public void beforeAll(ExtensionContext context) throws Exception {
if (!started) {
started = true;

System.setProperty("cms.home", "../test-server");

serverThread = new Thread(() -> {
CMSCli.main("server", "start");
});
serverThread.setDaemon(true);
serverThread.start();

waitForProcess(10);

context.getRoot()
.getStore(ExtensionContext.Namespace.GLOBAL)
.put("server", this);

}
}

@Override
public void close() throws Exception {
CMSCli.main("server", "stop");
serverThread.join(10_000);
}

private static void waitForProcess(int timeoutSeconds) throws Exception {
var deadline = System.currentTimeMillis() + timeoutSeconds * 1000L;

while (System.currentTimeMillis() < deadline) {
var process = CLIServerUtils.getCMSProcess();
if (process.isPresent()) {
// Optional: PID auslesen und prüfen ob Prozess wirklich läuft
System.out.println("Server gestartet mit PID: " + process.get().pid());
return;
}
Thread.sleep(200);
}
throw new IllegalStateException(
"Server-PID-File nicht erschienen nach " + timeoutSeconds + "s"
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
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.cli.tools.CLIServerUtils;
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
*/
@ExtendWith({CMSServerExtension.class})
@UsePlaywright
public class ShortCodesTest {


@Test
void bold_content(Page page) {
page.navigate("http://localhost:2020");
Assertions.assertThat(page.content()).contains("<b>This content will be bold</b>");
}

@Test
void theme_name (Page page) {
page.navigate("http://localhost:2020");
Assertions.assertThat(page.content()).contains("Hello, I'm your <b>demo</b> theme.");
}

@Test
void say_hello (Page page) {
page.navigate("http://localhost:2020");
Assertions.assertThat(page.content()).contains("<p>Hello, CondationCMS</p>");
}
}
Loading
Loading