- Python 93%
- HTML 7%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
|
|
||
| .github | ||
| .mvn | ||
| test-data | ||
| tests | ||
| .gitignore | ||
| .pre-commit-config.yaml | ||
| .tool-versions | ||
| .yamlfix.toml | ||
| CLAUDE.md | ||
| CODING_STANDARDS.md | ||
| CONTRIBUTING.md | ||
| DCO | ||
| Jenkinsfile | ||
| LICENSE | ||
| NOTICE | ||
| pyproject.toml | ||
| readme.md | ||
| renovate.json | ||
| sonar-project.properties | ||
| tox.ini | ||
| uv.lock | ||
| zizmor.yml | ||
System Tests for Polarion PDF Exporter extension
CI
This project uses dual CI:
- GitHub Actions
ci.yml— linting, type checking, and SonarCloud analysis.system-tests.yml— system tests against a Polarion instance running in a Docker container. This is the pull request merge gate (thesystem-testsandsystem-tests-verapdfchecks are required onmain), so merging no longer depends on the availability of a long-lived Polarion instance.
- Jenkins (
Jenkinsfile) — the same system tests run on a nightly schedule against a long-lived Polarion instance behind a firewall, on themainbranch only. Jenkins is no longer part of the per-pull-request merge path.
1. Run tests against prepared Polarion server (local or remote)
In this mode, the tests will be executed against running Polarion server specified by app_url parameter and using app_token credentials.
| Parameter | Default value | Mandatory for external Polarion | Description |
|---|---|---|---|
| app_url | - | yes | Base URL of external Polarion server |
| app_token | - | yes | Authentication token |
| app_username | - | for UI tests | Polarion user for the browser login |
| app_password | - | for UI tests | Password of app_username |
The UI tests (test_collection_ui.py) open Polarion pages in a browser, which runs in a Docker container, and export through
the "Export to PDF" dialog, the Document Properties sidebar and the bulk export widget. They compare the pages of the files the
browser saved with the images in test-data/expected. A run which names no user skips them.
They compare pictures of the dialogs and of the sidebar with the images there too. To replace those, run the tests with the
environment variable UPDATE_SNAPSHOTS=1, then check the new images.
IntelliJ
- install Python plugin
- import project
- add and configure Python SDK in project settings
- run as normal unit test
Command line example
uv run python tests/run.py --app_url BASE_POLARION_URL --app_token AUTH_TOKEN
2. Run tests against local Polarion Test Container
In this mode Polarion and Weasyprint containers will be created on the fly from the Docker image and tests will be executed against it. Both containers will be bound to common network and Weasyprint service endpoint set dynamically as environment variable in Polarion container
Prerequisites
- Docker runtime must be available on machine
- Polarion Docker image with specified name should exist either locally or in remote registry
- Weasyprint Docker image with specified name should exist either locally or in remote registry
Command line example
uv run python tests/run.py --tc_polarion_image_name=polarion:2512 --tc_weasyprint_service_image_name=weasyprint-service:68.1.0
Parameters
| Parameter | Default value | Mandatory for test containers | Description |
|---|---|---|---|
| tc_polarion_image_name | - | yes | Polarion Docker image name. Parameter triggers test containers mode |
| tc_weasyprint_service_image_name | - | no | Weasyprint service Docker image name. Parameter triggers creation of Weasyprint service container and bounds both containers to common network |
| tc_weasyprint_api_key | - | no | API key of the Weasyprint service, handed to the bulk processing service the harness starts (tc_bulk_processing_service_image_name) so it can authenticate to Weasyprint over TLS. Not needed where the service is started beside the harness (tc_bulk_processing_service_url), which is given the key itself |
| tc_bulk_processing_service_image_name | - | no | Bulk processing service Docker image name. Parameter triggers creation of the bulk processing service container and bounds it to common network. Its own API stays keyless |
| tc_bulk_processing_service_url | - | no | Address of a bulk processing service started beside the harness, e.g. over TLS with its own API key and certificate as system-tests.yml does. Takes precedence over tc_bulk_processing_service_image_name; the harness starts no container and hands this address to Polarion |
| tc_extension_version | latest | no | Version of testing extension. By default, the latest version from local maven repo will be taken |
| tc_additional_bundles | - | no | Comma separated list of additional bundles to be installed with testing extension in form group_id:artifact_id:version |
| tc_admin_utility_version | 1.8.0 | no | Version of admin-utility extension used to initialize polarion instance and prepare test data |
All parameters can be specified as environment variables.
The UI tests need the toolbar button of the extension, which a new container does not show: Polarion reads
scriptInjection.dleEditorHead from Administration only, and in polarion.properties the key carries a prefix. The
button of a live report and of a wiki page comes with scriptInjection.mainHead in the same way. The tests of the
Webhooks page of the administration are skipped unless webhooks.enabled is set. They also need the
user of the container:
export APP_USERNAME=admin APP_PASSWORD=admin
export TC_POLARION_EXTRA_PROPERTIES='ch.sbb.polarion.extension.pdf-exporter.webhooks.enabled=true;com.siemens.polarion.scriptInjection.dleEditorHead=<script src="/polarion/pdf-exporter/js/dle-toolbar.js"></script>;com.siemens.polarion.scriptInjection.mainHead=<script src="/polarion/pdf-exporter/js/live-reports.js" data-expand-tools="true"></script><script src="/polarion/pdf-exporter/js/classic-wiki.js" data-expand-tools="true"></script>'
3. PDF Variants Testing with VeraPDF
The test suite includes validation of PDF variants (PDF/A and PDF/UA) using VeraPDF. The test test_pdf_variants.py validates that generated PDFs comply with their specified variants.
test_pdf_variants.py validates single exports. test_pdf_variants_of_a_merge.py validates merges through the bulk processing service. test_pdf_variants_of_formulas.py validates a document with formulas, whose text a PDF/A-1 export leaves out.
These tests take long, so tests/run.py leaves out every module named test_pdf_variants* by default. CI runs them in a job of their own, system-tests-verapdf, which sets RUN_PDF_VARIANT_TESTS=true and SYSTEM_TEST_MODULES to these modules: a new one needs its name in the modules list of that job in system-tests.yml. To run them locally, set it too:
RUN_PDF_VARIANT_TESTS=true uv run python tests/run.py --app_url BASE_POLARION_URL --app_token AUTH_TOKEN
Docker-based VeraPDF Validation
The test suite uses the official VeraPDF Docker image:
- Uses Docker container
ghcr.io/verapdf/cli:latestfor validation - On first run, Docker will automatically pull the image (~50MB)
- No manual installation or system dependencies needed
- Perfect for CI/CD environments
- Works consistently across Linux, macOS, and Windows
- Automatic Docker detection: Tests automatically detect if Docker is available and skip gracefully if not
Prerequisites
The only requirement is Docker:
- Docker Desktop (for macOS/Windows)
- Docker Engine (for Linux)
Verify Docker is installed and running:
docker --version
docker ps
Note: If Docker is not available, the PDF variant tests will be automatically skipped with a clear message.
Tested PDF Variants
A single export validates Product Specification, without and with the Default cover page. A merge validates Product Specification and Catalog Specification merged through the bulk processing service, without and with the Default cover page on each.
| Variant | Single export | Merge | Why not tested |
|---|---|---|---|
| PDF/A-1a | yes | yes | |
| PDF/A-1b | yes | yes | |
| PDF/A-2a | yes | yes | |
| PDF/A-2b | yes | yes | |
| PDF/A-2u | yes | yes | |
| PDF/A-3a | yes | yes | |
| PDF/A-3b | yes | yes | |
| PDF/A-3u | yes | yes | |
| PDF/A-4e | yes | yes | |
| PDF/A-4f | yes, a test run with embedded attachments | yes, that test run twice | |
| PDF/A-4u | yes | yes | |
| PDF/UA-1 | yes | yes | |
| PDF/UA-2 | yes | yes |
Each variant not tested has an issue in the backlog. The lists of variants and the reasons live in PDF_VARIANTS and EXCLUDED_VARIANTS of each test class. Keep this table in step with them.