tests(integreation): fix failing scenarios and add screenshots one

This commit is contained in:
Julien Neuhart
2026-03-28 20:39:53 +01:00
parent 385cbe6590
commit e0eff40f74
11 changed files with 348 additions and 12 deletions

View File

@@ -22,7 +22,7 @@ make test-integration TAGS=chromium-convert-html
make test-integration TAGS="merge,split"
```
Available tags: `chromium`, `chromium-concurrent`, `chromium-convert-html`, `chromium-convert-markdown`, `chromium-convert-url`, `debug`, `health`, `libreoffice`, `libreoffice-convert`, `output-filename`, `pdfengines`, `pdfengines-convert`, `pdfengines-embed`, `embed`, `pdfengines-encrypt`, `encrypt`, `pdfengines-flatten`, `flatten`, `pdfengines-merge`, `merge`, `pdfengines-metadata`, `metadata`, `pdfengines-split`, `split`, `pdfengines-watermark`, `watermark`, `pdfengines-stamp`, `stamp`, `pdfengines-bookmarks`, `bookmarks`, `pdfengines-rotate`, `rotate`, `prometheus-metrics`, `root`, `version`, `webhook`, `download-from`.
Available tags: `chromium`, `chromium-concurrent`, `chromium-convert-html`, `chromium-convert-markdown`, `chromium-convert-url`, `chromium-screenshot-html`, `chromium-screenshot-markdown`, `chromium-screenshot-url`, `debug`, `health`, `libreoffice`, `libreoffice-convert`, `output-filename`, `pdfengines`, `pdfengines-convert`, `pdfengines-embed`, `embed`, `pdfengines-encrypt`, `encrypt`, `pdfengines-flatten`, `flatten`, `pdfengines-merge`, `merge`, `pdfengines-metadata`, `metadata`, `pdfengines-split`, `split`, `pdfengines-watermark`, `watermark`, `pdfengines-stamp`, `stamp`, `pdfengines-bookmarks`, `bookmarks`, `pdfengines-rotate`, `rotate`, `prometheus-metrics`, `root`, `version`, `webhook`, `download-from`.
Other useful flags:

View File

@@ -459,7 +459,8 @@ Feature: /forms/chromium/convert/markdown
Then the response header "Content-Type" should be "text/plain; charset=UTF-8"
Then the response body should match string:
"""
Markdown file(s) not found: 'page_2.md'; 'page_3.md'
Markdown file(s) not found: 'page_2.md'
'page_3.md'
"""
When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/markdown" endpoint with the following form data and header(s):
| singlePage | foo | field |

View File

@@ -1233,3 +1233,15 @@ Feature: /forms/chromium/convert/url
| url | http://host.docker.internal:%d/html/testdata/page-1-html/index.html | field |
Then the response status code should be 200
Then the response header "Content-Type" should be "application/pdf"
# See: https://github.com/gotenberg/gotenberg/issues/1500.
Scenario: POST /forms/chromium/convert/url (Long Filename)
Given I have a default Gotenberg container
Given I have a static server
When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/url" endpoint with the following form data and header(s):
| url | http://host.docker.internal:%d/html/testdata/page-1-html/index.html | field |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the response header "Content-Type" should be "application/pdf"
Then there should be 1 PDF(s) in the response
Then the "foo.pdf" PDF should have 1 page(s)

View File

@@ -0,0 +1,151 @@
@chromium
@chromium-screenshot-html
Feature: /forms/chromium/screenshot/html
Scenario: POST /forms/chromium/screenshot/html (Default)
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/chromium/screenshot/html" endpoint with the following form data and header(s):
| files | testdata/page-1-html/index.html | file |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the response header "Content-Type" should be "image/png"
Then there should be the following file(s) in the response:
| foo.png |
Scenario: POST /forms/chromium/screenshot/html (JPEG)
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/chromium/screenshot/html" endpoint with the following form data and header(s):
| files | testdata/page-1-html/index.html | file |
| format | jpeg | field |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the response header "Content-Type" should be "image/jpeg"
Then there should be the following file(s) in the response:
| foo.jpeg |
Scenario: POST /forms/chromium/screenshot/html (WebP)
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/chromium/screenshot/html" endpoint with the following form data and header(s):
| files | testdata/page-1-html/index.html | file |
| format | webp | field |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the response header "Content-Type" should be "image/webp"
Then there should be the following file(s) in the response:
| foo.webp |
Scenario: POST /forms/chromium/screenshot/html (Custom Dimensions)
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/chromium/screenshot/html" endpoint with the following form data and header(s):
| files | testdata/page-1-html/index.html | file |
| width | 1920 | field |
| height | 1080 | field |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the response header "Content-Type" should be "image/png"
Scenario: POST /forms/chromium/screenshot/html (Clip)
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/chromium/screenshot/html" endpoint with the following form data and header(s):
| files | testdata/page-1-html/index.html | file |
| clip | true | field |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the response header "Content-Type" should be "image/png"
Scenario: POST /forms/chromium/screenshot/html (Quality)
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/chromium/screenshot/html" endpoint with the following form data and header(s):
| files | testdata/page-1-html/index.html | file |
| format | jpeg | field |
| quality | 50 | field |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the response header "Content-Type" should be "image/jpeg"
Scenario: POST /forms/chromium/screenshot/html (Optimize for Speed)
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/chromium/screenshot/html" endpoint with the following form data and header(s):
| files | testdata/page-1-html/index.html | file |
| optimizeForSpeed | true | field |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the response header "Content-Type" should be "image/png"
Scenario: POST /forms/chromium/screenshot/html (Omit Background)
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/chromium/screenshot/html" endpoint with the following form data and header(s):
| files | testdata/page-1-html/index.html | file |
| omitBackground | true | field |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the response header "Content-Type" should be "image/png"
Scenario: POST /forms/chromium/screenshot/html (Emulated Media Type)
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/chromium/screenshot/html" endpoint with the following form data and header(s):
| files | testdata/page-1-html/index.html | file |
| emulatedMediaType | screen | field |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the response header "Content-Type" should be "image/png"
Scenario: POST /forms/chromium/screenshot/html (Bad Request)
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/chromium/screenshot/html" endpoint with the following form data and header(s):
| skipNetworkIdleEvent | foo | field |
| skipNetworkAlmostIdleEvent | foo | field |
| failOnResourceLoadingFailed | foo | field |
| failOnConsoleExceptions | foo | field |
| emulatedMediaType | foo | field |
| omitBackground | foo | field |
| width | foo | field |
| height | foo | field |
| clip | foo | field |
| format | bar | field |
| quality | -1 | field |
| optimizeForSpeed | foo | field |
Then the response status code should be 400
Then the response header "Content-Type" should be "text/plain; charset=UTF-8"
@webhook
Scenario: POST /forms/chromium/screenshot/html (Webhook)
Given I have a default Gotenberg container
Given I have a webhook server
When I make a "POST" request to Gotenberg at the "/forms/chromium/screenshot/html" endpoint with the following form data and header(s):
| files | testdata/page-1-html/index.html | file |
| Gotenberg-Output-Filename | foo | header |
| Gotenberg-Webhook-Url | http://host.docker.internal:%d/webhook | header |
| Gotenberg-Webhook-Error-Url | http://host.docker.internal:%d/webhook/error | header |
Then the response status code should be 204
When I wait for the asynchronous request to the webhook
Then the webhook request header "Content-Type" should be "image/png"
Then there should be the following file(s) in the webhook request:
| foo.png |
Scenario: POST /forms/chromium/screenshot/html (Basic Auth)
Given I have a Gotenberg container with the following environment variable(s):
| API_ENABLE_BASIC_AUTH | true |
| GOTENBERG_API_BASIC_AUTH_USERNAME | foo |
| GOTENBERG_API_BASIC_AUTH_PASSWORD | bar |
When I make a "POST" request to Gotenberg at the "/forms/chromium/screenshot/html" endpoint with the following form data and header(s):
| files | testdata/page-1-html/index.html | file |
Then the response status code should be 401
Scenario: POST /foo/forms/chromium/screenshot/html (Root Path)
Given I have a Gotenberg container with the following environment variable(s):
| API_ENABLE_DEBUG_ROUTE | true |
| API_ROOT_PATH | /foo/ |
When I make a "POST" request to Gotenberg at the "/foo/forms/chromium/screenshot/html" endpoint with the following form data and header(s):
| files | testdata/page-1-html/index.html | file |
Then the response status code should be 200
Then the response header "Content-Type" should be "image/png"
# See: https://github.com/gotenberg/gotenberg/issues/1500.
Scenario: POST /forms/chromium/screenshot/html (Long Filename)
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/chromium/screenshot/html" endpoint with the following form data and header(s):
| files | testdata/page-1-html/index.html | file |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the response header "Content-Type" should be "image/png"

View File

@@ -0,0 +1,81 @@
@chromium
@chromium-screenshot-markdown
Feature: /forms/chromium/screenshot/markdown
Scenario: POST /forms/chromium/screenshot/markdown (Default)
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/chromium/screenshot/markdown" endpoint with the following form data and header(s):
| files | testdata/page-1-markdown/index.html | file |
| files | testdata/page-1-markdown/page_1.md | file |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the response header "Content-Type" should be "image/png"
Then there should be the following file(s) in the response:
| foo.png |
Scenario: POST /forms/chromium/screenshot/markdown (JPEG)
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/chromium/screenshot/markdown" endpoint with the following form data and header(s):
| files | testdata/page-1-markdown/index.html | file |
| files | testdata/page-1-markdown/page_1.md | file |
| format | jpeg | field |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the response header "Content-Type" should be "image/jpeg"
Then there should be the following file(s) in the response:
| foo.jpeg |
Scenario: POST /forms/chromium/screenshot/markdown (WebP)
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/chromium/screenshot/markdown" endpoint with the following form data and header(s):
| files | testdata/page-1-markdown/index.html | file |
| files | testdata/page-1-markdown/page_1.md | file |
| format | webp | field |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the response header "Content-Type" should be "image/webp"
Then there should be the following file(s) in the response:
| foo.webp |
Scenario: POST /forms/chromium/screenshot/markdown (Bad Request - Missing Files)
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/chromium/screenshot/markdown" endpoint with the following form data and header(s):
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 400
Then the response header "Content-Type" should be "text/plain; charset=UTF-8"
@webhook
Scenario: POST /forms/chromium/screenshot/markdown (Webhook)
Given I have a default Gotenberg container
Given I have a webhook server
When I make a "POST" request to Gotenberg at the "/forms/chromium/screenshot/markdown" endpoint with the following form data and header(s):
| files | testdata/page-1-markdown/index.html | file |
| files | testdata/page-1-markdown/page_1.md | file |
| Gotenberg-Output-Filename | foo | header |
| Gotenberg-Webhook-Url | http://host.docker.internal:%d/webhook | header |
| Gotenberg-Webhook-Error-Url | http://host.docker.internal:%d/webhook/error | header |
Then the response status code should be 204
When I wait for the asynchronous request to the webhook
Then the webhook request header "Content-Type" should be "image/png"
Then there should be the following file(s) in the webhook request:
| foo.png |
Scenario: POST /forms/chromium/screenshot/markdown (Basic Auth)
Given I have a Gotenberg container with the following environment variable(s):
| API_ENABLE_BASIC_AUTH | true |
| GOTENBERG_API_BASIC_AUTH_USERNAME | foo |
| GOTENBERG_API_BASIC_AUTH_PASSWORD | bar |
When I make a "POST" request to Gotenberg at the "/forms/chromium/screenshot/markdown" endpoint with the following form data and header(s):
| files | testdata/page-1-markdown/index.html | file |
| files | testdata/page-1-markdown/page_1.md | file |
Then the response status code should be 401
Scenario: POST /foo/forms/chromium/screenshot/markdown (Root Path)
Given I have a Gotenberg container with the following environment variable(s):
| API_ENABLE_DEBUG_ROUTE | true |
| API_ROOT_PATH | /foo/ |
When I make a "POST" request to Gotenberg at the "/foo/forms/chromium/screenshot/markdown" endpoint with the following form data and header(s):
| files | testdata/page-1-markdown/index.html | file |
| files | testdata/page-1-markdown/page_1.md | file |
Then the response status code should be 200
Then the response header "Content-Type" should be "image/png"

View File

@@ -0,0 +1,81 @@
@chromium
@chromium-screenshot-url
Feature: /forms/chromium/screenshot/url
Scenario: POST /forms/chromium/screenshot/url (Default)
Given I have a default Gotenberg container
Given I have a static server
When I make a "POST" request to Gotenberg at the "/forms/chromium/screenshot/url" endpoint with the following form data and header(s):
| url | http://host.docker.internal:%d/html/testdata/page-1-html/index.html | field |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the response header "Content-Type" should be "image/png"
Then there should be the following file(s) in the response:
| foo.png |
Scenario: POST /forms/chromium/screenshot/url (JPEG)
Given I have a default Gotenberg container
Given I have a static server
When I make a "POST" request to Gotenberg at the "/forms/chromium/screenshot/url" endpoint with the following form data and header(s):
| url | http://host.docker.internal:%d/html/testdata/page-1-html/index.html | field |
| format | jpeg | field |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the response header "Content-Type" should be "image/jpeg"
Then there should be the following file(s) in the response:
| foo.jpeg |
Scenario: POST /forms/chromium/screenshot/url (WebP)
Given I have a default Gotenberg container
Given I have a static server
When I make a "POST" request to Gotenberg at the "/forms/chromium/screenshot/url" endpoint with the following form data and header(s):
| url | http://host.docker.internal:%d/html/testdata/page-1-html/index.html | field |
| format | webp | field |
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 200
Then the response header "Content-Type" should be "image/webp"
Then there should be the following file(s) in the response:
| foo.webp |
Scenario: POST /forms/chromium/screenshot/url (Bad Request - Missing URL)
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/chromium/screenshot/url" endpoint with the following form data and header(s):
| Gotenberg-Output-Filename | foo | header |
Then the response status code should be 400
Then the response header "Content-Type" should be "text/plain; charset=UTF-8"
@webhook
Scenario: POST /forms/chromium/screenshot/url (Webhook)
Given I have a default Gotenberg container
Given I have a static server
Given I have a webhook server
When I make a "POST" request to Gotenberg at the "/forms/chromium/screenshot/url" endpoint with the following form data and header(s):
| url | http://host.docker.internal:%d/html/testdata/page-1-html/index.html | field |
| Gotenberg-Output-Filename | foo | header |
| Gotenberg-Webhook-Url | http://host.docker.internal:%d/webhook | header |
| Gotenberg-Webhook-Error-Url | http://host.docker.internal:%d/webhook/error | header |
Then the response status code should be 204
When I wait for the asynchronous request to the webhook
Then the webhook request header "Content-Type" should be "image/png"
Then there should be the following file(s) in the webhook request:
| foo.png |
Scenario: POST /forms/chromium/screenshot/url (Basic Auth)
Given I have a Gotenberg container with the following environment variable(s):
| API_ENABLE_BASIC_AUTH | true |
| GOTENBERG_API_BASIC_AUTH_USERNAME | foo |
| GOTENBERG_API_BASIC_AUTH_PASSWORD | bar |
Given I have a static server
When I make a "POST" request to Gotenberg at the "/forms/chromium/screenshot/url" endpoint with the following form data and header(s):
| url | http://host.docker.internal:%d/html/testdata/page-1-html/index.html | field |
Then the response status code should be 401
Scenario: POST /foo/forms/chromium/screenshot/url (Root Path)
Given I have a Gotenberg container with the following environment variable(s):
| API_ENABLE_DEBUG_ROUTE | true |
| API_ROOT_PATH | /foo/ |
Given I have a static server
When I make a "POST" request to Gotenberg at the "/foo/forms/chromium/screenshot/url" endpoint with the following form data and header(s):
| url | http://host.docker.internal:%d/html/testdata/page-1-html/index.html | field |
Then the response status code should be 200
Then the response header "Content-Type" should be "image/png"

View File

@@ -290,7 +290,8 @@ Feature: /debug
Scenario: GET /debug (Gotenberg Trace)
Given I have a Gotenberg container with the following environment variable(s):
| API_ENABLE_DEBUG_ROUTE | true |
| API_ENABLE_DEBUG_ROUTE | true |
| API_DISABLE_DEBUG_ROUTE_TELEMETRY | false |
When I make a "GET" request to Gotenberg at the "/debug" endpoint with the following header(s):
| Gotenberg-Trace | debug |
Then the response status code should be 200

View File

@@ -6,7 +6,8 @@
Feature: /health
Scenario: GET /health
Given I have a default Gotenberg container
Given I have a Gotenberg container with the following environment variable(s):
| API_DISABLE_HEALTH_CHECK_ROUTE_TELEMETRY | false |
When I make a "GET" request to Gotenberg at the "/health" endpoint
Then the response status code should be 200
Then the response header "Content-Type" should be "application/json; charset=utf-8"
@@ -38,7 +39,8 @@ Feature: /health
| "path":"/health" |
Scenario: GET /health (Gotenberg Trace)
Given I have a default Gotenberg container
Given I have a Gotenberg container with the following environment variable(s):
| API_DISABLE_HEALTH_CHECK_ROUTE_TELEMETRY | false |
When I make a "GET" request to Gotenberg at the "/health" endpoint with the following header(s):
| Gotenberg-Trace | get_health |
Then the response status code should be 200
@@ -61,7 +63,8 @@ Feature: /health
Then the response status code should be 200
Scenario: HEAD /health
Given I have a default Gotenberg container
Given I have a Gotenberg container with the following environment variable(s):
| API_DISABLE_HEALTH_CHECK_ROUTE_TELEMETRY | false |
When I make a "HEAD" request to Gotenberg at the "/health" endpoint
Then the response status code should be 200
Then the response body should match string:
@@ -72,7 +75,8 @@ Feature: /health
| "path":"/health" |
Scenario: HEAD /health (Gotenberg Trace)
Given I have a default Gotenberg container
Given I have a Gotenberg container with the following environment variable(s):
| API_DISABLE_HEALTH_CHECK_ROUTE_TELEMETRY | false |
When I make a "HEAD" request to Gotenberg at the "/health" endpoint with the following header(s):
| Gotenberg-Trace | head_health |
Then the response status code should be 200

View File

@@ -6,7 +6,8 @@
Feature: /prometheus/metrics
Scenario: GET /prometheus/metrics (Enabled)
Given I have a default Gotenberg container
Given I have a Gotenberg container with the following environment variable(s):
| PROMETHEUS_DISABLE_ROUTE_TELEMETRY | false |
When I make a "GET" request to Gotenberg at the "/prometheus/metrics" endpoint
Then the response status code should be 200
Then the response header "Content-Type" should be "text/plain; version=0.0.4; charset=utf-8; escaping=underscores"
@@ -31,7 +32,8 @@ Feature: /prometheus/metrics
Scenario: GET /custom/metrics (Custom Metrics Path)
Given I have a Gotenberg container with the following environment variable(s):
| PROMETHEUS_METRICS_PATH | /custom/metrics |
| PROMETHEUS_METRICS_PATH | /custom/metrics |
| PROMETHEUS_DISABLE_ROUTE_TELEMETRY | false |
When I make a "GET" request to Gotenberg at the "/custom/metrics" endpoint
Then the response status code should be 200
Then the response header "Content-Type" should be "text/plain; version=0.0.4; charset=utf-8; escaping=underscores"
@@ -92,7 +94,8 @@ Feature: /prometheus/metrics
| "path":"/prometheus/metrics" |
Scenario: GET /prometheus/metrics (Gotenberg Trace)
Given I have a default Gotenberg container
Given I have a Gotenberg container with the following environment variable(s):
| PROMETHEUS_DISABLE_ROUTE_TELEMETRY | false |
When I make a "GET" request to Gotenberg at the "/prometheus/metrics" endpoint with the following header(s):
| Gotenberg-Trace | prometheus_metrics |
Then the response status code should be 200

View File

@@ -12,7 +12,8 @@ Feature: /
"""
Scenario: GET / (Gotenberg Trace)
Given I have a default Gotenberg container
Given I have a Gotenberg container with the following environment variable(s):
| API_DISABLE_ROOT_ROUTE_TELEMETRY | false |
When I make a "GET" request to Gotenberg at the "/" endpoint with the following header(s):
| Gotenberg-Trace | root |
Then the response status code should be 200

View File

@@ -12,7 +12,8 @@ Feature: /version
"""
Scenario: GET /version (Gotenberg Trace)
Given I have a default Gotenberg container
Given I have a Gotenberg container with the following environment variable(s):
| API_DISABLE_VERSION_ROUTE_TELEMETRY | false |
When I make a "GET" request to Gotenberg at the "/version" endpoint with the following header(s):
| Gotenberg-Trace | version |
Then the response status code should be 200