test(corpus): move the release QA corpus into its own suite

This commit is contained in:
Julien Neuhart
2026-11-04 19:58:08 +01:00
parent 087d23067b
commit 77fa381241
85 changed files with 1036 additions and 1010 deletions

View File

@@ -82,5 +82,9 @@ run_cmd "$cmd"
cmd="make test-integration DOCKER_REPOSITORY=$repository GOTENBERG_VERSION=$version PLATFORM=$platform CONCURRENCY=3 VARIANT=libreoffice TAGS=libreoffice" cmd="make test-integration DOCKER_REPOSITORY=$repository GOTENBERG_VERSION=$version PLATFORM=$platform CONCURRENCY=3 VARIANT=libreoffice TAGS=libreoffice"
run_cmd "$cmd" run_cmd "$cmd"
# The corpus runs realistic documents against the full image only.
cmd="make test-corpus DOCKER_REPOSITORY=$repository GOTENBERG_VERSION=$version PLATFORM=$platform CONCURRENCY=3"
run_cmd "$cmd"
echo "✅ Done!" echo "✅ Done!"
exit 0 exit 0

View File

@@ -1,8 +1,8 @@
build build
# The corpus fixtures keep the bytes their generators wrote: the manifest records their sizes. # The corpus fixtures keep the bytes their generators wrote: the manifest records their sizes.
test/integration/testdata/corpus/web test/corpus/testdata/web
test/integration/testdata/corpus/office test/corpus/testdata/office
test/integration/testdata/corpus/pdf test/corpus/testdata/pdf
test/integration/testdata/corpus/generators/i18n.json test/corpus/testdata/generators/i18n.json
# Its tables hold cells of several hundred characters, which Prettier would pad onto every row. # Its tables hold cells of several hundred characters, which Prettier would pad onto every row.
test/integration/testdata/corpus/MANIFEST.md test/corpus/MANIFEST.md

View File

@@ -29,6 +29,7 @@ pkg/gotenberg/ -> Core module system, interfaces, utilities, mocks.
pkg/modules/ -> Feature modules (api, chromium, libreoffice, pdf, etc.). pkg/modules/ -> Feature modules (api, chromium, libreoffice, pdf, etc.).
pkg/standard/ -> Wires all standard modules together via imports. pkg/standard/ -> Wires all standard modules together via imports.
test/integration/ -> Gherkin feature files + Go test infrastructure. test/integration/ -> Gherkin feature files + Go test infrastructure.
test/corpus/ -> Release QA corpus: realistic documents, one feature file per engine.
build/ -> Dockerfile, fonts, Chromium config. build/ -> Dockerfile, fonts, Chromium config.
.bruno/ -> Bruno API collection (mirrors every route). .bruno/ -> Bruno API collection (mirrors every route).
``` ```
@@ -50,6 +51,7 @@ All build and verification tasks go through the Makefile. Do not run `go` comman
| `make lint-todo` | Find TODOs in Go code | Before committing | | `make lint-todo` | Find TODOs in Go code | Before committing |
| `make test-unit` | Run unit tests | Before committing | | `make test-unit` | Run unit tests | Before committing |
| `make test-integration` | Run all integration tests (40 min timeout) | Before committing | | `make test-integration` | Run all integration tests (40 min timeout) | Before committing |
| `make test-corpus` | Run the release QA corpus (40 min timeout) | When a change can alter how real documents come out |
| `make godoc` | Serve GoDoc at `localhost:6060` | To verify documentation | | `make godoc` | Serve GoDoc at `localhost:6060` | To verify documentation |
| `make run` | Run a Gotenberg container via `docker compose` | Manual testing. Flags configured via Makefile variables and compose.yaml | | `make run` | Run a Gotenberg container via `docker compose` | Manual testing. Flags configured via Makefile variables and compose.yaml |
| `make telemetry` | Start an OpenTelemetry collector and OpenObserve | When testing telemetry locally | | `make telemetry` | Start an OpenTelemetry collector and OpenObserve | When testing telemetry locally |
@@ -155,6 +157,8 @@ Gherkin (BDD) via Godog with `testcontainers-go` for Docker orchestration. Featu
`make build` is required before running integration tests. The full suite has a 40-minute timeout, so run only the tag(s) relevant to your change. `make build` is required before running integration tests. The full suite has a 40-minute timeout, so run only the tag(s) relevant to your change.
The release QA corpus is a separate suite, `make test-corpus`, that runs realistic documents with recorded facts; see `test/corpus/README.md`.
## Pull requests ## Pull requests
### Commits ### Commits
@@ -180,4 +184,5 @@ Before opening the PR, confirm:
## Further reading ## Further reading
- [`test/integration/README.md`](test/integration/README.md) — Gherkin step reference, available tags, writing new tests. - [`test/integration/README.md`](test/integration/README.md) — Gherkin step reference, available tags, writing new tests.
- [`test/corpus/README.md`](test/corpus/README.md) — release QA corpus: realistic documents, their manifest, how to add a fixture.
- [`.bruno/README.md`](.bruno/README.md) — `.bru` file format, conventions, route update checklist. - [`.bruno/README.md`](.bruno/README.md) — `.bru` file format, conventions, route update checklist.

View File

@@ -164,10 +164,6 @@ KEEP_FAILED=
# chromium-screenshot-markdown # chromium-screenshot-markdown
# chromium-screenshot-url # chromium-screenshot-url
# chromium-ssrf # chromium-ssrf
# corpus
# corpus-chromium
# corpus-libreoffice
# corpus-pdf
# debug # debug
# health # health
# libreoffice # libreoffice
@@ -211,6 +207,19 @@ test-integration: ## Run integration tests (automatically retries failed scenari
--keep-failed="$(KEEP_FAILED)" \ --keep-failed="$(KEEP_FAILED)" \
--tags="$(TAGS)" --tags="$(TAGS)"
# Tags of the corpus suite: chromium, libreoffice, pdf. TAGS selects among them
# for test-corpus, as it does among the integration tags for test-integration.
.PHONY: test-corpus
test-corpus: ## Run the release QA corpus (realistic documents, automatically retries failed scenarios up to 3 times)
go test -timeout 40m -tags=corpus -v github.com/gotenberg/gotenberg/v9/test/corpus -args \
--gotenberg-docker-repository=$(DOCKER_REPOSITORY) \
--gotenberg-version=$(GOTENBERG_VERSION) \
--gotenberg-variant=$(VARIANT) \
--gotenberg-container-platform=$(PLATFORM) \
--concurrency=$(CONCURRENCY) \
--keep-failed="$(KEEP_FAILED)" \
--tags="$(TAGS)"
# golangci-lint runs at a pinned version, so a Homebrew upgrade cannot move the # golangci-lint runs at a pinned version, so a Homebrew upgrade cannot move the
# findings under the zero-warnings policy. An env var of the same name overrides # findings under the zero-warnings policy. An env var of the same name overrides
# it. # it.

View File

@@ -1,6 +1,6 @@
# Gotenberg v9 QA corpus manifest # Gotenberg v9 QA corpus manifest
Root: `test/integration/testdata/corpus`. Generators in `generators/` (see its README). Page counts marked "(LO)" were measured by converting with the LibreOffice in the gotenberg:snapshot image and `pdfinfo`; "expected" counts were not measured. Root: `test/corpus/testdata`; the file paths below are relative to it. Generators in `generators/` (see its README). Page counts marked "(LO)" were measured by converting with the LibreOffice in the gotenberg:snapshot image and `pdfinfo`; "expected" counts were not measured.
## web/ (Chromium routes) ## web/ (Chromium routes)

View File

@@ -1,31 +1,36 @@
# Release QA corpus # Release QA corpus
Realistic documents with known contents, and the facts the integration tests assert about them. `corpus.feature` turns the black-box QA of Gotenberg 9.0.0 into a regression suite that runs against every image. Realistic documents with known contents, and the facts the scenarios assert about them. This suite turns the black-box QA of Gotenberg 9.0.0 into a regression suite that runs against the full image. It is separate from the quick per-route scenarios of [`test/integration/`](../integration/README.md), and shares their step library and runner.
## Why ## Why
The other fixtures in `testdata/` are minimal: a page with a marker, a form with one field. They prove that a route answers. They say nothing about what a 10-page contract, a 3-sheet budget, a deck with a hidden slide, a multilingual page or an encrypted report comes out as. The fixtures of `test/integration/testdata/` are minimal: a page with a marker, a form with one field. They prove that a route answers. They say nothing about what a 10-page contract, a 3-sheet budget, a deck with a hidden slide, a multilingual page or an encrypted report comes out as.
The 9.0.0 release QA converted such documents, about 80 files, through every route and option, and compared the output with what each document contains. It found defects the minimal fixtures could not: a CSV converted to one cell per line, a Factur-X invoice embedded without a check, a truncated PDF that `metadata` accepted, element backgrounds that the docs described wrong. Keeping the documents here, with their facts written down, means the next change to Gotenberg, lok, litho, Chromium or LibreOffice runs against the same documents and the same facts. The 9.0.0 release QA converted such documents, about 80 files, through every route and option, and compared the output with what each document contains. It found defects the minimal fixtures could not: a CSV converted to one cell per line, a Factur-X invoice embedded without a check, a truncated PDF that `metadata` accepted, element backgrounds that the docs described wrong. Keeping the documents here, with their facts written down, means the next change to Gotenberg, lok, litho, Chromium or LibreOffice runs against the same documents and the same facts.
The rule: a file that exists to exercise one field belongs in `test/integration/testdata/`; a document that stands for a real user file, with its facts in the manifest, belongs in `test/corpus/testdata/`.
Each fact is known by construction or measured once. A generated document knows its page breaks, markers, metadata and sizes because the script wrote them. A fact the engine decides, such as the page count of a text file, was measured on the image and recorded as measured, not as hoped. [`MANIFEST.md`](MANIFEST.md) lists every file with its format, what it contains and what a scenario can assert, then where the image differs from the document's intent. Each fact is known by construction or measured once. A generated document knows its page breaks, markers, metadata and sizes because the script wrote them. A fact the engine decides, such as the page count of a text file, was measured on the image and recorded as measured, not as hoped. [`MANIFEST.md`](MANIFEST.md) lists every file with its format, what it contains and what a scenario can assert, then where the image differs from the document's intent.
## What is in it ## What is in it
Under `testdata/`:
- `web/`, for the Chromium routes: sites with their assets, CSS page sizes and breaks, a header and a footer, a delayed render, a console error, a Markdown bundle, a long landing page, multilingual text, a wide table, and the invoice site as a ZIP archive. - `web/`, for the Chromium routes: sites with their assets, CSS page sizes and breaks, a header and a footer, a delayed render, a console error, a Markdown bundle, a long landing page, multilingual text, a wide table, and the invoice site as a ZIP archive.
- `office/`, for the LibreOffice route: the same memo, figures and pitch across fifteen formats, a contract, a budget, a deck with a hidden slide and notes, a CSV, tracked changes, a form, plain text, a letter, and images in seven formats. - `office/`, for the LibreOffice route: the same memo, figures and pitch across fifteen formats, a contract, a budget, a deck with a hidden slide and notes, a CSV, tracked changes, a form, plain text, a letter, and images in seven formats.
- `pdf/`, for the PDF routes: a report with text at known coordinates for redaction and stamps, an annex to merge, a letterhead, transparency, CMYK colors, an image-heavy file, AES and RC4 encrypted copies, a CII invoice, a certificate, a stamp image and an attachment. - `pdf/`, for the PDF routes: a report with text at known coordinates for redaction and stamps, an annex to merge, a letterhead, transparency, CMYK colors, an image-heavy file, AES and RC4 encrypted copies, a CII invoice, a certificate, a stamp image and an attachment.
- `generators/`: the scripts that wrote the generated files, and the commands that made the hand-made ones. See its [README](generators/README.md). - `generators/`: the scripts that wrote the generated files, and the commands that made the hand-made ones. See its [README](testdata/generators/README.md).
## How the scenarios use it ## How the scenarios use it
`test/integration/features/corpus.feature` carries the `@corpus` tag, and each scenario one of `@corpus-chromium`, `@corpus-libreoffice` and `@corpus-pdf`. A scenario sends one document, or one list of stages, and asserts the manifest's facts on the answer: the page count, the page size in points, the text on a given page, the metadata, the outline, the number of images, the embedded files, PDF/A conformance, the Factur-X XMP. Two scenario outlines cover the format variants of the memo, the figures and the pitch, and the image inputs. `features/` holds one file per engine: `chromium.feature`, `libreoffice.feature` and `pdf.feature`, tagged `@chromium`, `@libreoffice` and `@pdf`. A scenario sends one document, or one list of stages, and asserts the manifest's facts on the answer: the page count, the page size in points, the text on a given page, the metadata, the outline, the number of images, the embedded files, PDF/A conformance, the Factur-X XMP. Two scenario outlines cover the format variants of the memo, the figures and the pitch, and the image inputs.
```bash ```bash
make build make build
make test-integration TAGS=corpus make test-corpus
make test-integration TAGS=corpus-libreoffice make test-corpus TAGS=chromium
make test-integration TAGS=corpus-pdf KEEP_FAILED=/tmp/failed make test-corpus TAGS=libreoffice
make test-corpus TAGS=pdf KEEP_FAILED=/tmp/failed
``` ```
A scenario asserts what the image produces, and the manifest says when that differs from the document's intent: `readme.txt` paginates to 4 pages, a spreadsheet cell clips its text to `REVENUE-SH`, the deleted text of a tracked change is absent. When a fix changes such an outcome, update the manifest and the scenario together. A scenario asserts what the image produces, and the manifest says when that differs from the document's intent: `readme.txt` paginates to 4 pages, a spreadsheet cell clips its text to `REVENUE-SH`, the deleted text of a tracked change is absent. When a fix changes such an outcome, update the manifest and the scenario together.
@@ -35,12 +40,12 @@ A scenario asserts what the image produces, and the manifest says when that diff
1. Generate the document with a script in `generators/`, so its facts are known by construction, and check in the script with the file. A file made once by hand, such as an encrypted copy or a certificate, goes in the "Not scripted" list of `generators/README.md` with the command that made it. 1. Generate the document with a script in `generators/`, so its facts are known by construction, and check in the script with the file. A file made once by hand, such as an encrypted copy or a certificate, goes in the "Not scripted" list of `generators/README.md` with the command that made it.
2. Put a unique marker in every region a scenario reads (`REPORT-PAGE-2`, `COSTS-SHEET-MARKER`), not prose: text extraction keeps a marker intact across fonts, scripts and line breaks. 2. Put a unique marker in every region a scenario reads (`REPORT-PAGE-2`, `COSTS-SHEET-MARKER`), not prose: text extraction keeps a marker intact across fonts, scripts and line breaks.
3. Record the file in `MANIFEST.md`: format, contents, and the facts a scenario can assert. Measure a page count on the image rather than expecting it, and say so. 3. Record the file in `MANIFEST.md`: format, contents, and the facts a scenario can assert. Measure a page count on the image rather than expecting it, and say so.
4. Write the scenario in `corpus.feature` under the engine's tag, asserting those facts, before any Go change. Reuse the steps listed in [`test/integration/README.md`](../../README.md), and add one there only when no existing step reads the fact. 4. Write the scenario in the engine's file under `features/`, asserting those facts, before any Go change. Reuse the steps listed in [`test/integration/README.md`](../integration/README.md), and add one there only when no existing step reads the fact.
5. Keep the corpus small. It weighs 2 MB: share an asset between files rather than embedding a new one, and prefer an existing `testdata/` file over a copy. The manifest's "Left out" list names the ones the corpus reuses. 5. Keep the corpus small. It weighs 2 MB: share an asset between files rather than embedding a new one, and prefer an existing `test/integration/testdata/` file over a copy. The manifest's "Left out" list names the ones the corpus reuses.
6. Run `make test-integration TAGS=corpus-<engine>` and `make lint-prettier`. 6. Run `make test-corpus TAGS=<engine>` and `make lint-prettier`.
`.prettierignore` excludes the fixtures: the manifest records their byte sizes, and the HTML and CSS are what the generators wrote. Don't reformat them. `.prettierignore` excludes the fixtures: the manifest records their byte sizes, and the HTML and CSS are what the generators wrote. Don't reformat them.
## What it is not ## What it is not
The per-route feature files stay the place for one field or one stage at a time, every error message, and every edge of the API. The corpus asserts outcomes on realistic documents end to end. It is not a benchmark either: it runs against the same image as the other scenarios, and its timings mean nothing. The per-route feature files of `test/integration/` stay the place for one field or one stage at a time, every error message, and every edge of the API. The corpus asserts outcomes on realistic documents end to end. It is not a benchmark either: it runs against the same image as the integration scenarios, and its timings mean nothing.

View File

@@ -0,0 +1,270 @@
@chromium
Feature: Chromium corpus
Realistic web documents with known contents, described in testdata/MANIFEST.md.
Each scenario sends a site, a page or a Markdown bundle through the Chromium routes.
# The page break comes from the CSS (`break-before: page` on the payment terms heading) and
# the size from `@page { size: A4 }`.
Scenario: Invoice site (2 A4 pages)
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/html" endpoint with the following form data and header(s):
| files | testdata/web/invoice/index.html | file |
| files | testdata/web/invoice/style.css | file |
| files | testdata/web/invoice/logo.png | file |
| files | testdata/web/invoice/header.html | file |
| files | testdata/web/invoice/footer.html | file |
| preferCssPageSize | true | field |
| printBackground | true | field |
| nativeBookmarks | true | field |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the "foo.pdf" PDF should have 2 page(s)
Then the "foo.pdf" PDF page 1 should be 595.28x841.89 points
Then the "foo.pdf" PDF page 2 should be 595.28x841.89 points
Then the "foo.pdf" PDF should have the "Title" metadata set to "Invoice INV-2026-0042"
Then the "foo.pdf" PDF should have a document outline
Then the "foo.pdf" PDF should have the following content at page 1:
"""
Northwind Traders
"""
Then the "foo.pdf" PDF should have the following content at page 1:
"""
Contoso Ltd
"""
Then the "foo.pdf" PDF should have the following content at page 1:
"""
4,620.00 EUR
"""
Then the "foo.pdf" PDF should NOT have the following content at page 1:
"""
Payment terms
"""
Then the "foo.pdf" PDF should have content matching "Page\s*1\s*of\s*2" at page 1
Then the "foo.pdf" PDF should have content matching "Page\s*2\s*of\s*2" at page 2
Then the "foo.pdf" PDF should have the following content at page 2:
"""
Payment terms
"""
Then the "foo.pdf" PDF should have the following content at page 2:
"""
IBAN FR76 3000 6000 0112 3456 7890 189
"""
Scenario: Invoice site from a ZIP archive
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/html" endpoint with the following form data and header(s):
| archives | testdata/web/site.zip | file |
| preferCssPageSize | true | field |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the "foo.pdf" PDF should have 2 page(s)
Then the "foo.pdf" PDF page 1 should be 595.28x841.89 points
Then the "foo.pdf" PDF should have the following content at page 1:
"""
Invoice INV-2026-0042
"""
Then the "foo.pdf" PDF should have the following content at page 2:
"""
IBAN FR76 3000 6000 0112 3456 7890 189
"""
Scenario: Delayed content waits for an expression
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/html" endpoint with the following form data and header(s):
| files | testdata/web/wait/index.html | file |
| waitForExpression | window.chartReady === true | field |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the "foo.pdf" PDF should have 1 page(s)
Then the "foo.pdf" PDF should have the following content at page 1:
"""
Revenue: 42,000 EUR
"""
Then the "foo.pdf" PDF should NOT have the following content at page 1:
"""
Loading
"""
# The exception happens after the render: the page converts unless the flag is set.
Scenario: A console exception fails the conversion
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/html" endpoint with the following form data and header(s):
| files | testdata/web/console-error/index.html | file |
| failOnConsoleExceptions | true | field |
Then the response status code should be 409
Then the response body should contain string:
"""
Chromium console exceptions
"""
When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/html" endpoint with the following form data and header(s):
| files | testdata/web/console-error/index.html | file |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the "foo.pdf" PDF should have 1 page(s)
Then the "foo.pdf" PDF should have the following content at page 1:
"""
Console error page
"""
# The inline script sets the title to "pwned" if it runs. The title stays the one of the
# template and the text right after the script survives.
Scenario: Markdown bundle keeps the text and the title
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/markdown" endpoint with the following form data and header(s):
| files | testdata/web/markdown/index.html | file |
| files | testdata/web/markdown/release-notes.md | file |
| files | testdata/web/markdown/changelog.md | file |
| files | testdata/web/markdown/style.css | file |
| files | testdata/web/markdown/screenshot.png | file |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the "foo.pdf" PDF should have the "Title" metadata set to "Release notes 9.0.0"
Then the "foo.pdf" PDF should have 2 page(s)
Then the "foo.pdf" PDF should have the following content at page 1:
"""
Release notes 9.0.0
"""
Then the "foo.pdf" PDF should have the following content at page 1:
"""
CODE-BLOCK-MARKER
"""
Then the "foo.pdf" PDF should have the following content at page 1:
"""
DONE-TASK
"""
Then the "foo.pdf" PDF should have the following content at page 1:
"""
OPEN-TASK
"""
Then the "foo.pdf" PDF should have the following content at page 1:
"""
Removed legacy flag
"""
Then the "foo.pdf" PDF should have the following content at page 2:
"""
SANITIZE-ME-MARKER
"""
Then the "foo.pdf" PDF should have the following content at page 2:
"""
CHANGELOG-V9
"""
Then the "foo.pdf" PDF should have the following content at page 2:
"""
CHANGELOG-V8
"""
Then the "foo.pdf" PDF should have 1 image(s)
# The navigation is hidden in print, and a block shows only from a 1200 px viewport.
Scenario: Landing page: print media and viewport width
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/html" endpoint with the following form data and header(s):
| files | testdata/web/landing/index.html | file |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the "foo.pdf" PDF should have the following content at page 1:
"""
Start free trial
"""
Then the "foo.pdf" PDF should NOT have the following content at page 1:
"""
Pricing
"""
Then the "foo.pdf" PDF should NOT have the following content at page 1:
"""
WIDE-LAYOUT-MARKER
"""
When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/html" endpoint with the following form data and header(s):
| files | testdata/web/landing/index.html | file |
| paperWidth | 14 | field |
| paperHeight | 11 | field |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the "foo.pdf" PDF should have the following content at page 1:
"""
WIDE-LAYOUT-MARKER
"""
When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/html" endpoint with the following form data and header(s):
| files | testdata/web/landing/index.html | file |
| singlePage | true | field |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the "foo.pdf" PDF should have 1 page(s)
Then the "foo.pdf" PDF should have the following content at page 1:
"""
Start free trial
"""
# The Latin marker of a right-to-left line can come out as ":AR": the patterns accept both.
Scenario: Multilingual page renders every script
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/html" endpoint with the following form data and header(s):
| files | testdata/web/i18n/index.html | file |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the "foo.pdf" PDF should have 1 page(s)
Then the "foo.pdf" PDF should have the following content at page 1:
"""
Multilingual
"""
Then the "foo.pdf" PDF should have content matching "AR:|:AR" at page 1
Then the "foo.pdf" PDF should have content matching "HE:|:HE" at page 1
Then the "foo.pdf" PDF should have content matching "ZH:|:ZH" at page 1
Then the "foo.pdf" PDF should have content matching "JA:|:JA" at page 1
Then the "foo.pdf" PDF should have content matching "KO:|:KO" at page 1
Then the "foo.pdf" PDF should have content matching "TH:|:TH" at page 1
Then the "foo.pdf" PDF should have content matching "HI:|:HI" at page 1
Then the "foo.pdf" PDF should have content matching "EL:|:EL" at page 1
Then the "foo.pdf" PDF should have content matching "RU:|:RU" at page 1
Then the "foo.pdf" PDF should have content matching "EMOJI:|:EMOJI" at page 1
Then the "foo.pdf" PDF should have content matching "MATH:|:MATH" at page 1
Scenario: Print CSS handbook gives A5 pages
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/html" endpoint with the following form data and header(s):
| files | testdata/web/print-css/index.html | file |
| files | testdata/web/print-css/print.css | file |
| preferCssPageSize | true | field |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the "foo.pdf" PDF should have 4 page(s)
Then the "foo.pdf" PDF page 1 should be 419.53x595.28 points
Then the "foo.pdf" PDF page 4 should be 419.53x595.28 points
Then the "foo.pdf" PDF should have the following content at page 1:
"""
Handbook
"""
Then the "foo.pdf" PDF should NOT have the following content at page 1:
"""
NAV-MARKER
"""
Then the "foo.pdf" PDF should have the following content at page 2:
"""
CHAPTER-ONE
"""
Then the "foo.pdf" PDF should have the following content at page 3:
"""
CHAPTER-TWO
"""
Then the "foo.pdf" PDF should have the following content at page 4:
"""
CHAPTER-THREE
"""
Scenario: Wide table on a single page
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/html" endpoint with the following form data and header(s):
| files | testdata/web/wide-table/index.html | file |
| singlePage | true | field |
| landscape | true | field |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the "foo.pdf" PDF should have 1 page(s)
Then the "foo.pdf" PDF should have the "Title" metadata set to "Wide table"
Then the "foo.pdf" PDF should have the following content at page 1:
"""
C01
"""
Then the "foo.pdf" PDF should have the following content at page 1:
"""
r40c30
"""

View File

@@ -0,0 +1,293 @@
@libreoffice
Feature: LibreOffice corpus
Realistic office documents with known contents, described in testdata/MANIFEST.md.
Each scenario sends a contract, a budget, a deck, a text file or an image through the LibreOffice route.
Scenario: Contract DOCX (10 pages)
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/libreoffice/convert" endpoint with the following form data and header(s):
| files | testdata/office/contract.docx | file |
| nativeBookmarks | true | field |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the "foo.pdf" PDF should have 10 page(s)
Then the "foo.pdf" PDF should have the following content at page 1:
"""
Master Services Agreement
"""
Then the "foo.pdf" PDF should have the following content at page 10:
"""
Schedule A
"""
Then the "foo.pdf" PDF should NOT have the following content at page 1:
"""
Schedule A
"""
Then the "foo.pdf" PDF should have the "Title" metadata set to "Master Services Agreement"
Then the "foo.pdf" PDF should have the "Author" metadata set to "Legal Department"
Then the "foo.pdf" PDF should have the "Subject" metadata set to "Services"
Then the "foo.pdf" PDF should have the "Keywords" metadata set to "contract, msa"
Then the "foo.pdf" PDF should have a document outline
Then the "foo.pdf" PDF should have content matching "Page" at page 1
# The first column clips long cells ("Cloud host"). The Monthly sheet spans two pages; `singlePage` fits each sheet on one page.
Scenario: Budget XLSX (3 sheets)
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/libreoffice/convert" endpoint with the following form data and header(s):
| files | testdata/office/budget.xlsx | file |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the "foo.pdf" PDF should have 4 page(s)
Then the "foo.pdf" PDF should have the following content at page 1:
"""
FY2026 Budget
"""
Then the "foo.pdf" PDF should have the following content at page 1:
"""
Cloud host
"""
When I make a "POST" request to Gotenberg at the "/forms/libreoffice/convert" endpoint with the following form data and header(s):
| files | testdata/office/budget.xlsx | file |
| singlePage | true | field |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the "foo.pdf" PDF should have 3 page(s)
Then the "foo.pdf" PDF should have the following content at page 1:
"""
FY2026 Budget
"""
Then the "foo.pdf" PDF should have the following content at page 3:
"""
Budget not
"""
Then the "foo.pdf" PDF should have the following content at page 3:
"""
Prepared
"""
Scenario: Deck PPTX without the hidden slide, then with notes pages
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/libreoffice/convert" endpoint with the following form data and header(s):
| files | testdata/office/deck.pptx | file |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the "foo.pdf" PDF should have 7 page(s)
Then the "foo.pdf" PDF should have the following content at page 1:
"""
Q4 Product Review
"""
Then the "foo.pdf" PDF should have the following content at page 2:
"""
Agenda
"""
Then the "foo.pdf" PDF should have the following content at page 4:
"""
R2C2
"""
Then the "foo.pdf" PDF should have the following content at page 7:
"""
Thank you
"""
Then the "foo.pdf" PDF should NOT have content matching "HIDDEN-SLIDE-MARKER" at page 1
Then the "foo.pdf" PDF should NOT have content matching "HIDDEN-SLIDE-MARKER" at page 2
Then the "foo.pdf" PDF should NOT have content matching "HIDDEN-SLIDE-MARKER" at page 3
Then the "foo.pdf" PDF should NOT have content matching "HIDDEN-SLIDE-MARKER" at page 4
Then the "foo.pdf" PDF should NOT have content matching "HIDDEN-SLIDE-MARKER" at page 5
Then the "foo.pdf" PDF should NOT have content matching "HIDDEN-SLIDE-MARKER" at page 6
Then the "foo.pdf" PDF should NOT have content matching "HIDDEN-SLIDE-MARKER" at page 7
Then the "foo.pdf" PDF should NOT have content matching "NOTES-MARKER" at page 2
When I make a "POST" request to Gotenberg at the "/forms/libreoffice/convert" endpoint with the following form data and header(s):
| files | testdata/office/deck.pptx | file |
| exportNotesPages | true | field |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the "foo.pdf" PDF should have 14 page(s)
Then the "foo.pdf" PDF should have the following content at page 9:
"""
NOTES-MARKER-2
"""
Then the "foo.pdf" PDF should have the following content at page 14:
"""
NOTES-MARKER-8
"""
Then the "foo.pdf" PDF should NOT have content matching "HIDDEN-SLIDE-MARKER" at page 7
Then the "foo.pdf" PDF should NOT have content matching "HIDDEN-SLIDE-MARKER" at page 13
# Fails until lok passes the CSV import options: every line lands in one cell today.
Scenario: CSV keeps its columns
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/libreoffice/convert" endpoint with the following form data and header(s):
| files | testdata/office/sales.csv | file |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the "foo.pdf" PDF should have the following content at page 1:
"""
customer
"""
Then the "foo.pdf" PDF should NOT have the following content at page 1:
"""
id,date,customer
"""
Then the "foo.pdf" PDF should have the following content at page 1:
"""
Café Müller
"""
Then the "foo.pdf" PDF should have the following content at page 1:
"""
Straße GmbH
"""
Then the "foo.pdf" PDF should have the following content at page 1:
"""
Élodie & Fils
"""
Scenario: Tracked changes keep the inserted text
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/libreoffice/convert" endpoint with the following form data and header(s):
| files | testdata/office/tracked.docx | file |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the "foo.pdf" PDF should have 1 page(s)
Then the "foo.pdf" PDF should have the following content at page 1:
"""
INSERTED-TEXT
"""
Then the "foo.pdf" PDF should have the following content at page 1:
"""
End of sentence.
"""
Scenario: Multilingual DOCX
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/libreoffice/convert" endpoint with the following form data and header(s):
| files | testdata/office/i18n.docx | file |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the "foo.pdf" PDF should have 1 page(s)
Then the "foo.pdf" PDF should have the following content at page 1:
"""
Multilingual document
"""
Then the "foo.pdf" PDF should have content matching "AR:|:AR" at page 1
Then the "foo.pdf" PDF should have content matching "HE:|:HE" at page 1
Then the "foo.pdf" PDF should have content matching "ZH:|:ZH" at page 1
Then the "foo.pdf" PDF should have content matching "JA:|:JA" at page 1
Then the "foo.pdf" PDF should have content matching "KO:|:KO" at page 1
Then the "foo.pdf" PDF should have content matching "TH:|:TH" at page 1
Then the "foo.pdf" PDF should have content matching "HI:|:HI" at page 1
Then the "foo.pdf" PDF should have content matching "EL:|:EL" at page 1
Then the "foo.pdf" PDF should have content matching "RU:|:RU" at page 1
Then the "foo.pdf" PDF should have content matching "EMOJI:|:EMOJI" at page 1
Then the "foo.pdf" PDF should have content matching "MATH:|:MATH" at page 1
Scenario: Form ODT keeps its text
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/libreoffice/convert" endpoint with the following form data and header(s):
| files | testdata/office/form.odt | file |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the "foo.pdf" PDF should have 1 page(s)
Then the "foo.pdf" PDF should have the following content at page 1:
"""
FORM-DOC-MARKER
"""
# The manifest counted 3 pages with another LibreOffice build; the image gives 4.
Scenario: Plain text paginates
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/libreoffice/convert" endpoint with the following form data and header(s):
| files | testdata/office/readme.txt | file |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the "foo.pdf" PDF should have 4 page(s)
Then the "foo.pdf" PDF should have the following content at page 1:
"""
Line 01:
"""
Then the "foo.pdf" PDF should have the following content at page 4:
"""
Line 60:
"""
Then the "foo.pdf" PDF should have the following content at page 1:
"""
Café résumé naïve déjà vu
"""
Scenario: WebP is not an accepted input
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/libreoffice/convert" endpoint with the following form data and header(s):
| files | testdata/office/images/pic.webp | file |
Then the response status code should be 400
Then the response body should contain string:
"""
Invalid form data: no form file found for extensions:
"""
Scenario Outline: Office formats convert with the documented pages and text
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/libreoffice/convert" endpoint with the following form data and header(s):
| files | testdata/office/<file> | file |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the "foo.pdf" PDF should have <pages> page(s)
Then the "foo.pdf" PDF should have the following content at page <page>:
"""
<marker>
"""
Examples:
| file | pages | page | marker |
| memo.fodt | 1 | 1 | MEMO-END-MARKER |
| memo.odt | 1 | 1 | MEMO-END-MARKER |
| memo.doc | 1 | 1 | MEMO-END-MARKER |
| memo.rtf | 1 | 1 | MEMO-END-MARKER |
| memo-lo.docx | 1 | 1 | MEMO-END-MARKER |
| memo.html | 1 | 1 | MEMO-END-MARKER |
| memo.pdf | 1 | 1 | MEMO-END-MARKER |
| figures.fods | 2 | 1 | REVENUE-SH |
| figures.fods | 2 | 2 | COSTS-SHEE |
| figures.ods | 2 | 1 | REVENUE-SH |
| figures.ods | 2 | 2 | COSTS-SHEE |
| figures.xls | 2 | 1 | REVENUE-SH |
| figures.xls | 2 | 2 | COSTS-SHEE |
| figures-lo.xlsx | 2 | 1 | REVENUE-SH |
| figures-lo.xlsx | 2 | 2 | COSTS-SHEE |
| pitch.fodp | 4 | 1 | PITCH-1 |
| pitch.fodp | 4 | 4 | PITCH-4 |
| pitch.odp | 4 | 1 | PITCH-1 |
| pitch.odp | 4 | 4 | PITCH-4 |
| pitch.ppt | 4 | 1 | PITCH-1 |
| pitch.ppt | 4 | 4 | PITCH-4 |
| pitch-lo.pptx | 4 | 1 | PITCH-1 |
| pitch-lo.pptx | 4 | 4 | PITCH-4 |
| letter.rtf | 1 | 1 | Northwind Traders |
| letter.rtf | 1 | 1 | Second item |
| page.htm | 1 | 1 | HTM-MARKER |
| data.xml | 1 | 1 | XML-MARKER |
| data.xml | 1 | 1 | Second |
Scenario Outline: Image formats convert to a one-page PDF
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/libreoffice/convert" endpoint with the following form data and header(s):
| files | testdata/office/images/<file> | file |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then there should be 1 PDF(s) in the response
Then the "foo.pdf" PDF should have 1 page(s)
Then the "foo.pdf" PDF should have 1 image(s)
Examples:
| file |
| photo.jpg |
| diagram.png |
| icon.gif |
| scan.tif |
| pic.bmp |
Scenario: SVG converts to a one-page PDF
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/libreoffice/convert" endpoint with the following form data and header(s):
| files | testdata/office/images/logo.svg | file |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the "foo.pdf" PDF should have 1 page(s)

View File

@@ -0,0 +1,247 @@
@pdf
Feature: PDF corpus
Realistic PDF files with known contents, described in testdata/MANIFEST.md.
Each scenario sends a report, an annex, an invoice or an encrypted copy through the PDF routes.
Scenario: Report PDF: info and metadata
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/pdf/info" endpoint with the following form data and header(s):
| files | testdata/pdf/report.pdf | file |
Then the response status code should be 200
Then the response body should match JSON:
"""
{
"report.pdf": {
"pages": 3,
"version": "ignore",
"encrypted": false,
"tagged": false,
"linearized": false,
"formFields": false
}
}
"""
When I make a "POST" request to Gotenberg at the "/forms/pdf/metadata" endpoint with the following form data and header(s):
| files | testdata/pdf/report.pdf | file |
Then the response status code should be 200
Then the response body should match JSON:
"""
{
"report.pdf": {
"title": "Quarterly Report",
"author": "Finance"
}
}
"""
When I make a "POST" request to Gotenberg at the "/forms/pdf/merge" endpoint with the following form data and header(s):
| files | testdata/pdf/report.pdf | file |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the "foo.pdf" PDF should have 3 page(s)
Then the "foo.pdf" PDF page 1 should be 612x792 points
Then the "foo.pdf" PDF page 3 should be 612x792 points
Then the "foo.pdf" PDF should have the "Title" metadata set to "Quarterly Report"
Then the "foo.pdf" PDF should have the following content at page 1:
"""
Body line 1 of page 1
"""
Then the "foo.pdf" PDF should have the following content at page 3:
"""
REPORT-PAGE-3
"""
Scenario: Redaction removes the label of page 1 only
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/pdf/redact" endpoint with the following form data and header(s):
| files | testdata/pdf/report.pdf | file |
| regions | [{"page":1,"x":70,"y":388,"width":300,"height":42}] | field |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the "foo.pdf" PDF should have 3 page(s)
Then the "foo.pdf" PDF should NOT have the following content at page 1:
"""
REPORT-PAGE-1
"""
Then the "foo.pdf" PDF should have the following content at page 1:
"""
Quarterly Report
"""
Then the "foo.pdf" PDF should have the following content at page 1:
"""
Body line 1 of page 1
"""
Then the "foo.pdf" PDF should have the following content at page 2:
"""
REPORT-PAGE-2
"""
Then the "foo.pdf" PDF should have the following content at page 3:
"""
REPORT-PAGE-3
"""
Then the "foo.pdf" PDF page 1 should be 612x792 points
# Inputs merge in the order of their filenames, so the annex comes first.
Scenario: Merge report and annex
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/pdf/merge" endpoint with the following form data and header(s):
| files | testdata/pdf/report.pdf | file |
| files | testdata/pdf/annex.pdf | file |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the "foo.pdf" PDF should have 5 page(s)
Then the "foo.pdf" PDF page 5 should be 612x792 points
Then the "foo.pdf" PDF should have the following content at page 1:
"""
ANNEX-PAGE-1
"""
Then the "foo.pdf" PDF should have the following content at page 2:
"""
ANNEX-PAGE-2
"""
Then the "foo.pdf" PDF should have the following content at page 3:
"""
REPORT-PAGE-1
"""
Then the "foo.pdf" PDF should have the following content at page 4:
"""
REPORT-PAGE-2
"""
Then the "foo.pdf" PDF should have the following content at page 5:
"""
REPORT-PAGE-3
"""
Scenario: Stamp text and image
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/pdf/stamp-text" endpoint with the following form data and header(s):
| files | testdata/pdf/report.pdf | file |
| text | APPROVED-STAMP | field |
| pages | 1 | field |
| x | 72 | field |
| y | 200 | field |
| fontSize | 24 | field |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the "foo.pdf" PDF should have 3 page(s)
Then the "foo.pdf" PDF should have the following content at page 1:
"""
REPORT-PAGE-1
"""
When I make a "POST" request to Gotenberg at the "/forms/pdf/stamp-image" endpoint with the following form data and header(s):
| files | testdata/pdf/report.pdf | file |
| files | testdata/pdf/stamp.jpg | file |
| image | stamp.jpg | field |
| pages | 1 | field |
| width | 150 | field |
| height | 50 | field |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the "foo.pdf" PDF should have 3 page(s)
Then the "foo.pdf" PDF should have 1 image(s)
Scenario: Letterhead stamped under the report
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/pdf/stamp-pdf" endpoint with the following form data and header(s):
| files | testdata/pdf/report.pdf | file |
| files | testdata/pdf/letterhead.pdf | file |
| source | letterhead.pdf | field |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the "foo.pdf" PDF should have 3 page(s)
Then the "foo.pdf" PDF should have the following content at page 1:
"""
REPORT-PAGE-1
"""
Scenario: Encrypted PDF needs its password
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/pdf/info" endpoint with the following form data and header(s):
| files | testdata/pdf/encrypted.pdf | file |
Then the response status code should be 400
When I make a "POST" request to Gotenberg at the "/forms/pdf/info" endpoint with the following form data and header(s):
| files | testdata/pdf/encrypted.pdf | file |
| password | secret | field |
Then the response status code should be 200
Then the response body should match JSON:
"""
{
"encrypted.pdf": {
"pages": 3,
"encrypted": true
}
}
"""
When I make a "POST" request to Gotenberg at the "/forms/pdf/decrypt" endpoint with the following form data and header(s):
| files | testdata/pdf/encrypted.pdf | file |
Then the response status code should be 400
When I make a "POST" request to Gotenberg at the "/forms/pdf/decrypt" endpoint with the following form data and header(s):
| files | testdata/pdf/encrypted.pdf | file |
| password | secret | field |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the response PDF(s) should NOT be encrypted
Then the "foo.pdf" PDF should have 3 page(s)
Then the "foo.pdf" PDF should have the following content at page 3:
"""
REPORT-PAGE-3
"""
When I make a "POST" request to Gotenberg at the "/forms/pdf/decrypt" endpoint with the following form data and header(s):
| files | testdata/pdf/encrypted-rc4.pdf | file |
| password | secret | field |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the response PDF(s) should NOT be encrypted
Then the "foo.pdf" PDF should have 3 page(s)
Then the "foo.pdf" PDF should have the following content at page 2:
"""
REPORT-PAGE-2
"""
Scenario: Factur-X embeds the CII invoice
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/pdf/remediate" endpoint with the following form data and header(s):
| files | testdata/pdf/report.pdf | file |
| files | testdata/pdf/invoice-cii.xml | file |
| profile | Factur-X | field |
| xml | invoice-cii.xml | field |
| level | EN 16931 | field |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the response header "Gotenberg-Remediation-Residual" should be "0"
Then the "foo.pdf" PDF should have 3 page(s)
Then the "foo.pdf" PDF should have the "Title" metadata set to "Quarterly Report"
Then the response PDF(s) should be valid "PDF/A-3b" with a tolerance of 0 failed rule(s)
Then the response PDF(s) should have the "factur-x.xml" file embedded with relationship "Alternative"
Then the response PDF(s) should declare Factur-X XMP with conformance level "EN 16931"
Scenario: Transparency remediates to PDF/A-2b
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/pdf/remediate" endpoint with the following form data and header(s):
| files | testdata/pdf/transparent.pdf | file |
| profile | PDF/A-2b | field |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the "foo.pdf" PDF should have 1 page(s)
Then the "foo.pdf" PDF should have the following content at page 1:
"""
TRANSPARENT-MARKER
"""
Then the response PDF(s) should be valid "PDF/A-2b" with a tolerance of 0 failed rule(s)
Scenario: Color and image-heavy samples read back
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/pdf/info" endpoint with the following form data and header(s):
| files | testdata/pdf/colors.pdf | file |
| files | testdata/pdf/image-heavy.pdf | file |
Then the response status code should be 200
Then the response body should match JSON:
"""
{
"colors.pdf": {
"pages": 1
},
"image-heavy.pdf": {
"pages": 3
}
}
"""

13
test/corpus/main_test.go Normal file
View File

@@ -0,0 +1,13 @@
//go:build corpus
package corpus
import (
"testing"
"github.com/gotenberg/gotenberg/v9/test/integration/scenario"
)
func TestMain(_ *testing.M) {
scenario.RunSuite("corpus")
}

View File

@@ -2,7 +2,7 @@
These scripts are the provenance of the corpus fixtures one directory up. Run them only to regenerate a fixture; the generated files are checked in. These scripts are the provenance of the corpus fixtures one directory up. Run them only to regenerate a fixture; the generated files are checked in.
Run them in this order, with `C` set to a scratch copy of the corpus root and `B` to a scratch directory. The font paths are macOS paths (`/System/Library/Fonts/Supplemental/Arial*.ttf`); change them on another system. Run them in this order, with `C` set to a scratch copy of `testdata/` and `B` to a scratch directory. The font paths are macOS paths (`/System/Library/Fonts/Supplemental/Arial*.ttf`); change them on another system.
```bash ```bash
export C=/tmp/corpus B=/tmp/corpus-build export C=/tmp/corpus B=/tmp/corpus-build

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

View File

Before

Width:  |  Height:  |  Size: 272 B

After

Width:  |  Height:  |  Size: 272 B

View File

Before

Width:  |  Height:  |  Size: 218 KiB

After

Width:  |  Height:  |  Size: 218 KiB

View File

Before

Width:  |  Height:  |  Size: 225 KiB

After

Width:  |  Height:  |  Size: 225 KiB

View File

Before

Width:  |  Height:  |  Size: 6.0 KiB

After

Width:  |  Height:  |  Size: 6.0 KiB

View File

Before

Width:  |  Height:  |  Size: 69 B

After

Width:  |  Height:  |  Size: 69 B

View File

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View File

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

Before

Width:  |  Height:  |  Size: 5.8 KiB

After

Width:  |  Height:  |  Size: 5.8 KiB

View File

@@ -5,7 +5,7 @@ Gherkin (BDD) via [Godog](https://github.com/cucumber/godog), with `testcontaine
- Feature files: `test/integration/features/*.feature`, one per endpoint or capability. - Feature files: `test/integration/features/*.feature`, one per endpoint or capability.
- Step definitions: `test/integration/scenario/` (container management, HTTP helpers, PDF validation). - Step definitions: `test/integration/scenario/` (container management, HTTP helpers, PDF validation).
- Entry point: `test/integration/main_test.go` (build tag: `integration`). - Entry point: `test/integration/main_test.go` (build tag: `integration`).
- Test data: `test/integration/testdata/`. The release QA corpus sits in `testdata/corpus/` and backs `corpus.feature`: its [`README.md`](testdata/corpus/README.md) says why it exists and how to extend it, its `MANIFEST.md` what each file contains. - Test data: `test/integration/testdata/`, the fixtures of these scenarios. A file that exists to exercise one field belongs here; a document that stands for a real user file, with its facts in a manifest, belongs in `test/corpus/testdata/`. See the [corpus suite](../corpus/README.md).
Each scenario spins up a fresh Gotenberg Docker container via testcontainers. The PDF assertions read the produced documents with [litho](https://github.com/gotenberg/litho), in process: page count, size, text, tagging, bookmarks, metadata, attachments, permissions, signatures, and PDF/A and PDF/UA conformance. Each scenario spins up a fresh Gotenberg Docker container via testcontainers. The PDF assertions read the produced documents with [litho](https://github.com/gotenberg/litho), in process: page count, size, text, tagging, bookmarks, metadata, attachments, permissions, signatures, and PDF/A and PDF/UA conformance.
@@ -31,7 +31,6 @@ Available tags:
| Chromium | `chromium`, `chromium-concurrent`, `chromium-convert-html`, `chromium-image-deduplication`, `chromium-convert-markdown`, `chromium-convert-url`, `chromium-screenshot-html`, `chromium-screenshot-markdown`, `chromium-screenshot-url`, `chromium-ssrf` | | Chromium | `chromium`, `chromium-concurrent`, `chromium-convert-html`, `chromium-image-deduplication`, `chromium-convert-markdown`, `chromium-convert-url`, `chromium-screenshot-html`, `chromium-screenshot-markdown`, `chromium-screenshot-url`, `chromium-ssrf` |
| LibreOffice | `libreoffice`, `libreoffice-convert`, `libreoffice-ssrf` | | LibreOffice | `libreoffice`, `libreoffice-convert`, `libreoffice-ssrf` |
| PDF | `pdf`, `pdf-pipe`, `pdf-merge`, `pdf-split`, `pdf-pages`, `pdf-rotate`, `pdf-stamp`, `pdf-metadata`, `pdf-bookmarks`, `pdf-form`, `pdf-attach`, `pdf-encrypt`, `pdf-remediate`, `factur-x`, `pdf-sign`, `pdf-optimize`, `pdf-redact`, `pdf-colors`, `pdf-render`, `pdf-read` | | PDF | `pdf`, `pdf-pipe`, `pdf-merge`, `pdf-split`, `pdf-pages`, `pdf-rotate`, `pdf-stamp`, `pdf-metadata`, `pdf-bookmarks`, `pdf-form`, `pdf-attach`, `pdf-encrypt`, `pdf-remediate`, `factur-x`, `pdf-sign`, `pdf-optimize`, `pdf-redact`, `pdf-colors`, `pdf-render`, `pdf-read` |
| Corpus | `corpus`, `corpus-chromium`, `corpus-libreoffice`, `corpus-pdf` |
| Infra | `health`, `debug`, `root`, `version`, `output-filename`, `webhook`, `download-from`, `api-limits`, `api-archives` | | Infra | `health`, `debug`, `root`, `version`, `output-filename`, `webhook`, `download-from`, `api-limits`, `api-archives` |
## Writing a new test ## Writing a new test

View File

@@ -1,831 +0,0 @@
@corpus
Feature: Release QA corpus
Realistic documents with known contents, described in testdata/corpus/MANIFEST.md.
# The page break comes from the CSS (`break-before: page` on the payment terms heading) and
# the size from `@page { size: A4 }`.
@corpus-chromium
Scenario: Invoice site (2 A4 pages)
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/html" endpoint with the following form data and header(s):
| files | testdata/corpus/web/invoice/index.html | file |
| files | testdata/corpus/web/invoice/style.css | file |
| files | testdata/corpus/web/invoice/logo.png | file |
| files | testdata/corpus/web/invoice/header.html | file |
| files | testdata/corpus/web/invoice/footer.html | file |
| preferCssPageSize | true | field |
| printBackground | true | field |
| nativeBookmarks | true | field |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the "foo.pdf" PDF should have 2 page(s)
Then the "foo.pdf" PDF page 1 should be 595.28x841.89 points
Then the "foo.pdf" PDF page 2 should be 595.28x841.89 points
Then the "foo.pdf" PDF should have the "Title" metadata set to "Invoice INV-2026-0042"
Then the "foo.pdf" PDF should have a document outline
Then the "foo.pdf" PDF should have the following content at page 1:
"""
Northwind Traders
"""
Then the "foo.pdf" PDF should have the following content at page 1:
"""
Contoso Ltd
"""
Then the "foo.pdf" PDF should have the following content at page 1:
"""
4,620.00 EUR
"""
Then the "foo.pdf" PDF should NOT have the following content at page 1:
"""
Payment terms
"""
Then the "foo.pdf" PDF should have content matching "Page\s*1\s*of\s*2" at page 1
Then the "foo.pdf" PDF should have content matching "Page\s*2\s*of\s*2" at page 2
Then the "foo.pdf" PDF should have the following content at page 2:
"""
Payment terms
"""
Then the "foo.pdf" PDF should have the following content at page 2:
"""
IBAN FR76 3000 6000 0112 3456 7890 189
"""
@corpus-chromium
Scenario: Invoice site from a ZIP archive
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/html" endpoint with the following form data and header(s):
| archives | testdata/corpus/web/site.zip | file |
| preferCssPageSize | true | field |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the "foo.pdf" PDF should have 2 page(s)
Then the "foo.pdf" PDF page 1 should be 595.28x841.89 points
Then the "foo.pdf" PDF should have the following content at page 1:
"""
Invoice INV-2026-0042
"""
Then the "foo.pdf" PDF should have the following content at page 2:
"""
IBAN FR76 3000 6000 0112 3456 7890 189
"""
@corpus-chromium
Scenario: Delayed content waits for an expression
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/html" endpoint with the following form data and header(s):
| files | testdata/corpus/web/wait/index.html | file |
| waitForExpression | window.chartReady === true | field |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the "foo.pdf" PDF should have 1 page(s)
Then the "foo.pdf" PDF should have the following content at page 1:
"""
Revenue: 42,000 EUR
"""
Then the "foo.pdf" PDF should NOT have the following content at page 1:
"""
Loading
"""
# The exception happens after the render: the page converts unless the flag is set.
@corpus-chromium
Scenario: A console exception fails the conversion
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/html" endpoint with the following form data and header(s):
| files | testdata/corpus/web/console-error/index.html | file |
| failOnConsoleExceptions | true | field |
Then the response status code should be 409
Then the response body should contain string:
"""
Chromium console exceptions
"""
When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/html" endpoint with the following form data and header(s):
| files | testdata/corpus/web/console-error/index.html | file |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the "foo.pdf" PDF should have 1 page(s)
Then the "foo.pdf" PDF should have the following content at page 1:
"""
Console error page
"""
# The inline script sets the title to "pwned" if it runs. The title stays the one of the
# template and the text right after the script survives.
@corpus-chromium
Scenario: Markdown bundle keeps the text and the title
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/markdown" endpoint with the following form data and header(s):
| files | testdata/corpus/web/markdown/index.html | file |
| files | testdata/corpus/web/markdown/release-notes.md | file |
| files | testdata/corpus/web/markdown/changelog.md | file |
| files | testdata/corpus/web/markdown/style.css | file |
| files | testdata/corpus/web/markdown/screenshot.png | file |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the "foo.pdf" PDF should have the "Title" metadata set to "Release notes 9.0.0"
Then the "foo.pdf" PDF should have 2 page(s)
Then the "foo.pdf" PDF should have the following content at page 1:
"""
Release notes 9.0.0
"""
Then the "foo.pdf" PDF should have the following content at page 1:
"""
CODE-BLOCK-MARKER
"""
Then the "foo.pdf" PDF should have the following content at page 1:
"""
DONE-TASK
"""
Then the "foo.pdf" PDF should have the following content at page 1:
"""
OPEN-TASK
"""
Then the "foo.pdf" PDF should have the following content at page 1:
"""
Removed legacy flag
"""
Then the "foo.pdf" PDF should have the following content at page 2:
"""
SANITIZE-ME-MARKER
"""
Then the "foo.pdf" PDF should have the following content at page 2:
"""
CHANGELOG-V9
"""
Then the "foo.pdf" PDF should have the following content at page 2:
"""
CHANGELOG-V8
"""
Then the "foo.pdf" PDF should have 1 image(s)
# The navigation is hidden in print, and a block shows only from a 1200 px viewport.
@corpus-chromium
Scenario: Landing page: print media and viewport width
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/html" endpoint with the following form data and header(s):
| files | testdata/corpus/web/landing/index.html | file |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the "foo.pdf" PDF should have the following content at page 1:
"""
Start free trial
"""
Then the "foo.pdf" PDF should NOT have the following content at page 1:
"""
Pricing
"""
Then the "foo.pdf" PDF should NOT have the following content at page 1:
"""
WIDE-LAYOUT-MARKER
"""
When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/html" endpoint with the following form data and header(s):
| files | testdata/corpus/web/landing/index.html | file |
| paperWidth | 14 | field |
| paperHeight | 11 | field |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the "foo.pdf" PDF should have the following content at page 1:
"""
WIDE-LAYOUT-MARKER
"""
When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/html" endpoint with the following form data and header(s):
| files | testdata/corpus/web/landing/index.html | file |
| singlePage | true | field |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the "foo.pdf" PDF should have 1 page(s)
Then the "foo.pdf" PDF should have the following content at page 1:
"""
Start free trial
"""
# The Latin marker of a right-to-left line can come out as ":AR": the patterns accept both.
@corpus-chromium
Scenario: Multilingual page renders every script
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/html" endpoint with the following form data and header(s):
| files | testdata/corpus/web/i18n/index.html | file |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the "foo.pdf" PDF should have 1 page(s)
Then the "foo.pdf" PDF should have the following content at page 1:
"""
Multilingual
"""
Then the "foo.pdf" PDF should have content matching "AR:|:AR" at page 1
Then the "foo.pdf" PDF should have content matching "HE:|:HE" at page 1
Then the "foo.pdf" PDF should have content matching "ZH:|:ZH" at page 1
Then the "foo.pdf" PDF should have content matching "JA:|:JA" at page 1
Then the "foo.pdf" PDF should have content matching "KO:|:KO" at page 1
Then the "foo.pdf" PDF should have content matching "TH:|:TH" at page 1
Then the "foo.pdf" PDF should have content matching "HI:|:HI" at page 1
Then the "foo.pdf" PDF should have content matching "EL:|:EL" at page 1
Then the "foo.pdf" PDF should have content matching "RU:|:RU" at page 1
Then the "foo.pdf" PDF should have content matching "EMOJI:|:EMOJI" at page 1
Then the "foo.pdf" PDF should have content matching "MATH:|:MATH" at page 1
@corpus-chromium
Scenario: Print CSS handbook gives A5 pages
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/html" endpoint with the following form data and header(s):
| files | testdata/corpus/web/print-css/index.html | file |
| files | testdata/corpus/web/print-css/print.css | file |
| preferCssPageSize | true | field |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the "foo.pdf" PDF should have 4 page(s)
Then the "foo.pdf" PDF page 1 should be 419.53x595.28 points
Then the "foo.pdf" PDF page 4 should be 419.53x595.28 points
Then the "foo.pdf" PDF should have the following content at page 1:
"""
Handbook
"""
Then the "foo.pdf" PDF should NOT have the following content at page 1:
"""
NAV-MARKER
"""
Then the "foo.pdf" PDF should have the following content at page 2:
"""
CHAPTER-ONE
"""
Then the "foo.pdf" PDF should have the following content at page 3:
"""
CHAPTER-TWO
"""
Then the "foo.pdf" PDF should have the following content at page 4:
"""
CHAPTER-THREE
"""
@corpus-chromium
Scenario: Wide table on a single page
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/html" endpoint with the following form data and header(s):
| files | testdata/corpus/web/wide-table/index.html | file |
| singlePage | true | field |
| landscape | true | field |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the "foo.pdf" PDF should have 1 page(s)
Then the "foo.pdf" PDF should have the "Title" metadata set to "Wide table"
Then the "foo.pdf" PDF should have the following content at page 1:
"""
C01
"""
Then the "foo.pdf" PDF should have the following content at page 1:
"""
r40c30
"""
@corpus-libreoffice
Scenario: Contract DOCX (10 pages)
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/libreoffice/convert" endpoint with the following form data and header(s):
| files | testdata/corpus/office/contract.docx | file |
| nativeBookmarks | true | field |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the "foo.pdf" PDF should have 10 page(s)
Then the "foo.pdf" PDF should have the following content at page 1:
"""
Master Services Agreement
"""
Then the "foo.pdf" PDF should have the following content at page 10:
"""
Schedule A
"""
Then the "foo.pdf" PDF should NOT have the following content at page 1:
"""
Schedule A
"""
Then the "foo.pdf" PDF should have the "Title" metadata set to "Master Services Agreement"
Then the "foo.pdf" PDF should have the "Author" metadata set to "Legal Department"
Then the "foo.pdf" PDF should have the "Subject" metadata set to "Services"
Then the "foo.pdf" PDF should have the "Keywords" metadata set to "contract, msa"
Then the "foo.pdf" PDF should have a document outline
Then the "foo.pdf" PDF should have content matching "Page" at page 1
# The first column clips long cells ("Cloud host"). The Monthly sheet spans two pages; `singlePage` fits each sheet on one page.
@corpus-libreoffice
Scenario: Budget XLSX (3 sheets)
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/libreoffice/convert" endpoint with the following form data and header(s):
| files | testdata/corpus/office/budget.xlsx | file |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the "foo.pdf" PDF should have 4 page(s)
Then the "foo.pdf" PDF should have the following content at page 1:
"""
FY2026 Budget
"""
Then the "foo.pdf" PDF should have the following content at page 1:
"""
Cloud host
"""
When I make a "POST" request to Gotenberg at the "/forms/libreoffice/convert" endpoint with the following form data and header(s):
| files | testdata/corpus/office/budget.xlsx | file |
| singlePage | true | field |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the "foo.pdf" PDF should have 3 page(s)
Then the "foo.pdf" PDF should have the following content at page 1:
"""
FY2026 Budget
"""
Then the "foo.pdf" PDF should have the following content at page 3:
"""
Budget not
"""
Then the "foo.pdf" PDF should have the following content at page 3:
"""
Prepared
"""
@corpus-libreoffice
Scenario: Deck PPTX without the hidden slide, then with notes pages
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/libreoffice/convert" endpoint with the following form data and header(s):
| files | testdata/corpus/office/deck.pptx | file |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the "foo.pdf" PDF should have 7 page(s)
Then the "foo.pdf" PDF should have the following content at page 1:
"""
Q4 Product Review
"""
Then the "foo.pdf" PDF should have the following content at page 2:
"""
Agenda
"""
Then the "foo.pdf" PDF should have the following content at page 4:
"""
R2C2
"""
Then the "foo.pdf" PDF should have the following content at page 7:
"""
Thank you
"""
Then the "foo.pdf" PDF should NOT have content matching "HIDDEN-SLIDE-MARKER" at page 1
Then the "foo.pdf" PDF should NOT have content matching "HIDDEN-SLIDE-MARKER" at page 2
Then the "foo.pdf" PDF should NOT have content matching "HIDDEN-SLIDE-MARKER" at page 3
Then the "foo.pdf" PDF should NOT have content matching "HIDDEN-SLIDE-MARKER" at page 4
Then the "foo.pdf" PDF should NOT have content matching "HIDDEN-SLIDE-MARKER" at page 5
Then the "foo.pdf" PDF should NOT have content matching "HIDDEN-SLIDE-MARKER" at page 6
Then the "foo.pdf" PDF should NOT have content matching "HIDDEN-SLIDE-MARKER" at page 7
Then the "foo.pdf" PDF should NOT have content matching "NOTES-MARKER" at page 2
When I make a "POST" request to Gotenberg at the "/forms/libreoffice/convert" endpoint with the following form data and header(s):
| files | testdata/corpus/office/deck.pptx | file |
| exportNotesPages | true | field |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the "foo.pdf" PDF should have 14 page(s)
Then the "foo.pdf" PDF should have the following content at page 9:
"""
NOTES-MARKER-2
"""
Then the "foo.pdf" PDF should have the following content at page 14:
"""
NOTES-MARKER-8
"""
Then the "foo.pdf" PDF should NOT have content matching "HIDDEN-SLIDE-MARKER" at page 7
Then the "foo.pdf" PDF should NOT have content matching "HIDDEN-SLIDE-MARKER" at page 13
# Fails until lok passes the CSV import options: every line lands in one cell today.
@corpus-libreoffice
Scenario: CSV keeps its columns
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/libreoffice/convert" endpoint with the following form data and header(s):
| files | testdata/corpus/office/sales.csv | file |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the "foo.pdf" PDF should have the following content at page 1:
"""
customer
"""
Then the "foo.pdf" PDF should NOT have the following content at page 1:
"""
id,date,customer
"""
Then the "foo.pdf" PDF should have the following content at page 1:
"""
Café Müller
"""
Then the "foo.pdf" PDF should have the following content at page 1:
"""
Straße GmbH
"""
Then the "foo.pdf" PDF should have the following content at page 1:
"""
Élodie & Fils
"""
@corpus-libreoffice
Scenario: Tracked changes keep the inserted text
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/libreoffice/convert" endpoint with the following form data and header(s):
| files | testdata/corpus/office/tracked.docx | file |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the "foo.pdf" PDF should have 1 page(s)
Then the "foo.pdf" PDF should have the following content at page 1:
"""
INSERTED-TEXT
"""
Then the "foo.pdf" PDF should have the following content at page 1:
"""
End of sentence.
"""
@corpus-libreoffice
Scenario: Multilingual DOCX
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/libreoffice/convert" endpoint with the following form data and header(s):
| files | testdata/corpus/office/i18n.docx | file |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the "foo.pdf" PDF should have 1 page(s)
Then the "foo.pdf" PDF should have the following content at page 1:
"""
Multilingual document
"""
Then the "foo.pdf" PDF should have content matching "AR:|:AR" at page 1
Then the "foo.pdf" PDF should have content matching "HE:|:HE" at page 1
Then the "foo.pdf" PDF should have content matching "ZH:|:ZH" at page 1
Then the "foo.pdf" PDF should have content matching "JA:|:JA" at page 1
Then the "foo.pdf" PDF should have content matching "KO:|:KO" at page 1
Then the "foo.pdf" PDF should have content matching "TH:|:TH" at page 1
Then the "foo.pdf" PDF should have content matching "HI:|:HI" at page 1
Then the "foo.pdf" PDF should have content matching "EL:|:EL" at page 1
Then the "foo.pdf" PDF should have content matching "RU:|:RU" at page 1
Then the "foo.pdf" PDF should have content matching "EMOJI:|:EMOJI" at page 1
Then the "foo.pdf" PDF should have content matching "MATH:|:MATH" at page 1
@corpus-libreoffice
Scenario: Form ODT keeps its text
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/libreoffice/convert" endpoint with the following form data and header(s):
| files | testdata/corpus/office/form.odt | file |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the "foo.pdf" PDF should have 1 page(s)
Then the "foo.pdf" PDF should have the following content at page 1:
"""
FORM-DOC-MARKER
"""
# The manifest counted 3 pages with another LibreOffice build; the image gives 4.
@corpus-libreoffice
Scenario: Plain text paginates
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/libreoffice/convert" endpoint with the following form data and header(s):
| files | testdata/corpus/office/readme.txt | file |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the "foo.pdf" PDF should have 4 page(s)
Then the "foo.pdf" PDF should have the following content at page 1:
"""
Line 01:
"""
Then the "foo.pdf" PDF should have the following content at page 4:
"""
Line 60:
"""
Then the "foo.pdf" PDF should have the following content at page 1:
"""
Café résumé naïve déjà vu
"""
@corpus-libreoffice
Scenario: WebP is not an accepted input
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/libreoffice/convert" endpoint with the following form data and header(s):
| files | testdata/corpus/office/images/pic.webp | file |
Then the response status code should be 400
Then the response body should contain string:
"""
Invalid form data: no form file found for extensions:
"""
@corpus-libreoffice
Scenario Outline: Office formats convert with the documented pages and text
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/libreoffice/convert" endpoint with the following form data and header(s):
| files | testdata/corpus/office/<file> | file |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the "foo.pdf" PDF should have <pages> page(s)
Then the "foo.pdf" PDF should have the following content at page <page>:
"""
<marker>
"""
Examples:
| file | pages | page | marker |
| memo.fodt | 1 | 1 | MEMO-END-MARKER |
| memo.odt | 1 | 1 | MEMO-END-MARKER |
| memo.doc | 1 | 1 | MEMO-END-MARKER |
| memo.rtf | 1 | 1 | MEMO-END-MARKER |
| memo-lo.docx | 1 | 1 | MEMO-END-MARKER |
| memo.html | 1 | 1 | MEMO-END-MARKER |
| memo.pdf | 1 | 1 | MEMO-END-MARKER |
| figures.fods | 2 | 1 | REVENUE-SH |
| figures.fods | 2 | 2 | COSTS-SHEE |
| figures.ods | 2 | 1 | REVENUE-SH |
| figures.ods | 2 | 2 | COSTS-SHEE |
| figures.xls | 2 | 1 | REVENUE-SH |
| figures.xls | 2 | 2 | COSTS-SHEE |
| figures-lo.xlsx | 2 | 1 | REVENUE-SH |
| figures-lo.xlsx | 2 | 2 | COSTS-SHEE |
| pitch.fodp | 4 | 1 | PITCH-1 |
| pitch.fodp | 4 | 4 | PITCH-4 |
| pitch.odp | 4 | 1 | PITCH-1 |
| pitch.odp | 4 | 4 | PITCH-4 |
| pitch.ppt | 4 | 1 | PITCH-1 |
| pitch.ppt | 4 | 4 | PITCH-4 |
| pitch-lo.pptx | 4 | 1 | PITCH-1 |
| pitch-lo.pptx | 4 | 4 | PITCH-4 |
| letter.rtf | 1 | 1 | Northwind Traders |
| letter.rtf | 1 | 1 | Second item |
| page.htm | 1 | 1 | HTM-MARKER |
| data.xml | 1 | 1 | XML-MARKER |
| data.xml | 1 | 1 | Second |
@corpus-libreoffice
Scenario Outline: Image formats convert to a one-page PDF
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/libreoffice/convert" endpoint with the following form data and header(s):
| files | testdata/corpus/office/images/<file> | file |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then there should be 1 PDF(s) in the response
Then the "foo.pdf" PDF should have 1 page(s)
Then the "foo.pdf" PDF should have 1 image(s)
Examples:
| file |
| photo.jpg |
| diagram.png |
| icon.gif |
| scan.tif |
| pic.bmp |
@corpus-libreoffice
Scenario: SVG converts to a one-page PDF
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/libreoffice/convert" endpoint with the following form data and header(s):
| files | testdata/corpus/office/images/logo.svg | file |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the "foo.pdf" PDF should have 1 page(s)
@corpus-pdf
Scenario: Report PDF: info and metadata
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/pdf/info" endpoint with the following form data and header(s):
| files | testdata/corpus/pdf/report.pdf | file |
Then the response status code should be 200
Then the response body should match JSON:
"""
{
"report.pdf": {
"pages": 3,
"version": "ignore",
"encrypted": false,
"tagged": false,
"linearized": false,
"formFields": false
}
}
"""
When I make a "POST" request to Gotenberg at the "/forms/pdf/metadata" endpoint with the following form data and header(s):
| files | testdata/corpus/pdf/report.pdf | file |
Then the response status code should be 200
Then the response body should match JSON:
"""
{
"report.pdf": {
"title": "Quarterly Report",
"author": "Finance"
}
}
"""
When I make a "POST" request to Gotenberg at the "/forms/pdf/merge" endpoint with the following form data and header(s):
| files | testdata/corpus/pdf/report.pdf | file |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the "foo.pdf" PDF should have 3 page(s)
Then the "foo.pdf" PDF page 1 should be 612x792 points
Then the "foo.pdf" PDF page 3 should be 612x792 points
Then the "foo.pdf" PDF should have the "Title" metadata set to "Quarterly Report"
Then the "foo.pdf" PDF should have the following content at page 1:
"""
Body line 1 of page 1
"""
Then the "foo.pdf" PDF should have the following content at page 3:
"""
REPORT-PAGE-3
"""
@corpus-pdf
Scenario: Redaction removes the label of page 1 only
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/pdf/redact" endpoint with the following form data and header(s):
| files | testdata/corpus/pdf/report.pdf | file |
| regions | [{"page":1,"x":70,"y":388,"width":300,"height":42}] | field |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the "foo.pdf" PDF should have 3 page(s)
Then the "foo.pdf" PDF should NOT have the following content at page 1:
"""
REPORT-PAGE-1
"""
Then the "foo.pdf" PDF should have the following content at page 1:
"""
Quarterly Report
"""
Then the "foo.pdf" PDF should have the following content at page 1:
"""
Body line 1 of page 1
"""
Then the "foo.pdf" PDF should have the following content at page 2:
"""
REPORT-PAGE-2
"""
Then the "foo.pdf" PDF should have the following content at page 3:
"""
REPORT-PAGE-3
"""
Then the "foo.pdf" PDF page 1 should be 612x792 points
# Inputs merge in the order of their filenames, so the annex comes first.
@corpus-pdf
Scenario: Merge report and annex
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/pdf/merge" endpoint with the following form data and header(s):
| files | testdata/corpus/pdf/report.pdf | file |
| files | testdata/corpus/pdf/annex.pdf | file |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the "foo.pdf" PDF should have 5 page(s)
Then the "foo.pdf" PDF page 5 should be 612x792 points
Then the "foo.pdf" PDF should have the following content at page 1:
"""
ANNEX-PAGE-1
"""
Then the "foo.pdf" PDF should have the following content at page 2:
"""
ANNEX-PAGE-2
"""
Then the "foo.pdf" PDF should have the following content at page 3:
"""
REPORT-PAGE-1
"""
Then the "foo.pdf" PDF should have the following content at page 4:
"""
REPORT-PAGE-2
"""
Then the "foo.pdf" PDF should have the following content at page 5:
"""
REPORT-PAGE-3
"""
@corpus-pdf
Scenario: Stamp text and image
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/pdf/stamp-text" endpoint with the following form data and header(s):
| files | testdata/corpus/pdf/report.pdf | file |
| text | APPROVED-STAMP | field |
| pages | 1 | field |
| x | 72 | field |
| y | 200 | field |
| fontSize | 24 | field |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the "foo.pdf" PDF should have 3 page(s)
Then the "foo.pdf" PDF should have the following content at page 1:
"""
REPORT-PAGE-1
"""
When I make a "POST" request to Gotenberg at the "/forms/pdf/stamp-image" endpoint with the following form data and header(s):
| files | testdata/corpus/pdf/report.pdf | file |
| files | testdata/corpus/pdf/stamp.jpg | file |
| image | stamp.jpg | field |
| pages | 1 | field |
| width | 150 | field |
| height | 50 | field |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the "foo.pdf" PDF should have 3 page(s)
Then the "foo.pdf" PDF should have 1 image(s)
@corpus-pdf
Scenario: Letterhead stamped under the report
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/pdf/stamp-pdf" endpoint with the following form data and header(s):
| files | testdata/corpus/pdf/report.pdf | file |
| files | testdata/corpus/pdf/letterhead.pdf | file |
| source | letterhead.pdf | field |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the "foo.pdf" PDF should have 3 page(s)
Then the "foo.pdf" PDF should have the following content at page 1:
"""
REPORT-PAGE-1
"""
@corpus-pdf
Scenario: Encrypted PDF needs its password
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/pdf/info" endpoint with the following form data and header(s):
| files | testdata/corpus/pdf/encrypted.pdf | file |
Then the response status code should be 400
When I make a "POST" request to Gotenberg at the "/forms/pdf/info" endpoint with the following form data and header(s):
| files | testdata/corpus/pdf/encrypted.pdf | file |
| password | secret | field |
Then the response status code should be 200
Then the response body should match JSON:
"""
{
"encrypted.pdf": {
"pages": 3,
"encrypted": true
}
}
"""
When I make a "POST" request to Gotenberg at the "/forms/pdf/decrypt" endpoint with the following form data and header(s):
| files | testdata/corpus/pdf/encrypted.pdf | file |
Then the response status code should be 400
When I make a "POST" request to Gotenberg at the "/forms/pdf/decrypt" endpoint with the following form data and header(s):
| files | testdata/corpus/pdf/encrypted.pdf | file |
| password | secret | field |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the response PDF(s) should NOT be encrypted
Then the "foo.pdf" PDF should have 3 page(s)
Then the "foo.pdf" PDF should have the following content at page 3:
"""
REPORT-PAGE-3
"""
When I make a "POST" request to Gotenberg at the "/forms/pdf/decrypt" endpoint with the following form data and header(s):
| files | testdata/corpus/pdf/encrypted-rc4.pdf | file |
| password | secret | field |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the response PDF(s) should NOT be encrypted
Then the "foo.pdf" PDF should have 3 page(s)
Then the "foo.pdf" PDF should have the following content at page 2:
"""
REPORT-PAGE-2
"""
@corpus-pdf
Scenario: Factur-X embeds the CII invoice
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/pdf/remediate" endpoint with the following form data and header(s):
| files | testdata/corpus/pdf/report.pdf | file |
| files | testdata/corpus/pdf/invoice-cii.xml | file |
| profile | Factur-X | field |
| xml | invoice-cii.xml | field |
| level | EN 16931 | field |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the response header "Gotenberg-Remediation-Residual" should be "0"
Then the "foo.pdf" PDF should have 3 page(s)
Then the "foo.pdf" PDF should have the "Title" metadata set to "Quarterly Report"
Then the response PDF(s) should be valid "PDF/A-3b" with a tolerance of 0 failed rule(s)
Then the response PDF(s) should have the "factur-x.xml" file embedded with relationship "Alternative"
Then the response PDF(s) should declare Factur-X XMP with conformance level "EN 16931"
@corpus-pdf
Scenario: Transparency remediates to PDF/A-2b
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/pdf/remediate" endpoint with the following form data and header(s):
| files | testdata/corpus/pdf/transparent.pdf | file |
| profile | PDF/A-2b | field |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the "foo.pdf" PDF should have 1 page(s)
Then the "foo.pdf" PDF should have the following content at page 1:
"""
TRANSPARENT-MARKER
"""
Then the response PDF(s) should be valid "PDF/A-2b" with a tolerance of 0 failed rule(s)
@corpus-pdf
Scenario: Color and image-heavy samples read back
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/pdf/info" endpoint with the following form data and header(s):
| files | testdata/corpus/pdf/colors.pdf | file |
| files | testdata/corpus/pdf/image-heavy.pdf | file |
Then the response status code should be 200
Then the response body should match JSON:
"""
{
"colors.pdf": {
"pages": 1
},
"image-heavy.pdf": {
"pages": 3
}
}
"""

View File

@@ -3,164 +3,11 @@
package integration package integration
import ( import (
"context"
"fmt"
"os"
"os/signal"
"runtime"
"slices"
"strings"
"syscall"
"testing" "testing"
"time"
"github.com/cucumber/godog"
"github.com/cucumber/godog/colors"
flag "github.com/spf13/pflag"
"github.com/gotenberg/gotenberg/v9/test/integration/scenario" "github.com/gotenberg/gotenberg/v9/test/integration/scenario"
) )
// runTimeout bounds a whole run, retries included. It stays below the go test func TestMain(_ *testing.M) {
// timeout of the Makefile. scenario.RunSuite("integration")
const runTimeout = 38 * time.Minute
func TestMain(m *testing.M) {
repository := flag.String("gotenberg-docker-repository", "", "")
version := flag.String("gotenberg-version", "", "")
variant := flag.String("gotenberg-variant", "", "")
platform := flag.String("gotenberg-container-platform", "", "")
concurrencyFlag := flag.Int("concurrency", 0, "")
tags := flag.String("tags", "", "")
keepFailed := flag.String("keep-failed", "", "")
flag.Parse()
if *platform == "" {
switch runtime.GOARCH {
case "arm64":
*platform = "linux/arm64"
default:
*platform = "linux/amd64"
}
}
scenario.GotenbergDockerRepository = *repository
scenario.GotenbergVersion = *version
scenario.GotenbergVariant = *variant
scenario.GotenbergContainerPlatform = *platform
scenario.KeepFailedDir = *keepFailed
concurrency := *concurrencyFlag
if concurrency <= 0 {
concurrency = runtime.NumCPU()
}
maxAttempts := 4 // 1 initial run + up to 3 retries
paths := []string{"features"}
// Steps run on this context: a step that waits on it fails before the go
// test timeout (-timeout 40m in the Makefile) panics, which would skip the
// retries and the report.
timeoutCtx, cancelTimeout := context.WithTimeout(context.Background(), runTimeout)
defer cancelTimeout()
// An interrupt cancels the steps, then the run cleans up and stops rather
// than retrying. A second interrupt kills the process.
runCtx, stopSignals := signal.NotifyContext(timeoutCtx, os.Interrupt, syscall.SIGTERM)
defer stopSignals()
runDir, err := os.MkdirTemp("", "gotenberg-integration-")
if err != nil {
fmt.Fprintf(colors.Colored(os.Stdout), "create the run directory: %v\n", err)
os.Exit(1)
}
scenario.RunDir = runDir
// os.Exit skips the deferred calls: exit cleans up first.
exit := func(code int) {
stopSignals()
err := os.RemoveAll(runDir)
if err != nil {
fmt.Fprintf(colors.Colored(os.Stdout), "warning: remove the run directory: %v\n", err)
}
os.Exit(code)
}
// Scenarios that failed at least once: reported when they pass on a retry.
var flaky []string
for attempt := 1; attempt <= maxAttempts; attempt++ {
// Reset the failure collector before each run.
scenario.ResetFailedScenarios()
// Reclaim subnets leaked by prior runs or failed container starts
// before they exhaust Docker's predefined address pools.
if deleted, err := scenario.PruneOrphanedNetworks(context.Background()); err != nil {
fmt.Fprintf(colors.Colored(os.Stdout), "warning: prune orphaned networks: %v\n", err)
} else if deleted > 0 {
fmt.Fprintf(colors.Colored(os.Stdout), "pruned %d orphaned network(s)\n", deleted)
}
code := godog.TestSuite{
Name: "integration",
ScenarioInitializer: scenario.InitializeScenario,
Options: &godog.Options{
Format: "pretty",
Paths: paths,
Output: colors.Colored(os.Stdout),
Concurrency: concurrency,
Tags: *tags,
DefaultContext: runCtx,
// An undefined or pending step fails the run instead of
// passing it unchecked.
Strict: true,
},
}.Run()
// Pooled containers live across scenarios, not across runs: a retry
// starts from fresh ones.
if err := scenario.TerminateDefaultContainers(context.Background()); err != nil {
fmt.Fprintf(colors.Colored(os.Stdout), "warning: %v\n", err)
}
if runCtx.Err() != nil && timeoutCtx.Err() == nil {
fmt.Fprintf(colors.Colored(os.Stdout), "\n--- interrupted ---\n")
exit(130)
}
if code == 0 {
if len(flaky) > 0 {
fmt.Fprintf(colors.Colored(os.Stdout), "\n--- %d flaky scenario(s), passed on a retry ---\n%s\n", len(flaky), strings.Join(flaky, "\n"))
}
exit(0)
}
// A failure the retry cannot target would be dropped from it, and a
// green retry would then hide it.
if unmapped := scenario.UnmappedFailures(); unmapped > 0 {
fmt.Fprintf(colors.Colored(os.Stdout), "\n--- %d failed scenario(s) cannot be retried, failing the run ---\n", unmapped)
exit(code)
}
failedPaths := scenario.FailedScenarioPaths()
if len(failedPaths) == 0 || attempt == maxAttempts {
exit(code)
}
for _, path := range failedPaths {
if !slices.Contains(flaky, path) {
flaky = append(flaky, path)
}
}
fmt.Fprintf(colors.Colored(os.Stdout),
"\n\n--- %d scenario(s) failed, retrying (%d retries left) ---\n\n",
len(failedPaths), maxAttempts-attempt,
)
// Next run: only the failed scenarios via file:line paths.
paths = failedPaths
}
exit(1)
} }

View File

@@ -0,0 +1,165 @@
package scenario
import (
"context"
"fmt"
"os"
"os/signal"
"runtime"
"slices"
"strings"
"syscall"
"time"
"github.com/cucumber/godog"
"github.com/cucumber/godog/colors"
flag "github.com/spf13/pflag"
)
// runTimeout bounds a whole run, retries included. It stays below the go test
// timeout of the Makefile.
const runTimeout = 38 * time.Minute
// RunSuite parses the command line, runs the features under the features/
// directory of the current directory as the godog suite of the given name,
// retries the failed scenarios, then exits the process with the run's code.
// It never returns.
func RunSuite(name string) {
repository := flag.String("gotenberg-docker-repository", "", "")
version := flag.String("gotenberg-version", "", "")
variant := flag.String("gotenberg-variant", "", "")
platform := flag.String("gotenberg-container-platform", "", "")
concurrencyFlag := flag.Int("concurrency", 0, "")
tags := flag.String("tags", "", "")
keepFailed := flag.String("keep-failed", "", "")
flag.Parse()
if *platform == "" {
switch runtime.GOARCH {
case "arm64":
*platform = "linux/arm64"
default:
*platform = "linux/amd64"
}
}
GotenbergDockerRepository = *repository
GotenbergVersion = *version
GotenbergVariant = *variant
GotenbergContainerPlatform = *platform
KeepFailedDir = *keepFailed
concurrency := *concurrencyFlag
if concurrency <= 0 {
concurrency = runtime.NumCPU()
}
maxAttempts := 4 // 1 initial run + up to 3 retries
paths := []string{"features"}
runDir, err := os.MkdirTemp("", "gotenberg-integration-")
if err != nil {
fmt.Fprintf(colors.Colored(os.Stdout), "create the run directory: %v\n", err)
os.Exit(1)
}
RunDir = runDir
// Steps run on this context: a step that waits on it fails before the go
// test timeout (-timeout 40m in the Makefile) panics, which would skip the
// retries and the report.
timeoutCtx, cancelTimeout := context.WithTimeout(context.Background(), runTimeout)
defer cancelTimeout()
// An interrupt cancels the steps, then the run cleans up and stops rather
// than retrying. A second interrupt kills the process.
runCtx, stopSignals := signal.NotifyContext(timeoutCtx, os.Interrupt, syscall.SIGTERM)
defer stopSignals()
// os.Exit skips the deferred calls: exit cleans up first.
exit := func(code int) {
stopSignals()
err := os.RemoveAll(runDir)
if err != nil {
fmt.Fprintf(colors.Colored(os.Stdout), "warning: remove the run directory: %v\n", err)
}
os.Exit(code)
}
// Scenarios that failed at least once: reported when they pass on a retry.
var flaky []string
for attempt := 1; attempt <= maxAttempts; attempt++ {
// Reset the failure collector before each run.
ResetFailedScenarios()
// Reclaim subnets leaked by prior runs or failed container starts
// before they exhaust Docker's predefined address pools.
if deleted, err := PruneOrphanedNetworks(context.Background()); err != nil {
fmt.Fprintf(colors.Colored(os.Stdout), "warning: prune orphaned networks: %v\n", err)
} else if deleted > 0 {
fmt.Fprintf(colors.Colored(os.Stdout), "pruned %d orphaned network(s)\n", deleted)
}
code := godog.TestSuite{
Name: name,
ScenarioInitializer: InitializeScenario,
Options: &godog.Options{
Format: "pretty",
Paths: paths,
Output: colors.Colored(os.Stdout),
Concurrency: concurrency,
Tags: *tags,
DefaultContext: runCtx,
// An undefined or pending step fails the run instead of
// passing it unchecked.
Strict: true,
},
}.Run()
// Pooled containers live across scenarios, not across runs: a retry
// starts from fresh ones.
if err := TerminateDefaultContainers(context.Background()); err != nil {
fmt.Fprintf(colors.Colored(os.Stdout), "warning: %v\n", err)
}
if runCtx.Err() != nil && timeoutCtx.Err() == nil {
fmt.Fprintf(colors.Colored(os.Stdout), "\n--- interrupted ---\n")
exit(130)
}
if code == 0 {
if len(flaky) > 0 {
fmt.Fprintf(colors.Colored(os.Stdout), "\n--- %d flaky scenario(s), passed on a retry ---\n%s\n", len(flaky), strings.Join(flaky, "\n"))
}
exit(0)
}
// A failure the retry cannot target would be dropped from it, and a
// green retry would then hide it.
if unmapped := UnmappedFailures(); unmapped > 0 {
fmt.Fprintf(colors.Colored(os.Stdout), "\n--- %d failed scenario(s) cannot be retried, failing the run ---\n", unmapped)
exit(code)
}
failedPaths := FailedScenarioPaths()
if len(failedPaths) == 0 || attempt == maxAttempts {
exit(code)
}
for _, path := range failedPaths {
if !slices.Contains(flaky, path) {
flaky = append(flaky, path)
}
}
fmt.Fprintf(colors.Colored(os.Stdout),
"\n\n--- %d scenario(s) failed, retrying (%d retries left) ---\n\n",
len(failedPaths), maxAttempts-attempt,
)
// Next run: only the failed scenarios via file:line paths.
paths = failedPaths
}
exit(1)
}