System Tests for Polarion PDF Exporter extension | Read-only mirror of https://github.com/SchweizerischeBundesbahnen/ch.sbb.polarion.extension.pdf-exporter.st — SBB. Issues & pull requests at the source.
  • Python 93%
  • HTML 7%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
renovate[bot] 080fa34d0d
fix(deps): update dependency ch.sbb.polarion.extensions:ch.sbb.polarion.extension.admin-utility to v5.1.0 (#232)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-12-04 11:42:58 +00:00
.github fix(deps): update dependency ch.sbb.polarion.extensions:ch.sbb.polarion.extension.admin-utility to v5.1.0 (#232) 2026-12-04 11:42:58 +00:00
.mvn ci(system-tests): resolve extension SNAPSHOTs from JFrog (#88) 2026-06-28 17:34:20 +02:00
test-data Test/collection and export UI (#230) 2026-12-03 14:21:42 +01:00
tests Test/collection and export UI (#230) 2026-12-03 14:21:42 +01:00
.gitignore chore: sync from system-test repo template (b5006a2) (#85) 2026-06-24 17:30:40 +02:00
.pre-commit-config.yaml chore(deps): update pre-commit hook commitizen-tools/commitizen to v4.20.1 (#221) 2026-11-28 00:25:41 +00:00
.tool-versions fix: bump certifi to 2026.10.19 in the lock file (#155) 2026-10-21 19:37:36 +02:00
.yamlfix.toml Initial commit 2026-03-20 16:27:45 +01:00
CLAUDE.md test: replace pymupdf with pypdfium2 (#216) 2026-11-25 14:40:31 +01:00
CODING_STANDARDS.md chore: replace mypy with ty for type checking (#156) 2026-10-29 14:07:09 +01:00
CONTRIBUTING.md chore: sync from system-test repo template (b5006a2) (#85) 2026-06-24 17:30:40 +02:00
DCO Initial commit 2026-03-20 16:27:45 +01:00
Jenkinsfile Test/collection and export UI (#230) 2026-12-03 14:21:42 +01:00
LICENSE Initial commit 2026-03-20 16:27:45 +01:00
NOTICE Initial commit 2026-03-20 16:27:45 +01:00
pyproject.toml fix(deps): update dependency python-sbb-polarion to v5.2.3 (#234) 2026-12-04 06:51:40 +00:00
readme.md Test/collection and export UI (#230) 2026-12-03 14:21:42 +01:00
renovate.json ci: quieter system test output, veraPDF apart, one run per Renovate update (#165) 2026-10-25 20:11:56 +01:00
sonar-project.properties fix: bump certifi to 2026.10.19 in the lock file (#155) 2026-10-21 19:37:36 +02:00
tox.ini Test/collection and export UI (#230) 2026-12-03 14:21:42 +01:00
uv.lock fix(deps): update dependency python-sbb-polarion to v5.2.3 (#234) 2026-12-04 06:51:40 +00:00
zizmor.yml chore: sync from system-test repo template (b5006a2) (#85) 2026-06-24 17:30:40 +02:00

Quality Gate Status Bugs Code Smells Duplicated Lines (%) Lines of Code Reliability Rating Security Rating Maintainability Rating Vulnerabilities

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 (the system-tests and system-tests-verapdf checks are required on main), 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 the main branch 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:latest for 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.